RowController(View row) { super(row); title=(TextView)row.findViewById(android.R.id.text1); thumbnail=(ImageView)row.findViewById(R.id.thumbnail); row.setOnClickListener(this); row.setOnLongClickListener(this); }
RowController(View row) { super(row); title=row.findViewById(android.R.id.text1); thumbnail=row.findViewById(R.id.thumbnail); row.setOnClickListener(this); row.setOnLongClickListener(this); }
RowController(View row) { super(row); title=(TextView)row.findViewById(android.R.id.text1); thumbnail=(ImageView)row.findViewById(R.id.thumbnail); row.setOnClickListener(this); row.setOnLongClickListener(this); }
RowController(View row, OnStartDragListener listener) { super(row); this.listener=listener; title=(TextView)row.findViewById(android.R.id.text1); thumbnail=(ImageView)row.findViewById(R.id.thumbnail); row.setOnClickListener(this); row.setOnLongClickListener(this); }
RowController(View row) { super(row); title=(TextView)row.findViewById(android.R.id.text1); thumbnail=(ImageView)row.findViewById(R.id.thumbnail); row.setOnClickListener(this); row.setOnLongClickListener(this); }
RowController(View row) { super(row); title=(TextView)row.findViewById(android.R.id.text1); thumbnail=(ImageView)row.findViewById(R.id.thumbnail); row.setOnClickListener(this); row.setOnLongClickListener(this); }
RowController(View row, ChoiceCapableAdapter<?> adapter) { super(row); this.adapter=adapter; title=(TextView)row.findViewById(android.R.id.text1); thumbnail=(ImageView)row.findViewById(R.id.thumbnail); row.setOnClickListener(this); row.setOnLongClickListener(this); row.setOnTouchListener(this); }
@BindingAdapter({"bind:onLongClick"}) public static void onLongClick(@NonNull final View view, @NonNull final OnClickListener onClickListener) { view.setOnLongClickListener(clickView -> { onClickListener.onClick(clickView); return true; }); }
static void setComponentLongClickListener(View v, ComponentLongClickListener listener) { if (v instanceof ComponentHost) { ((ComponentHost) v).setComponentLongClickListener(listener); } else { v.setOnLongClickListener(listener); v.setTag(R.id.component_long_click_listener, listener); } }
private void disableLongClick() { itemView.setLongClickable(false); itemView.setOnLongClickListener(null); } }
public ViewHolder setOnLongClickListener(int viewId, View.OnLongClickListener listener) { View view = getView(viewId); view.setOnLongClickListener(listener); return this; }
/** * Register a callback method for when the view is long clicked. * * @param listener The callback method. * @return self */ public T longClicked(OnLongClickListener listener){ if(view != null){ view.setOnLongClickListener(listener); } return self(); }
@Implementation protected void setOnLongClickListener(View.OnLongClickListener onLongClickListener) { this.onLongClickListener = onLongClickListener; directly().setOnLongClickListener(onLongClickListener); }
@Override public void initEvent() { findViewById(R.id.llAboutUpdate).setOnClickListener(this); findViewById(R.id.llAboutShare).setOnClickListener(this); findViewById(R.id.llAboutComment).setOnClickListener(this); findViewById(R.id.llAboutDeveloper, this).setOnLongClickListener(this); findViewById(R.id.llAboutWeibo, this).setOnLongClickListener(this); findViewById(R.id.llAboutContactUs, this).setOnLongClickListener(this); }
private void unsetSearchListeners() { if (DEBUG) Log.d(TAG, "unsetSearchListeners() called"); searchClear.setOnClickListener(null); searchClear.setOnLongClickListener(null); searchEditText.setOnClickListener(null); searchEditText.setOnFocusChangeListener(null); searchEditText.setOnEditorActionListener(null); if (textWatcher != null) searchEditText.removeTextChangedListener(textWatcher); textWatcher = null; }
@Override public void initEvent() { findView(R.id.llAboutMainTabActivity).setOnClickListener(this); findView(R.id.llAboutZBLibraryMainActivity).setOnClickListener(this); findView(R.id.llAboutUpdate).setOnClickListener(this); findView(R.id.llAboutShare).setOnClickListener(this); findView(R.id.llAboutComment).setOnClickListener(this); findView(R.id.llAboutDeveloper, this).setOnLongClickListener(this); findView(R.id.llAboutWeibo, this).setOnLongClickListener(this); findView(R.id.llAboutContactUs, this).setOnLongClickListener(this); }
@Override public void onBindViewHolder(final ClickableViewHolder holder, final int position) { holder.getParentView().setOnClickListener(v -> { if (itemClickListener != null) { itemClickListener.onItemClick(position, holder); } }); holder.getParentView().setOnLongClickListener(v -> itemLongClickListener != null && itemLongClickListener.onItemLongClick(position, holder)); }
private void enableLongClick(final StreamInfoItem item) { itemView.setLongClickable(true); itemView.setOnLongClickListener(view -> { if (itemBuilder.getOnStreamSelectedListener() != null) { itemBuilder.getOnStreamSelectedListener().held(item); } return true; }); }
@Test public void performLongClick_shouldClickOnView() throws Exception { OnLongClickListener clickListener = mock(OnLongClickListener.class); shadowOf(view).setMyParent(ReflectionHelpers.createNullProxy(ViewParent.class)); view.setOnLongClickListener(clickListener); view.performLongClick(); verify(clickListener).onLongClick(view); }
@Test public void shouldLongClickAndNotLongClick() throws Exception { assertThat(view.isLongClickable()).isFalse(); view.setLongClickable(true); assertThat(view.isLongClickable()).isTrue(); view.setLongClickable(false); assertThat(view.isLongClickable()).isFalse(); view.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { return false; } }); assertThat(view.isLongClickable()).isTrue(); }