Beispiel #1
0
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    float y = event.getY();
    clickIndex = (int) ((y - paddingTop) / itemHeight);
    switch (event.getAction()) {
      case MotionEvent.ACTION_UP:
        is_select = false;
        break;
      case MotionEvent.ACTION_DOWN:
        is_select = true;
        break;
      case MotionEvent.ACTION_SCROLL:
        is_select = true;
        break;
    }
    invalidate();
    if (null != listener && clickIndex > -1) {
      try {

        listener.onDataChange(indexStr[clickIndex], is_select);
      } catch (ArrayIndexOutOfBoundsException e) {
        LogUtils.e(" array index out of bound error  clickIndex =" + clickIndex);
      }
    }
    return true;
  }
 private void callListener() {
   if (listener != null) {
     listener.onDataChange(getCount(), getLoadingString());
   }
 }