public void setTabClickable(boolean clickable) { for (int i = 0; i < tabMenuView.getChildCount(); i = i + 2) { tabMenuView.getChildAt(i).setClickable(clickable); } }
void showPageMainFrameError() { View container = this.mErrorLayout; if (container != null) { container.setVisibility(View.VISIBLE); } else { createErrorLayout(); container = this.mErrorLayout; } View clickView = null; if (mClickId != -1 && (clickView = container.findViewById(mClickId)) != null) { clickView.setClickable(true); } else { container.setClickable(true); } }
/** * Adds view that covers everything below the Toolbar. * When it's clickable - user won't be able to click/touch anything below the Toolbar. * Need to block user input while loading and cropping an image. */ private void addBlockingView(View view) { if (mBlockingView == null) { mBlockingView = new View(getContext()); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mBlockingView.setLayoutParams(lp); mBlockingView.setClickable(true); } ((RelativeLayout) view.findViewById(R.id.ucrop_photobox)).addView(mBlockingView); }
/** * Set clickable for a view. * * @param clickable * @return self */ public T clickable(boolean clickable){ if(view != null){ view.setClickable(clickable); } return self(); }
/** * Adds view that covers everything below the Toolbar. * When it's clickable - user won't be able to click/touch anything below the Toolbar. * Need to block user input while loading and cropping an image. */ private void addBlockingView() { if (mBlockingView == null) { mBlockingView = new View(this); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.BELOW, R.id.toolbar); mBlockingView.setLayoutParams(lp); mBlockingView.setClickable(true); } ((RelativeLayout) findViewById(R.id.ucrop_photobox)).addView(mBlockingView); }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = View.inflate(context, R.layout.cell, null); view.setClickable(true); view.setFocusable(true); view.setBackgroundResource(android.R.drawable.menuitem_background); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new AlertDialog.Builder(context).setTitle("touched").show(); } }); return view; }
@Override public void onLoadComplete() { mUCropView.animate().alpha(1).setDuration(300).setInterpolator(new AccelerateInterpolator()); mBlockingView.setClickable(false); mShowLoader = false; supportInvalidateOptionsMenu(); }
@Override public void onLoadComplete() { mUCropView.animate().alpha(1).setDuration(300).setInterpolator(new AccelerateInterpolator()); mBlockingView.setClickable(false); callback.loadingProgress(false); }
@CallSuper @Override public void bind(@NonNull View view) { super.bind(view); view.setOnClickListener(onClickListener); view.setClickable(onClickListener != null); }
public void cropAndSaveImage() { mBlockingView.setClickable(true); callback.loadingProgress(true); mGestureCropImageView.cropAndSaveImage(mCompressFormat, mCompressQuality, new BitmapCropCallback() { @Override public void onBitmapCropped(@NonNull Uri resultUri, int offsetX, int offsetY, int imageWidth, int imageHeight) { callback.onCropFinish(getResult(resultUri, mGestureCropImageView.getTargetAspectRatio(), offsetX, offsetY, imageWidth, imageHeight)); callback.loadingProgress(false); } @Override public void onCropFailure(@NonNull Throwable t) { callback.onCropFinish(getError(t)); } }); }
protected void cropAndSaveImage() { mBlockingView.setClickable(true); mShowLoader = true; supportInvalidateOptionsMenu(); mGestureCropImageView.cropAndSaveImage(mCompressFormat, mCompressQuality, new BitmapCropCallback() { @Override public void onBitmapCropped(@NonNull Uri resultUri, int offsetX, int offsetY, int imageWidth, int imageHeight) { setResultUri(resultUri, mGestureCropImageView.getTargetAspectRatio(), offsetX, offsetY, imageWidth, imageHeight); finish(); } @Override public void onCropFailure(@NonNull Throwable t) { setResultError(t); finish(); } }); }
@Override public void onAttachedToWindow() { super.onAttachedToWindow(); mOnCreateView.setClickable(false); if (isLayoutObtain) { onLayoutObtain(); } }
@Override public void onClick(View v) { if (getWebView() != null) { clickView.setClickable(false); getWebView().reload(); } } });
public void setOnClickFabListener(OnClickFabListener listener) { mOnClickFabListener = listener; if (listener != null) { for (int i = 0, n = getChildCount(); i < n; i++) { getChildAt(i).setOnClickListener(this); } } else { for (int i = 0, n = getChildCount(); i < n; i++) { getChildAt(i).setClickable(false); } } }
@Override public void bindView(ViewHolder viewHolder, List payloads) { super.bindView(viewHolder, payloads); Context ctx = viewHolder.itemView.getContext(); //set the identifier from the drawerItem here. It can be used to run tests viewHolder.itemView.setId(hashCode()); //define how the divider should look like viewHolder.view.setClickable(false); viewHolder.view.setEnabled(false); viewHolder.view.setMinimumHeight(1); ViewCompat.setImportantForAccessibility(viewHolder.view, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO); //set the color for the divider viewHolder.divider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(ctx, R.attr.material_drawer_divider, R.color.material_drawer_divider)); //call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required) onPostBindView(this, viewHolder.itemView); }
@Override public void bindView(ViewHolder viewHolder, List payloads) { super.bindView(viewHolder, payloads); Context ctx = viewHolder.itemView.getContext(); //set the identifier from the drawerItem here. It can be used to run tests viewHolder.itemView.setId(hashCode()); //define how the divider should look like viewHolder.view.setClickable(false); viewHolder.view.setEnabled(false); viewHolder.view.setMinimumHeight(1); ViewCompat.setImportantForAccessibility(viewHolder.view, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO); //set the color for the divider viewHolder.divider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(ctx, com.mikepenz.materialdrawer.R.attr.material_drawer_divider, com.mikepenz.materialdrawer.R.color.material_drawer_divider)); //call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required) onPostBindView(this, viewHolder.itemView); }
/** * Installs the click listeners that will dispatch the click handler * defined in the component's props. Unconditionally set the clickable * flag on the view. */ private static void setClickHandler(EventHandler<ClickEvent> clickHandler, View view) { if (clickHandler == null) { return; } ComponentClickListener listener = getComponentClickListener(view); if (listener == null) { listener = new ComponentClickListener(); setComponentClickListener(view, listener); } listener.setEventHandler(clickHandler); view.setClickable(true); }
@Test public void shouldClickAndNotClick() throws Exception { assertThat(view.isClickable()).isFalse(); view.setClickable(true); assertThat(view.isClickable()).isTrue(); view.setClickable(false); assertThat(view.isClickable()).isFalse(); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ; } }); assertThat(view.isClickable()).isTrue(); }
public void configureCustom(View content) { markConfigured(true); // The focused state should be rendered by the content. setBackgroundDrawable(null); // Prevent the content from receiving events, but let it reflect the correct state. content.setFocusable(false); content.setFocusableInTouchMode(false); content.setClickable(false); content.setDuplicateParentStateEnabled(true); removeAllViews(); addView(content); }
@Test public void testUpdateDoesntChangeFlags() { LayoutOutput layoutOutput = new LayoutOutput(); layoutOutput.setNodeInfo(mNodeInfo); layoutOutput.setComponent(mComponent); final MountItem mountItem = new MountItem(); View view = new View(RuntimeEnvironment.application); mountItem.init(mComponent, mComponentHost, view, layoutOutput); assertThat(mountItem.isViewClickable()).isFalse(); view.setClickable(true); mountItem.update(layoutOutput); assertThat(mountItem.isViewClickable()).isFalse(); }