Beispiel #1
0
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    switch (event.getAction()) {
      case MotionEvent.ACTION_DOWN:
        {
          int x = (int) event.getX();
          int y = (int) event.getY();
          int position = pointToPosition(x, y);
          Log.e(TAG, "postion=" + position);
          if (position != INVALID_POSITION) {
            MessageItem data = (MessageItem) getItemAtPosition(position);
            mFocusedItemView = data.slideView;
            Log.e(TAG, "FocusedItemView=" + mFocusedItemView);
          }
        }
      default:
        break;
    }

    if (mFocusedItemView != null) {
      mFocusedItemView.onRequireTouchEvent(event);
    }
    return super.onTouchEvent(event);
    //        return handlerTouchResult(event);
  }
  public void select(int index) {
    if (index >= views.size()) {
      return;
    }

    if (exclusion) {
      for (int i = 0; i < views.size(); i++) {
        SlideView v = views.get(i);
        if ((i != index && v.isOpened()) || (i == index)) {
          v.toggle();
        }
      }

    } else {
      SlideView v = views.get(index);
      v.toggle();
    }
  }
Beispiel #3
0
  public void shrinkListItem(int position) {
    View item = getChildAt(position);

    if (item != null) {
      try {
        ((SlideView) item).shrink();
      } catch (ClassCastException e) {
        e.printStackTrace();
      }
    }
  }
 public MyView3(Context context, AttributeSet attrs) {
   super(context, attrs);
   super.inflate(context, R.layout.my_view3, this);
 }