Java Code Examples for android.widget.ImageButton#isEnabled()
The following examples show how to use
android.widget.ImageButton#isEnabled() .
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 File: SearchScreenOverlay.java From talkback with Apache License 2.0 | 6 votes |
/** * Updates the button's state according to the specified scroll action currently available. * * @param button button to be updated. * @param scrollAction scrollAction that will be used to determine if the button should be * enabled. */ private void updateButtonState(@Nullable ImageButton button, int scrollAction) { if (button == null) { return; } AccessibilityNode node = getScrollableNode(scrollAction); if (node == null) { // No node available to perform the action. if (button.isEnabled()) { disableImageButton(button); } } else { // The action is currently available. if (!button.isEnabled()) { enableImageButton(button); } AccessibilityNode.recycle("SearchScreenOverlay.updateButtonState()", node); } }
Example 2
Source File: ButtonManager.java From Camera2 with Apache License 2.0 | 5 votes |
/** * Initialize a known button with a click listener and a drawable resource id, * and a content description resource id. * Sets the button visible. */ public void initializePushButton(int buttonId, View.OnClickListener cb, int imageId, int contentDescriptionId) { ImageButton button = getImageButtonOrError(buttonId); button.setOnClickListener(cb); if (imageId != NO_RESOURCE) { button.setImageResource(imageId); } if (contentDescriptionId != NO_RESOURCE) { button.setContentDescription(mAppController .getAndroidContext().getResources().getString(contentDescriptionId)); } if (!button.isEnabled()) { button.setEnabled(true); if (mListener != null) { mListener.onButtonEnabledChanged(this, buttonId); } } button.setTag(R.string.tag_enabled_id, buttonId); if (button.getVisibility() != View.VISIBLE) { button.setVisibility(View.VISIBLE); if (mListener != null) { mListener.onButtonVisibilityChanged(this, buttonId); } } }
Example 3
Source File: ButtonManager.java From Camera2 with Apache License 2.0 | 5 votes |
/** * Enables a button that has already been initialized. */ public void enableButton(int buttonId) { // If Camera Button is blocked, ignore the request. if (buttonId == BUTTON_CAMERA && mIsCameraButtonBlocked) { return; } ImageButton button; // Manual exposure uses a regular image button instead of a // MultiToggleImageButton, so it requires special handling. // TODO: Redesign ButtonManager's button getter methods into one method. if (buttonId == BUTTON_EXPOSURE_COMPENSATION) { button = getImageButtonOrError(buttonId); } else { button = getButtonOrError(buttonId); } if (!button.isEnabled()) { button.setEnabled(true); if (mListener != null) { mListener.onButtonEnabledChanged(this, buttonId); } } button.setTag(R.string.tag_enabled_id, buttonId); }
Example 4
Source File: DialogLineSettings.java From microMathematics with GNU General Public License v3.0 | 4 votes |
public DialogLineSettings(Activity context, LinePropertiesChangeIf changeIf, LineProperties parameters) { super(context, R.layout.dialog_line_settings, R.string.dialog_line_settings_title); this.parameters = parameters; widthPicker = findViewById(R.id.dialog_number_picker); widthPicker.setValue(parameters.width); widthPicker.minValue = 1; colorPicker = PrepareColorPicker(parameters.color); radioButtons = new RadioButton[4]; radioButtons[0] = findViewById(R.id.dialog_button_line_style_solid); radioButtons[1] = findViewById(R.id.dialog_button_line_style_dotted); radioButtons[2] = findViewById(R.id.dialog_button_line_style_dashed); radioButtons[3] = findViewById(R.id.dialog_button_line_style_dash_dot); radioLines = new CustomTextView[radioButtons.length]; radioLines[0] = findViewById(R.id.dialog_marker_line_style_solid); radioLines[1] = findViewById(R.id.dialog_marker_line_style_dotted); radioLines[2] = findViewById(R.id.dialog_marker_line_style_dashed); radioLines[3] = findViewById(R.id.dialog_marker_line_style_dash_dot); LineProperties l = new LineProperties(); l.color = CompatUtils.getThemeColorAttr(getContext(), R.attr.colorDialogContent); l.width = ViewUtils.dpToPx(getContext().getResources().getDisplayMetrics(), 2); for (int i = 0; i < radioButtons.length; i++) { l.lineStyle = LineProperties.LineStyle.values()[i]; l.preparePaint(); radioLines[i].setExternalPaint(l.getPaint()); radioLines[i].setOnClickListener(this); radioButtons[i].setChecked(l.lineStyle == parameters.lineStyle); radioButtons[i].setOnClickListener(this); } pointShapesBox = findViewById(R.id.dialog_plot_point_shapes); pointShapesBox.setOnClickListener(this); pointShapesBox.setChecked(parameters.shapeType != LineProperties.ShapeType.NONE); shapeSizePicker = findViewById(R.id.dialog_plot_point_shape_size); shapeSizePicker.setValue(parameters.shapeSize); shapeSizePicker.minValue = 100; shapeSizePicker.setEnabled(pointShapesBox.isChecked()); shapeTypeButtons .put(LineProperties.ShapeType.SQUARE, (ImageButton) findViewById(R.id.dialog_plot_point_square)); shapeTypeButtons .put(LineProperties.ShapeType.CIRCLE, (ImageButton) findViewById(R.id.dialog_plot_point_circle)); shapeTypeButtons.put(LineProperties.ShapeType.DIAMOND, (ImageButton) findViewById(R.id.dialog_plot_point_diamond)); shapeTypeButtons.put(LineProperties.ShapeType.CROSS, (ImageButton) findViewById(R.id.dialog_plot_point_cross)); for (Map.Entry<LineProperties.ShapeType, ImageButton> e : shapeTypeButtons.entrySet()) { ImageButton b = e.getValue(); b.setOnClickListener(this); b.setOnLongClickListener(this); setButtonEnabled(b, pointShapesBox.isChecked()); if (b.isEnabled()) { setButtonSelected(b, e.getKey() == parameters.shapeType); } } this.changeIf = changeIf; }