android.widget.Button.isEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(281)

本文整理了Java中android.widget.Button.isEnabled()方法的一些代码示例,展示了Button.isEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.isEnabled()方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:isEnabled

Button.isEnabled介绍

暂无

代码示例

代码示例来源:origin: k9mail/k-9

private void validateFields() {
  mDoneButton.setEnabled(Utility.requiredFieldValid(mName));
  Utility.setCompoundDrawablesAlpha(mDoneButton, mDoneButton.isEnabled() ? 255 : 128);
}

代码示例来源:origin: k9mail/k-9

private void validateFields() {
  boolean clientCertificateChecked = mClientCertificateCheckBox.isChecked();
  String clientCertificateAlias = mClientCertificateSpinner.getAlias();
  String email = mEmailView.getText().toString();
  boolean valid = Utility.requiredFieldValid(mEmailView)
      && ((!clientCertificateChecked && Utility.requiredFieldValid(mPasswordView))
          || (clientCertificateChecked && clientCertificateAlias != null))
      && mEmailValidator.isValidAddressOnly(email);
  mNextButton.setEnabled(valid);
  mManualSetupButton.setEnabled(valid);
  /*
   * Dim the next button's icon to 50% if the button is disabled.
   * TODO this can probably be done with a stateful drawable. Check into it.
   * android:state_enabled
   */
  Utility.setCompoundDrawablesAlpha(mNextButton, mNextButton.isEnabled() ? 255 : 128);
}

代码示例来源:origin: GitLqr/LQRWeChat

if (mBtnSendCode.isEnabled()) {
  mPresenter.sendCode();

代码示例来源:origin: k9mail/k-9

&& (!mRequireLoginView.isChecked()
            || hasValidPasswordSettings || hasValidExternalAuthSettings));
Utility.setCompoundDrawablesAlpha(mNextButton, mNextButton.isEnabled() ? 255 : 128);

代码示例来源:origin: k9mail/k-9

&& Utility.requiredFieldValid(mPortView)
    && (hasValidPasswordSettings || hasValidExternalAuthSettings));
Utility.setCompoundDrawablesAlpha(mNextButton, mNextButton.isEnabled() ? 255 : 128);

代码示例来源:origin: pili-engineering/PLDroidShortVideo

@Override
  public void onCompletion() {
    if (mPlayButton.isEnabled()) {
      mPlayButton.setEnabled(false);
    }
    if (mStopButton.isEnabled()) {
      mStopButton.setEnabled(false);
    }
    mExternalMediaRecorder.stop();
    if (mVideoTextureView != null) {
      mVideoTextureView.stopPlayback();
      mVideoTextureView = null;
    }
  }
});

代码示例来源:origin: mixi-inc/AndroidTraining

public void testScenario() throws Exception {
    Activity activity = getActivity();

    final EditText identityEditor = (EditText) activity.findViewById(R.id.identityEditor);
    Button verify = (Button) activity.findViewById(R.id.verifyButton);
    assertNotNull(identityEditor);
    assertNotNull(verify);
    assertFalse(verify.isEnabled());
    getInstrumentation().runOnMainSync(new Runnable() {
      @Override
      public void run() {
        identityEditor.setText("KeithYokoma");
      }
    });
    getInstrumentation().waitForIdleSync();

    assertTrue(verify.isEnabled());
    getInstrumentation().runOnMainSync(new Runnable() {
      @Override
      public void run() {
        identityEditor.setText("KeithYokomaHogeHoge12");
      }
    });
    getInstrumentation().waitForIdleSync();
    assertFalse(verify.isEnabled());
  }
}

代码示例来源:origin: KosyanMedia/Aviasales-Android-SDK

private void setDisabledButtons(int minValue, int maxValue) {
  morningButton.setEnabled(!(minValue > morningMaxTime || maxValue < morningMinTime));
  dayButton.setEnabled(!(minValue > dayMaxTime || maxValue < dayMinTime));
  eveningButton.setEnabled(!(minValue > eveningMaxTime || maxValue < eveningMinTime));
  if (!dayButton.isEnabled() && !eveningButton.isEnabled()) {
    morningButton.setEnabled(false);
  }
  if (!morningButton.isEnabled() && !eveningButton.isEnabled()) {
    dayButton.setEnabled(false);
  }
  if (!dayButton.isEnabled() && !morningButton.isEnabled()) {
    eveningButton.setEnabled(false);
  }
}

代码示例来源:origin: KosyanMedia/Aviasales-Android-SDK

private void setDisabledButtons(int minValue, int maxValue) {
  morningButton.setEnabled(!(minValue > morningMaxTime || maxValue < morningMinTime));
  dayButton.setEnabled(!(minValue > dayMaxTime || maxValue < dayMinTime));
  eveningButton.setEnabled(!(minValue > eveningMaxTime || maxValue < eveningMinTime));
  if (!dayButton.isEnabled() && !eveningButton.isEnabled()) {
    morningButton.setEnabled(false);
  }
  if (!morningButton.isEnabled() && !eveningButton.isEnabled()) {
    dayButton.setEnabled(false);
  }
  if (!dayButton.isEnabled() && !morningButton.isEnabled()) {
    eveningButton.setEnabled(false);
  }
}

代码示例来源:origin: FreedomZZQ/YouJoin-Android

@Override
public void onImageSelected(String path) {
  if (!resultList.contains(path)) {
    resultList.add(path);
  }
  // 有图片之后,改变按钮状态
  if (resultList.size() > 0) {
    mSubmitButton.setText("完成(" + resultList.size() + "/" + mDefaultCount + ")");
    if (!mSubmitButton.isEnabled()) {
      mSubmitButton.setEnabled(true);
    }
  }
}

代码示例来源:origin: CreateChance/AndroidFingerPrintDemo

@Override
protected void onDestroy() {
  super.onDestroy();
  if (!mStartBtn.isEnabled() && cancellationSignal != null) {
    cancellationSignal.cancel();
  }
}

代码示例来源:origin: huangweicai/OkLibDemo

@Override
public void onImageSelected(String path) {
  if (!resultList.contains(path)) {
    resultList.add(path);
  }
  // 有图片之后,改变按钮状态
  if (resultList.size() > 0) {
    updateDoneText();
    if (!mSubmitButton.isEnabled()) {
      mSubmitButton.setEnabled(true);
    }
  }
}

代码示例来源:origin: huijimuhe/Luban-Circle-Demo

@Override
public void onImageSelected(String path) {
  if(!resultList.contains(path)) {
    resultList.add(path);
  }
  // 有图片之后,改变按钮状态
  if(resultList.size() > 0){
    updateDoneText();
    if(!mSubmitButton.isEnabled()){
      mSubmitButton.setEnabled(true);
    }
  }
}

代码示例来源:origin: ytai/IOIOPlotter

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  if (seekBar == thresholdSeekBar_) {
    thresholdTextView_.setText(String.format("%.0f%%", getThreshold() * 100));
    if (scribbler_ != null) {
      if (doneButton_.isEnabled() && darkness_ > getThreshold()) {
        doneButton_.setEnabled(false);
      }
      scribbler_.setThreshold(getThreshold());
    }
  } else if (seekBar == blurSeekBar_) {
    blurTextView_.setText(String.format("%.1f", getBlur()));
    if (scribbler_ != null) {
      doneButton_.setEnabled(false);
      scribbler_.setBlur(getBlur());
    }
  }
}

代码示例来源:origin: derry/delion

private void notifyReadyToPay() {
  if (sObserverForTest != null && isAcceptingUserInput() && mPayButton.isEnabled()) {
    sObserverForTest.onPaymentRequestReadyToPay(this);
  }
}

代码示例来源:origin: derry/delion

private void validate() {
  Button positiveButton = mDialog.getButton(AlertDialog.BUTTON_POSITIVE);
  positiveButton.setEnabled(areInputsValid());
  if (positiveButton.isEnabled() && sObserverForTest != null) {
    sObserverForTest.onCardUnmaskPromptReadyToUnmask(this);
  }
}

代码示例来源:origin: mkulesh/microMathematics

protected void prepareButtonImage(Button b)
{
  for (Drawable d : b.getCompoundDrawables())
  {
    CompatUtils.setDrawableColorAttr(getContext(), d,
        b.isEnabled() ? R.attr.colorDialogContent : R.attr.colorDialogDisabledElement);
  }
}

代码示例来源:origin: ogarcia/opensudoku

case MODE_EDIT_VALUE:
  if (selNumber >= 0 && selNumber <= 9) {
    if (!mNumberButtons.get(selNumber).isEnabled()) {

代码示例来源:origin: brarcher/video-transcoder

@Test
public void initiallyNothingLoaded() throws Exception
{
  Activity activity = Robolectric.setupActivity(MainActivity.class);
  assertTrue(activity != null);
  Button selectVideo = activity.findViewById(R.id.selectVideo);
  assertNotNull(selectVideo);
  assertEquals(selectVideo.getVisibility(), View.VISIBLE);
  assertTrue(selectVideo.isEnabled());
  Button encode = activity.findViewById(R.id.encode);
  assertNotNull(encode);
  assertEquals(encode.getVisibility(), View.GONE);
  checkVisibility(activity, MainActivity.BASIC_SETTINGS_IDS, View.GONE);
  checkVisibility(activity, MainActivity.AUDIO_SETTINGS_IDS, View.GONE);
  checkVisibility(activity, MainActivity.VIDEO_SETTINGS_IDS, View.GONE);
}

相关文章

Button类方法