Java Code Examples for android.view.View#setOnCreateContextMenuListener()
The following examples show how to use
android.view.View#setOnCreateContextMenuListener() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: SteamGifts File: CommentViewHolder.java License: MIT License | 6 votes |
public CommentViewHolder(View v, Context context, ICommentableFragment fragment) { super(v); this.fragment = fragment; this.context = context; commentAuthor = (TextView) v.findViewById(R.id.user); commentTime = (TextView) v.findViewById(R.id.time); commentRole = (TextView) v.findViewById(R.id.role); commentContent = (TextView) v.findViewById(R.id.content); commentContent.setMovementMethod(LinkMovementMethod.getInstance()); commentMarker = v.findViewById(R.id.comment_marker); commentIndent = v.findViewById(R.id.comment_indent); commentImage = (ImageView) v.findViewById(R.id.author_avatar); tradeScoreDivider = v.findViewById(R.id.trade_divider); tradeScorePositive = (TextView) v.findViewById(R.id.trade_score_positive); tradeScoreNegative = (TextView) v.findViewById(R.id.trade_score_negative); v.setOnCreateContextMenuListener(this); }
Example 2
Source Project: Pix-Art-Messenger File: ChannelSearchResultAdapter.java License: GNU General Public License v3.0 | 6 votes |
@Override public void onBindViewHolder(@NonNull ViewHolder viewHolder, int position) { final Room searchResult = getItem(position); viewHolder.binding.name.setText(searchResult.getName()); final String description = searchResult.getDescription(); final String language = searchResult.getLanguage(); if (TextUtils.isEmpty(description)) { viewHolder.binding.description.setVisibility(View.GONE); } else { viewHolder.binding.description.setText(description); viewHolder.binding.description.setVisibility(View.VISIBLE); } if (language == null || language.length() != 2) { viewHolder.binding.language.setVisibility(View.GONE); } else { viewHolder.binding.language.setText(language.toUpperCase(Locale.ENGLISH)); viewHolder.binding.language.setVisibility(View.VISIBLE); } final Jid room = searchResult.getRoom(); viewHolder.binding.room.setText(room != null ? room.asBareJid().toString() : ""); AvatarWorkerTask.loadAvatar(searchResult, viewHolder.binding.avatar, R.dimen.avatar); final View root = viewHolder.binding.getRoot(); root.setTag(searchResult); root.setOnClickListener(v -> listener.onChannelSearchResult(searchResult)); root.setOnCreateContextMenuListener(this); }
Example 3
Source Project: OpenLibre File: LogRecyclerViewAdapter.java License: GNU General Public License v3.0 | 6 votes |
LogRowViewHolder(View view) { super(view); tv_date = (TextView) view.findViewById(R.id.tv_log_date); tv_time = (TextView) view.findViewById(R.id.tv_log_time); tv_glucose = (TextView) view.findViewById(R.id.tv_log_glucose); iv_unit = (ImageView) view.findViewById(R.id.iv_log_unit); iv_predictionArrow = (ImageView) view.findViewById(R.id.iv_log_prediction); view.setOnClickListener(this); // enable context menu only in developer mode SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(fragment.getContext()); boolean developerMode = settings.getBoolean("pref_developer_mode", false); if (developerMode) { view.setOnCreateContextMenuListener(this); } }
Example 4
Source Project: bcm-android File: TransactionAdapter.java License: GNU General Public License v3.0 | 5 votes |
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.view_w_transaction, parent, false); itemView.setOnCreateContextMenuListener(contextMenuListener); itemView.setOnClickListener(clickListener); return new MyViewHolder(itemView); }
Example 5
Source Project: bcm-android File: WalletAdapter.java License: GNU General Public License v3.0 | 5 votes |
@Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.view_w_address, parent, false); itemView.setOnClickListener(listener); itemView.setOnCreateContextMenuListener(contextMenuListener); return new MyViewHolder(itemView); }
Example 6
Source Project: android-app File: ListAdapter.java License: GNU General Public License v3.0 | 5 votes |
ViewHolder(View itemView, OnItemClickListener listener) { super(itemView); this.listener = listener; title = itemView.findViewById(R.id.title); url = itemView.findViewById(R.id.url); favourite = itemView.findViewById(R.id.favourite); read = itemView.findViewById(R.id.read); readingTime = itemView.findViewById(R.id.estimatedReadingTime); itemView.setOnClickListener(this); itemView.setOnCreateContextMenuListener(this); }
Example 7
Source Project: Lunary-Ethereum-Wallet File: TransactionAdapter.java License: GNU General Public License v3.0 | 5 votes |
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == CONTENT) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.view_w_transaction, parent, false); itemView.setOnCreateContextMenuListener(contextMenuListener); itemView.setOnClickListener(clickListener); return new MyViewHolder(itemView); } else { return new AdRecyclerHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_w_transaction_ad, parent, false)); } }
Example 8
Source Project: Lunary-Ethereum-Wallet File: TokenAdapter.java License: GNU General Public License v3.0 | 5 votes |
@Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.view_w_token, parent, false); itemView.setOnClickListener(listener); itemView.setOnCreateContextMenuListener(contextMenuListener); return new MyViewHolder(itemView); }
Example 9
Source Project: android-periodic-table File: IsotopesAdapter.java License: GNU General Public License v3.0 | 5 votes |
public GroupViewHolder(View view) { super(view); mIndicator = (ExpandableIndicatorView) view.findViewById(R.id.group_indicator); mSymbol = (TextView) view.findViewById(R.id.property_symbol); mHalfLife = (TextView) view.findViewById(R.id.property_half_life); mAbundance = (TextView) view.findViewById(R.id.property_abundance); view.setOnClickListener(this); view.setOnCreateContextMenuListener(this); }
Example 10
Source Project: android-periodic-table File: PropertiesAdapter.java License: GNU General Public License v3.0 | 5 votes |
public ViewHolder(View itemView) { super(itemView); mName = (TextView) itemView.findViewById(R.id.property_name); mValue = (TextView) itemView.findViewById(R.id.property_value); if (mValue != null) { mValue.setTypeface(mTypeface); itemView.setOnClickListener(this); itemView.setOnCreateContextMenuListener(this); } }
Example 11
Source Project: YiBo File: MicroBlogActivity.java License: Apache License 2.0 | 4 votes |
public void initComponent() { LinearLayout llRoot = (LinearLayout)findViewById(R.id.llRoot); LinearLayout llHeaderBase = (LinearLayout)findViewById(R.id.llHeaderBase); ThemeUtil.setRootBackground(llRoot); ThemeUtil.setSecondaryMicroBlogHeader(llHeaderBase); //资料头部 LayoutInflater inflater = LayoutInflater.from(this); View headerView = inflater.inflate(R.layout.include_micro_blog_list_header, null); LinearLayout llProfileHeader = (LinearLayout)headerView.findViewById(R.id.llProfileHeader); TextView tvScreenName = (TextView)headerView.findViewById(R.id.tvScreenName); ImageView ivVerify = (ImageView)headerView.findViewById(R.id.ivVerify); TextView tvImpress = (TextView)headerView.findViewById(R.id.tvImpress); ImageView ivMoreDetail = (ImageView)headerView.findViewById(R.id.ivMoreDetail); ThemeUtil.setHeaderProfile(llProfileHeader); int highlight = theme.getColor("highlight"); tvScreenName.setTextColor(highlight); ivVerify.setImageDrawable(theme.getDrawable("icon_verification")); tvImpress.setTextColor(theme.getColor("content")); ivMoreDetail.setBackgroundDrawable(theme.getDrawable("icon_more_detail")); //微博内容 TextView tvText = (TextView)headerView.findViewById(R.id.tvText); LinearLayout llThumbnailShape = (LinearLayout)headerView.findViewById(R.id.llThumbnailShape); TextView tvImageInfo = (TextView)headerView.findViewById(R.id.tvImageInfo); LinearLayout llRetweet = (LinearLayout)headerView.findViewById(R.id.llRetweet); TextView tvRetweetText = (TextView)headerView.findViewById(R.id.tvRetweetText); LinearLayout llRetweetThumbnailShape = (LinearLayout)headerView.findViewById(R.id.llRetweetThumbnailShape); TextView tvRetweetImageInfo = (TextView)headerView.findViewById(R.id.tvRetweetImageInfo); ImageView ivRetweetLocation = (ImageView)headerView.findViewById(R.id.ivRetweetLocation); TextView tvRetweetLocation = (TextView)headerView.findViewById(R.id.tvRetweetLocation); TextView tvRetweetCreatedAt = (TextView)headerView.findViewById(R.id.tvRetweetCreatedAt); TextView tvRetweetSource = (TextView)headerView.findViewById(R.id.tvRetweetSource); ImageView ivLocation = (ImageView)headerView.findViewById(R.id.ivLocation); TextView tvLocation = (TextView)headerView.findViewById(R.id.tvLocation); TextView tvCreatedAt = (TextView)headerView.findViewById(R.id.tvCreatedAt); TextView tvSource = (TextView)headerView.findViewById(R.id.tvSource); TextView tvRetweetCount = (TextView)headerView.findViewById(R.id.tvRetweetCount); TextView tvCommentCount = (TextView)headerView.findViewById(R.id.tvCommentCount); ImageView ivLineSeperator = (ImageView)headerView.findViewById(R.id.ivLineSeperator); tvText.setTextColor(theme.getColor("content")); ColorStateList selectorTextLink = theme.getColorStateList("selector_text_link"); tvText.setLinkTextColor(selectorTextLink); Drawable shapeAttachment = theme.getDrawable("shape_attachment"); llThumbnailShape.setBackgroundDrawable(shapeAttachment); int quote = theme.getColor("quote"); tvImageInfo.setTextColor(quote); llRetweet.setBackgroundDrawable(theme.getDrawable("bg_retweet_frame")); int padding10 = theme.dip2px(10); llRetweet.setPadding(padding10, padding10, padding10, theme.dip2px(6)); tvRetweetText.setTextColor(quote); tvRetweetText.setLinkTextColor(selectorTextLink); llRetweetThumbnailShape.setBackgroundDrawable(shapeAttachment); tvRetweetImageInfo.setTextColor(quote); Drawable iconLocation = theme.getDrawable("icon_location"); ivRetweetLocation.setImageDrawable(iconLocation); tvRetweetLocation.setTextColor(quote); tvRetweetCreatedAt.setTextColor(quote); tvRetweetSource.setTextColor(quote); ivLocation.setImageDrawable(iconLocation); tvLocation.setTextColor(quote); tvCreatedAt.setTextColor(quote); tvSource.setTextColor(quote); int emphasize = theme.getColor("emphasize"); tvRetweetCount.setTextColor(emphasize); tvCommentCount.setTextColor(emphasize); ivLineSeperator.setBackgroundDrawable(theme.getDrawable("line_comment_of_status_normal")); //工具条 LinearLayout llToolbar = (LinearLayout)findViewById(R.id.llToolbar); Button btnComment = (Button)findViewById(R.id.btnComment); Button btnRetweet = (Button)findViewById(R.id.btnRetweet); Button btnFavorite = (Button)findViewById(R.id.btnFavorite); Button btnShare = (Button)findViewById(R.id.btnShare); Button btnMore = (Button)findViewById(R.id.btnMore); llToolbar.setBackgroundDrawable(theme.getDrawable("bg_toolbar")); btnComment.setBackgroundDrawable(theme.getDrawable("selector_toolbar_comment")); btnRetweet.setBackgroundDrawable(theme.getDrawable("selector_toolbar_retweet")); btnFavorite.setBackgroundDrawable(theme.getDrawable("selector_toolbar_favorite_add")); btnShare.setBackgroundDrawable(theme.getDrawable("selector_toolbar_share")); btnMore.setBackgroundDrawable(theme.getDrawable("selector_toolbar_more")); lvCommentsOfStatus = (ListView) this.findViewById(R.id.lvCommentsOfStatus); ThemeUtil.setListViewStyle(lvCommentsOfStatus); lvCommentsOfStatus.addHeaderView(headerView); setBack2Top(lvCommentsOfStatus); //注册上下文菜单 View statusView = this.findViewById(R.id.llStatus); statusContextMenuListener = new MicroBlogStatusContextMenuListener(status); statusView.setOnCreateContextMenuListener(statusContextMenuListener); autoLoadMoreListener = new AutoLoadMoreListener(); }
Example 12
Source Project: android_9.0.0_r45 File: Dialog.java License: Apache License 2.0 | 4 votes |
/** * @see Activity#registerForContextMenu(View) */ public void registerForContextMenu(@NonNull View view) { view.setOnCreateContextMenuListener(this); }
Example 13
Source Project: letv File: Fragment.java License: Apache License 2.0 | 4 votes |
public void registerForContextMenu(View view) { view.setOnCreateContextMenuListener(this); }
Example 14
Source Project: MiBandDecompiled File: Fragment.java License: Apache License 2.0 | 4 votes |
public void unregisterForContextMenu(View view) { view.setOnCreateContextMenuListener(null); }
Example 15
Source Project: TinyList File: SavedListsAdapter.java License: GNU General Public License v2.0 | 4 votes |
public ViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); itemView.setOnCreateContextMenuListener(this); }
Example 16
Source Project: aedict File: SearchClickListener.java License: GNU General Public License v3.0 | 3 votes |
/** * Registers the object to given view. * * @param view * the view * @return this */ public SearchClickListener registerTo(final View view) { view.setOnClickListener(this); new FocusVisual().registerTo(view); view.setOnCreateContextMenuListener(this); return this; }
Example 17
Source Project: CodenameOne File: Fragment.java License: GNU General Public License v2.0 | 2 votes |
/** * Registers a context menu to be shown for the given view (multiple views * can show the context menu). This method will set the * {@link OnCreateContextMenuListener} on the view to this fragment, so * {@link #onCreateContextMenu(ContextMenu, View, ContextMenuInfo)} will be * called when it is time to show the context menu. * * @see #unregisterForContextMenu(View) * @param view The view that should show a context menu. */ public void registerForContextMenu(View view) { view.setOnCreateContextMenuListener(this); }
Example 18
Source Project: droidel File: Fragment.java License: Apache License 2.0 | 2 votes |
/** * Prevents a context menu to be shown for the given view. This method will * remove the {@link OnCreateContextMenuListener} on the view. * * @see #registerForContextMenu(View) * @param view The view that should stop showing a context menu. */ public void unregisterForContextMenu(View view) { view.setOnCreateContextMenuListener(null); }
Example 19
Source Project: droidel File: Fragment.java License: Apache License 2.0 | 2 votes |
/** * Registers a context menu to be shown for the given view (multiple views * can show the context menu). This method will set the * {@link OnCreateContextMenuListener} on the view to this fragment, so * {@link #onCreateContextMenu(ContextMenu, View, ContextMenuInfo)} will be * called when it is time to show the context menu. * * @see #unregisterForContextMenu(View) * @param view The view that should show a context menu. */ public void registerForContextMenu(View view) { view.setOnCreateContextMenuListener(this); }
Example 20
Source Project: droidel File: Fragment.java License: Apache License 2.0 | 2 votes |
/** * Registers a context menu to be shown for the given view (multiple views * can show the context menu). This method will set the * {@link OnCreateContextMenuListener} on the view to this fragment, so * {@link #onCreateContextMenu(ContextMenu, View, ContextMenuInfo)} will be * called when it is time to show the context menu. * * @see #unregisterForContextMenu(View) * @param view The view that should show a context menu. */ public void registerForContextMenu(View view) { view.setOnCreateContextMenuListener(this); }