@Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { ListView listView = (ListView) parent; String guid = (String) listView.getItemAtPosition(position); guid = guid.trim(); int tid = StringUtil.getUrlParameter(guid, "tid"); toDeleteTid = tid; DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: DeleteBookmarkTask task = new DeleteBookmarkTask(FlexibleTopicListActivity.this); task.execute(String.valueOf(toDeleteTid)); break; case DialogInterface.BUTTON_NEGATIVE: // Do nothing break; } } }; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder .setMessage(this.getString(R.string.delete_favo_confirm_text)) .setPositiveButton(R.string.confirm, dialogClickListener) .setNegativeButton(R.string.cancle, dialogClickListener) .show(); return true; }
@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) { 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"); Intent intent = new Intent(); intent.putExtra("tab", "1"); intent.putExtra("tid", tid); intent.putExtra("pid", pid); intent.putExtra("authorid", authorid); if (fromreplyactivity) { intent.putExtra("fromreplyactivity", 1); } 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); intent.setClass(activity, PhoneConfiguration.getInstance().articleActivityClass); activity.startActivity(intent); if (PhoneConfiguration.getInstance().showAnimation) activity.overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit); }