public void doClick(boolean selectedInActionMode) {
    if (selectedInActionMode && mDragInfo != null && mDragInfo.parentView instanceof AbsListView) {
      Log.i(TAG, "Do click in action mode.");
      if (mDragReady) {
        if (mDragProgressDelegate != null) {
          mDragProgressDelegate.revertDragPreparation(this);
        }
        mDragReady = false;
      } else {
        // Due to the interactive ability of this widget
        AbsListView parentListView = (AbsListView) mDragInfo.parentView;
        int position = mDragInfo.positionAsChild;
        if (parentListView != null && position >= 0) {
          boolean lastChecked = parentListView.isItemChecked(position);

          parentListView.setItemChecked(position, !lastChecked);
          parentListView.invalidate();
        }
      }
    } else {
      Log.i(TAG, "Do click in non action mode .");
      if (mDragInfo.parentView instanceof AbsListView && mDragInfo.positionAsChild >= 0) {
        AbsListView parentListView = (AbsListView) mDragInfo.parentView;
        int position = mDragInfo.positionAsChild;
        OnItemClickListener clickListener = parentListView.getOnItemClickListener();
        if (clickListener != null) {
          clickListener.onItemClick(parentListView, this, position, this.getId());
        }
      }
    }
  }
Example #2
0
 private void handleClick(Dot selected) {
   if ((prevSelected == null) || (prevSelected.equals(selected) == false)) {
     if (mItemClickListener != null) {
       mItemClickListener.onItemClick(null, this, selected.id, selected.id);
     }
     prevSelected = selected;
   }
 }
  /**
   * Call the OnItemClickListener, if it is defined.
   *
   * @param view The view within the AdapterView that was clicked.
   * @param position The position of the view in the adapter.
   * @param id The row id of the item that was clicked.
   * @return True if there was an assigned OnItemClickListener that was called, false otherwise is
   *     returned.
   */
  public boolean performItemClick(View view, int position, long id) {
    if (mOnItemClickListener != null) {
      playSoundEffect(SoundEffectConstants.CLICK);
      if (view != null) {
        view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
      }
      mOnItemClickListener.onItemClick(/*this*/ null, view, position, id);
      return true;
    }

    return false;
  }
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

    if (!dualScreen) {
      if (null == onItemClickNewActivity) {
        onItemClickNewActivity = new EnterJsonArticle(this);
      }
      onItemClickNewActivity.onItemClick(parent, view, position, id);

    } else {
      String guid = (String) parent.getItemAtPosition(position);
      if (StringUtil.isEmpty(guid)) return;

      guid = guid.trim();

      int pid = StringUtil.getUrlParameter(guid, "pid");
      int tid = StringUtil.getUrlParameter(guid, "tid");
      int authorid = StringUtil.getUrlParameter(guid, "authorid");
      ArticleContainerFragment f = ArticleContainerFragment.create(tid, pid, authorid);
      FragmentManager fm = getSupportFragmentManager();
      FragmentTransaction ft = fm.beginTransaction();

      ft.replace(R.id.item_detail_container, f);
      Fragment f1 = fm.findFragmentById(R.id.item_list);
      f1.setHasOptionsMenu(false);
      f.setHasOptionsMenu(true);
      ft.commit();

      ListView listview = (ListView) parent;
      Object a = parent.getAdapter();
      TopicListAdapter adapter = null;
      if (a instanceof TopicListAdapter) {
        adapter = (TopicListAdapter) a;
      } else if (a instanceof HeaderViewListAdapter) {
        HeaderViewListAdapter ha = (HeaderViewListAdapter) a;
        adapter = (TopicListAdapter) ha.getWrappedAdapter();
        position -= ha.getHeadersCount();
      }
      adapter.setSelected(position);
      listview.setItemChecked(position, true);
    }
  }
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   mOnItemClickListener.onItemClick(
       parent, view, mAdapter.translatePosition(position).mPosition, id);
 }
Example #6
0
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   if (listener != null) {
     listener.onItemClick(position);
   }
   dismiss();
 }