下面列出了android.widget.Button#isEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* 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);
}
}
}
private void validate() {
Button positiveButton = mDialog.getButton(AlertDialog.BUTTON_POSITIVE);
positiveButton.setEnabled(areInputsValid());
if (positiveButton.isEnabled() && sObserverForTest != null) {
sObserverForTest.onCardUnmaskPromptReadyToUnmask(this);
}
}
private void validate() {
Button positiveButton = mDialog.getButton(AlertDialog.BUTTON_POSITIVE);
positiveButton.setEnabled(areInputsValid());
if (positiveButton.isEnabled() && sObserverForTest != null) {
sObserverForTest.onCardUnmaskPromptReadyToUnmask(this);
}
}
/**
* 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);
}
}
@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);
}
}
/**
* 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);
}
}