Java Code Examples for android.widget.Button#isEnabled()

The following examples show how to use android.widget.Button#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: CardUnmaskPrompt.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Validates the values of the input fields to determine whether the submit button should be
 * enabled. Also displays a detailed error message and highlights the fields for which the value
 * is wrong. Finally checks whether the focuse should move to the next field.
 */
private void validate() {
    Button positiveButton = mDialog.getButton(AlertDialog.BUTTON_POSITIVE);

    @ErrorType int errorType = getExpirationAndCvcErrorType();
    positiveButton.setEnabled(errorType == ERROR_TYPE_NONE);
    showDetailedErrorMessage(errorType);
    moveFocus(errorType);

    if (sObserverForTest != null) {
        sObserverForTest.onCardUnmaskPromptValidationDone(this);

        if (positiveButton.isEnabled()) {
            sObserverForTest.onCardUnmaskPromptReadyToUnmask(this);
        }
    }
}
 
Example 2
Source File: CardUnmaskPrompt.java    From delion with Apache License 2.0 5 votes vote down vote up
private void validate() {
    Button positiveButton = mDialog.getButton(AlertDialog.BUTTON_POSITIVE);
    positiveButton.setEnabled(areInputsValid());
    if (positiveButton.isEnabled() && sObserverForTest != null) {
        sObserverForTest.onCardUnmaskPromptReadyToUnmask(this);
    }
}
 
Example 3
Source File: CardUnmaskPrompt.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void validate() {
    Button positiveButton = mDialog.getButton(AlertDialog.BUTTON_POSITIVE);
    positiveButton.setEnabled(areInputsValid());
    if (positiveButton.isEnabled() && sObserverForTest != null) {
        sObserverForTest.onCardUnmaskPromptReadyToUnmask(this);
    }
}
 
Example 4
Source File: ContinuousCaptureActivity.java    From pause-resume-video-recording with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the current state of the controls.
 */
private void updateControls() {
    String str = getString(R.string.secondsOfVideo, mSecondsOfVideo);
    TextView tv = (TextView) findViewById(R.id.capturedVideoDesc_text);
    tv.setText(str);

    boolean wantEnabled = (mCircEncoder != null) && !mFileSaveInProgress;
    Button button = (Button) findViewById(R.id.capture_button);
    if (button.isEnabled() != wantEnabled) {
        Log.d(TAG, "setting enabled = " + wantEnabled);
        button.setEnabled(wantEnabled);
    }
}
 
Example 5
Source File: CameraActivity.java    From Augendiagnose with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final boolean onKeyDown(final int keyCode, final KeyEvent event) {
	final Button captureButton = findViewById(R.id.buttonCameraTrigger);
	if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP)
			&& captureButton.isEnabled() && mCurrentFlashlightMode != FlashMode.EXT) {
		captureButton.setEnabled(false);
		mCameraHandler.takePicture();
		TrackingUtil.sendEvent(Category.EVENT_USER, CAMERA, "Capture");
		return true;
	}
	else {
		return super.onKeyDown(keyCode, event);
	}
}
 
Example 6
Source File: ContinuousCaptureActivity.java    From grafika with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the current state of the controls.
 */
private void updateControls() {
    String str = getString(R.string.secondsOfVideo, mSecondsOfVideo);
    TextView tv = (TextView) findViewById(R.id.capturedVideoDesc_text);
    tv.setText(str);

    boolean wantEnabled = (mCircEncoder != null) && !mFileSaveInProgress;
    Button button = (Button) findViewById(R.id.capture_button);
    if (button.isEnabled() != wantEnabled) {
        Log.d(TAG, "setting enabled = " + wantEnabled);
        button.setEnabled(wantEnabled);
    }
}