Ejemplo n.º 1
0
 @Override
 public void restoreState(Parcelable in) {
   super.restoreState(in);
   Bundle state = (Bundle) in;
   final boolean menuOpen = state.getBoolean(STATE_MENU_VISIBLE);
   if (menuOpen) {
     open(false);
   } else {
     setOffsetPixels(0);
   }
   mDrawerState = menuOpen ? STATE_OPEN : STATE_CLOSED;
 }
Ejemplo n.º 2
0
  @Override
  protected void init(Context context, AttributeSet attrs, int defStyle) {
    super.init(context, attrs, defStyle);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMaxVelocity = configuration.getScaledMaximumFlingVelocity();

    mScroller = new Scroller(context, SwipeBack.SMOOTH_INTERPOLATOR);
    mPeekScroller = new Scroller(context, DraggableSwipeBack.PEEK_INTERPOLATOR);

    mCloseEnough = dpToPx(DraggableSwipeBack.CLOSE_ENOUGH);
  }