@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; int actualPos = info.position - tagListView.getHeaderViewsCount(); if (actualPos < 0) return; Tag tagClicked = tags.getTags().get(actualPos); // Log.i("occm", tagClicked.getParent_id() + " " + // tagClicked.getComment().toString()); String userId = tagInfo.getString("user_id", "error"); boolean isOwnTag = (tagClicked.getUser_id().equals(userId)); menu.setHeaderTitle(R.string.context_menu_header); menu.add(0, v.getId(), 6, R.string.context_menu_reply); if (!tagClicked.getParent_id().equals("0")) { menu.add(0, v.getId(), 5, R.string.context_menu_show_orig); } if (isOwnTag) return; if (!tagClicked.getIs_thumbedup()) menu.add(0, v.getId(), 1, R.string.context_menu_thumbup); if (Session.getFollowerSet().contains(tagClicked.getUser_id())) menu.add(0, v.getId(), 3, R.string.context_menu_unfollow); else menu.add(0, v.getId(), 4, R.string.context_menu_follow); }
@Override public void onDestroy() { super.onDestroy(); Util.writeFollowingSet(Session.getFollowerSet()); }