Пример #1
0
 /** 打开菜单 */
 public void openMenu() {
   Log.i("TAG", "15");
   if (isOpen) {
     Log.i("TAG", "16");
     return;
   }
   Log.i("TAG", "17");
   this.smoothScrollTo(mScrollWidth, 0);
   isOpen = true;
   mIonSlidingButtonListener.onMenuIsOpen(this);
 }
Пример #2
0
 /** 按滚动条被拖动距离判断关闭或打开菜单 */
 public void changeScrollx() {
   Log.i("TAG", "滚动滚动条  12");
   if (getScrollX() >= (mScrollWidth / 2)) {
     this.smoothScrollTo(mScrollWidth, 0);
     isOpen = true;
     mIonSlidingButtonListener.onMenuIsOpen(this);
     Log.i("TAG", "滚动滚动条  展开  13" + isOpen);
   } else {
     Log.i("TAG", "滚动滚动条  关闭   14");
     this.smoothScrollTo(0, 0);
     isOpen = false;
   }
 }
Пример #3
0
 @Override
 public boolean onTouchEvent(MotionEvent ev) {
   Log.i("TAG", "18");
   int action = ev.getAction();
   switch (action) {
     case MotionEvent.ACTION_DOWN:
     case MotionEvent.ACTION_MOVE:
       Log.i("TAG", "ACTION_MOVE  8");
       mIonSlidingButtonListener.onDownOrMove(this);
       break;
     case MotionEvent.ACTION_UP:
     case MotionEvent.ACTION_CANCEL:
       Log.i("TAG", "ACTION_CANCEL  10");
       changeScrollx();
       return true;
     default:
       break;
   }
   return super.onTouchEvent(ev);
 }