fix deprecated

This commit is contained in:
CsHeng
2017-06-16 16:12:28 +08:00
parent b3d63c5698
commit 5e668d9e13
9 changed files with 57 additions and 60 deletions

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
@ -47,25 +48,25 @@ public class CardRelativeLayout extends RelativeLayout {
}
if (isTran) {
mLeftDrawable = getResources().getDrawable(R.drawable.frame_tran_left);
topDrawable = getResources().getDrawable(R.drawable.frame_tran_top);
mRightDrawable = getResources().getDrawable(R.drawable.frame_tran_right);
bottomDrawable = getResources().getDrawable(R.drawable.frame_tran_bottom);
mLeftDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_left);
topDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_top);
mRightDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_right);
bottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_bottom);
leftTopDrawable = getResources().getDrawable(R.drawable.frame_tran_left_top_square);
rightTopDrawable = getResources().getDrawable(R.drawable.frame_tran_right_top_square);
leftBottomDrawable = getResources().getDrawable(R.drawable.frame_tran_left_bottom_square);
rightBottomDrawable = getResources().getDrawable(R.drawable.frame_tran_right_bottom_square);
leftTopDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_left_top_square);
rightTopDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_right_top_square);
leftBottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_left_bottom_square);
rightBottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_right_bottom_square);
} else {
mLeftDrawable = getResources().getDrawable(R.drawable.frame_left);
topDrawable = getResources().getDrawable(R.drawable.frame_top);
mRightDrawable = getResources().getDrawable(R.drawable.frame_right);
bottomDrawable = getResources().getDrawable(R.drawable.frame_bottom);
mLeftDrawable = ContextCompat.getDrawable(context, R.drawable.frame_left);
topDrawable = ContextCompat.getDrawable(context, R.drawable.frame_top);
mRightDrawable = ContextCompat.getDrawable(context, R.drawable.frame_right);
bottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_bottom);
leftTopDrawable = getResources().getDrawable(R.drawable.frame_left_top_square);
rightTopDrawable = getResources().getDrawable(R.drawable.frame_right_top_square);
leftBottomDrawable = getResources().getDrawable(R.drawable.frame_left_bottom_square);
rightBottomDrawable = getResources().getDrawable(R.drawable.frame_right_bottom_square);
leftTopDrawable = ContextCompat.getDrawable(context, R.drawable.frame_left_top_square);
rightTopDrawable = ContextCompat.getDrawable(context, R.drawable.frame_right_top_square);
leftBottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_left_bottom_square);
rightBottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_right_bottom_square);
}
}