Ejemplo n.º 1
0
  @Override
  protected void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    mTextSize = -1;
    mItemHeight = -1;
    mAnimDuration = -1;
    mTypeface = Typeface.DEFAULT;
    mItemRealHeight = -1;

    setWillNotDraw(false);
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Paint.Style.FILL);

    mAdapter = new YearAdapter();
    setAdapter(mAdapter);
    setScrollBarStyle(SCROLLBARS_OUTSIDE_OVERLAY);
    setSelector(BlankDrawable.getInstance());
    setDividerHeight(0);
    setCacheColorHint(Color.TRANSPARENT);
    setClipToPadding(false);

    mPadding = ThemeUtil.dpToPx(context, 4);

    mSelectionColor = ThemeUtil.colorPrimary(context, 0xFF000000);

    super.init(context, attrs, defStyleAttr, defStyleRes);
  }
Ejemplo n.º 2
0
  private void applyStyle(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TypedArray a =
        context.obtainStyledAttributes(attrs, R.styleable.TimePicker, defStyleAttr, defStyleRes);
    mBackgroundColor =
        a.getColor(
            R.styleable.TimePicker_tp_backgroundColor,
            ColorUtil.getColor(ThemeUtil.colorPrimary(context, 0xFF000000), 0.25f));
    mSelectionColor =
        a.getColor(
            R.styleable.TimePicker_tp_selectionColor, ThemeUtil.colorPrimary(context, 0xFF000000));
    mSelectionRadius =
        a.getDimensionPixelOffset(
            R.styleable.TimePicker_tp_selectionRadius, ThemeUtil.dpToPx(context, 8));
    mTickSize =
        a.getDimensionPixelSize(R.styleable.TimePicker_tp_tickSize, ThemeUtil.dpToPx(context, 1));
    mTextSize =
        a.getDimensionPixelSize(
            R.styleable.TimePicker_tp_textSize,
            context.getResources().getDimensionPixelOffset(R.dimen.abc_text_size_caption_material));
    mTextColor = a.getColor(R.styleable.TimePicker_tp_textColor, 0xFF000000);
    mTextHighlightColor = a.getColor(R.styleable.TimePicker_tp_textHighlightColor, 0xFFFFFFFF);
    mAnimDuration =
        a.getInteger(
            R.styleable.TimePicker_tp_animDuration,
            context.getResources().getInteger(android.R.integer.config_mediumAnimTime));
    int resId = a.getResourceId(R.styleable.TimePicker_tp_inInterpolator, 0);
    mInInterpolator =
        resId == 0 ? new DecelerateInterpolator() : AnimationUtils.loadInterpolator(context, resId);
    resId = a.getResourceId(R.styleable.TimePicker_tp_outInterpolator, 0);
    mOutInterpolator =
        resId == 0 ? new DecelerateInterpolator() : AnimationUtils.loadInterpolator(context, resId);
    setMode(a.getInteger(R.styleable.TimePicker_tp_mode, mMode), false);
    set24Hour(a.getBoolean(R.styleable.TimePicker_tp_24Hour, m24Hour));
    setHour(a.getInteger(R.styleable.TimePicker_tp_hour, mHour));
    setMinute(a.getInteger(R.styleable.TimePicker_tp_minute, mMinute));

    String familyName = a.getString(R.styleable.TimePicker_tp_fontFamily);
    int style = a.getInteger(R.styleable.TimePicker_tp_textStyle, Typeface.NORMAL);

    mTypeface = TypefaceUtil.load(context, familyName, style);

    a.recycle();
  }
Ejemplo n.º 3
0
 public HeaderDrawable(Context context) {
   mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
   mPaint.setColor(ThemeUtil.colorPrimary(context, 0));
   mPaint.setStyle(Paint.Style.FILL);
   mPath = new Path();
 }