示例#1
0
 public void setColourIndex(int colourIndex) {
   mTextColour = mTextColours.getTextColour(colourIndex);
   mBgColour = mTextColours.getBackgroundColour(colourIndex);
   setTextColor(mTextColour);
   GradientDrawable drawable = DrawableUtils.createGradient(mBgColour, Orientation.TOP_BOTTOM);
   int radius = getResources().getDimensionPixelSize(R.dimen.context_small_corner_radius);
   drawable.setCornerRadius(radius);
   setBackgroundDrawable(drawable);
 }
示例#2
0
 private void init(Context context) {
   mTextColours = TextColours.getInstance(context);
   int horizontalPadding =
       getResources().getDimensionPixelSize(R.dimen.context_small_horizontal_padding);
   int verticalPadding =
       getResources().getDimensionPixelSize(R.dimen.context_small_vertical_padding);
   int iconPadding = getResources().getDimensionPixelSize(R.dimen.context_small_icon_padding);
   setPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding);
   setCompoundDrawablePadding(iconPadding);
 }