private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    setClickable(true);
    mSwitchIconAnimator = new SwitchIconAnimator();
    applyStyle(context, attrs, defStyleAttr, defStyleRes);

    mStyleId = ThemeManager.getStyleId(context, attrs, defStyleAttr, defStyleRes);
  }
Exemplo n.º 2
0
 @Override
 protected void onAttachedToWindow() {
   super.onAttachedToWindow();
   if (mStyleId != 0) {
     ThemeManager.getInstance().registerOnThemeChangedListener(this);
     onThemeChanged(null);
   }
 }
Exemplo n.º 3
0
 @Override
 public void onThemeChanged(ThemeManager.OnThemeChangedEvent event) {
   int style = ThemeManager.getInstance().getCurrentStyle(mStyleId);
   if (mCurrentStyle != style) {
     mCurrentStyle = style;
     applyStyle(mCurrentStyle);
   }
 }
Exemplo n.º 4
0
  protected void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    mDrawRect = new RectF();
    mTempRect = new RectF();
    mTrackPath = new Path();

    mFlingVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity();

    applyStyle(context, attrs, defStyleAttr, defStyleRes);

    if (!isInEditMode())
      mStyleId = ThemeManager.getStyleId(context, attrs, defStyleAttr, defStyleRes);
  }
Exemplo n.º 5
0
 @Override
 protected void onDetachedFromWindow() {
   super.onDetachedFromWindow();
   mRippleManager.cancelRipple(this);
   if (mStyleId != 0) ThemeManager.getInstance().unregisterOnThemeChangedListener(this);
 }
Exemplo n.º 6
0
  private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    applyStyle(context, attrs, defStyleAttr, defStyleRes);

    mStyleId = ThemeManager.getStyleId(context, attrs, defStyleAttr, defStyleRes);
  }