List of usage examples for android.view View setEnabled
@RemotableViewMethod public void setEnabled(boolean enabled)
From source file:Main.java
public static void setEnable(View... views) { if (views != null && views.length > 0) { for (View view : views) { if (view != null && !view.isEnabled()) { view.setEnabled(true); }// ww w. j a v a2s . c o m } } }
From source file:Main.java
public static void enableDisableViewGroup(ViewGroup viewGroup, boolean enabled) { int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { View view = viewGroup.getChildAt(i); if (view.isFocusable()) view.setEnabled(enabled); if (view instanceof ViewGroup) { enableDisableViewGroup((ViewGroup) view, enabled); } else if (view instanceof ListView) { if (view.isFocusable()) view.setEnabled(enabled); ListView listView = (ListView) view; int listChildCount = listView.getChildCount(); for (int j = 0; j < listChildCount; j++) { if (view.isFocusable()) listView.getChildAt(j).setEnabled(false); }/* ww w . ja v a2 s . c om*/ } } }
From source file:Main.java
/** * Set the enabled state of this view. The interpretation of the enabled * state varies by subclass.//w w w .j a va 2s .com * * @param enabled True if this view is enabled, false otherwise. */ public static void setViewEnabled(View view, boolean enabled) { if (view == null) { return; } if (view.isEnabled() != enabled) { view.setEnabled(enabled); } }
From source file:Main.java
private static void setDelayedClickable(final View v, final boolean clickable, int delayMillis) { new Handler().postDelayed(() -> { v.setClickable(clickable);/*w w w .ja v a 2 s. c o m*/ v.setEnabled(true); }, delayMillis); // }
From source file:com.orange.ocara.ui.activity.IllustrationsActivity.java
private static void updateButton(View view, boolean enabled) { view.setEnabled(enabled); view.setClickable(enabled);//from w w w . j a v a2 s .co m }
From source file:Main.java
/** * Fade in a view with the default time// w w w. ja va 2s . c o m * @param view The {@link View} to use */ public static void fadeIn(View view) { fadeIn(view, 0F, 1F, 400); // We disabled the button in fadeOut(), so enable it here. view.setEnabled(true); }
From source file:android.support.v7.testutils.TestUtilsActions.java
public static ViewAction setEnabled(final boolean enabled) { return new ViewAction() { @Override//from w w w . j av a2 s . c om public Matcher<View> getConstraints() { return isDisplayed(); } @Override public String getDescription() { return "set enabled"; } @Override public void perform(UiController uiController, View view) { uiController.loopMainThreadUntilIdle(); view.setEnabled(enabled); uiController.loopMainThreadUntilIdle(); } }; }
From source file:Main.java
/** * Fade in a view with the default time//w ww.j a v a 2 s .co m * @param view The {@link View} to use */ public static void fadeOut(View view) { if (view.getVisibility() != View.VISIBLE) return; // Since the button is still clickable before fade-out animation // ends, we disable the button first to block click. view.setEnabled(false); Animation animation = new AlphaAnimation(1F, 0F); animation.setDuration(400); view.startAnimation(animation); view.setVisibility(View.GONE); }
From source file:android.support.v7.testutils.AppCompatTintableViewActions.java
/** * Sets enabled state on a <code>View</code> that implements the * <code>TintableBackgroundView</code> interface. *///w ww . ja v a 2s . c o m public static ViewAction setEnabled(final boolean enabled) { return new ViewAction() { @Override public Matcher<View> getConstraints() { return allOf(isDisplayingAtLeast(90), TestUtilsMatchers.isTintableBackgroundView()); } @Override public String getDescription() { return "set enabled"; } @Override public void perform(UiController uiController, View view) { uiController.loopMainThreadUntilIdle(); view.setEnabled(enabled); uiController.loopMainThreadUntilIdle(); } }; }
From source file:com.github.michalbednarski.intentslab.editor.ComponentPickerDialogFragment.java
private static void setTextViewsEnabled(View v, boolean enabled) { if (v instanceof TextView) { v.setEnabled(enabled); }//from w ww. ja v a 2 s.c om if (v instanceof ViewGroup) { final ViewGroup vg = (ViewGroup) v; for (int i = vg.getChildCount() - 1; i >= 0; i--) { setTextViewsEnabled(vg.getChildAt(i), enabled); } } }