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);
  }
Example #2
0
 @Override
 protected void onAttachedToWindow() {
   super.onAttachedToWindow();
   if (mStyleId != 0) {
     ThemeManager.getInstance().registerOnThemeChangedListener(this);
     onThemeChanged(null);
   }
 }
Example #3
0
 @Override
 public void onThemeChanged(ThemeManager.OnThemeChangedEvent event) {
   int style = ThemeManager.getInstance().getCurrentStyle(mStyleId);
   if (mCurrentStyle != style) {
     mCurrentStyle = style;
     applyStyle(mCurrentStyle);
   }
 }
Example #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);
  }
Example #5
0
 @Override
 protected void onDetachedFromWindow() {
   super.onDetachedFromWindow();
   mRippleManager.cancelRipple(this);
   if (mStyleId != 0) ThemeManager.getInstance().unregisterOnThemeChangedListener(this);
 }
Example #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);
  }