android.widget.ToggleButton#isChecked ( )源码实例Demo

下面列出了android.widget.ToggleButton#isChecked ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android-galaxyzoo   文件: QuestionFragment.java
private void storeAnswer(final String questionId, final String answerId) {
    List<String> checkboxes = null;

    //Get the selected checkboxes too:
    final DecisionTree tree = getDecisionTree();
    final DecisionTree.Question question = tree.getQuestion(questionId);
    if ((question != null) && question.hasCheckboxes()) {
        checkboxes = new ArrayList<>();
        for (final DecisionTree.Checkbox checkbox : question.getCheckboxes()) {
            final String checkboxId = checkbox.getId();
            final ToggleButton button = mCheckboxButtons.get(checkboxId);
            if ((button != null) && button.isChecked()) {
                checkboxes.add(checkboxId);
            }
        }
    }

    //Remember the answer:
    mClassificationInProgress.add(questionId, answerId, checkboxes);
}
 
源代码2 项目: opensudoku   文件: IMPopupDialog.java
/**
 * Updates selected numbers in note.
 *
 * @param numbers
 */
public void updateNote(Collection<Integer> numbers) {
    mNoteSelectedNumbers = new HashSet<>();

    if (numbers != null) {
        mNoteSelectedNumbers.addAll(numbers);
    }

    ToggleButton toggleButton;
    for (Integer number : mNoteNumberButtons.keySet()) {
        toggleButton = mNoteNumberButtons.get(number);
        toggleButton.setChecked(mNoteSelectedNumbers.contains(number));
        if (toggleButton.isChecked()) {
            ThemeUtils.applyIMButtonStateToView(toggleButton, ThemeUtils.IMButtonStyle.ACCENT);
        }
    }
}
 
源代码3 项目: ToDay   文件: ShowElementFragment.java
private String returnUnitValue(ToggleButton units) {
    if (units.isChecked()) {
        return AppConstants.UNIT_HOURS;

    } else {
        return AppConstants.UNIT_MINUTES;
    }
}
 
源代码4 项目: Viewer   文件: TimeView.java
void setCheck(ToggleButton toggleBtn,int value){
    if(!toggleBtn.isChecked()){
        toggleBtn.setChecked(false);
        dayFlag_1 -=value;
    }else{
        toggleBtn.setChecked(true);
        dayFlag_1+=value;
    }
}
 
源代码5 项目: meter   文件: MainActivity.java
/**
 * are any of the ToggleButtons currently checked?
 */
protected boolean anyChecked() {
    ToggleButton[] btns = {mWifiEnabled, mBatteryEnabled, mNotificationsEnabled};

    for (ToggleButton btn : btns) {
        if (btn.isChecked()) {
            return true;
        }
    }
    return false;
}
 
源代码6 项目: AndroidPirateBox   文件: EditActivity.java
@Override
 public void finish()
 {
     if (!isCanceled())
     {
     	ToggleButton toggleButton = (ToggleButton) findViewById(R.id.LocaleToggleButton);
final String message = (String) (toggleButton.isChecked() ? getText(R.string.locale_on) : getText(R.string.locale_off));

         if (message.length() > 0)
         {
             final Intent resultIntent = new Intent();

             /*
              * This extra is the data to ourselves: either for the Activity or the BroadcastReceiver. Note
              * that anything placed in this Bundle must be available to Locale's class loader. So storing
              * String, int, and other standard objects will work just fine. Parcelable objects are not
              * acceptable, unless they also implement Serializable. Serializable objects must be standard
              * Android platform objects (A Serializable class private to this plug-in's APK cannot be
              * stored in the Bundle, as Locale's classloader will not recognize it).
              */
             final Bundle resultBundle =
                     PluginBundleManager.generateBundle(getApplicationContext(), message);
             
             resultBundle.putBoolean(Constants.INTENT_EXTRA_STATE, toggleButton.isChecked());
             
             resultIntent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE, resultBundle);

             /*
              * The blurb is concise status text to be displayed in the host's UI.
              */
             final String blurb = generateBlurb(getApplicationContext(), message);
             resultIntent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_STRING_BLURB, blurb);

             setResult(RESULT_OK, resultIntent);
         }
     }

     super.finish();
 }
 
源代码7 项目: Onosendai   文件: PostToAccountLoaderTask.java
@Override
public void onClick (final View v) {
	if (!(v instanceof ToggleButton)) return;
	final ToggleButton btn = (ToggleButton) v;
	if (btn.isChecked()) {
		this.enabledSubAccounts.enable(this.svc);
	}
	else {
		this.enabledSubAccounts.disable(this.svc);
	}
}
 
源代码8 项目: geopaparazzi   文件: LogAnalysisActivity.java
private void setButtonColor(ToggleButton toggleButton) {
    if (toggleButton.isChecked()) {
        toggleButton.setBackground(Compat.getDrawable(this, R.drawable.button_background_drawable_selected));
    } else {
        toggleButton.setBackground(Compat.getDrawable(this, R.drawable.button_background_drawable));
    }
}
 
/**
 * Capsロックを確認します.
 * @return Capsロック
 */
private byte caps() {
    ToggleButton toggle = findViewById(R.id.activity_control_key_caps);
    return toggle.isChecked() ? (byte) KeyboardCode.MODIFIER_KEY_SHIFT : 0;
}
 
源代码10 项目: buyingtime-android   文件: AlarmListAdapter.java
private void toggleAlarm(int idx, View view)
{
    ToggleButton tmpActiveToggle = (ToggleButton) view.findViewById(R.id.activeToggle);
    Alarms.getCurrent().get(idx).active = tmpActiveToggle.isChecked();
    this.notifyDataSetChanged();
}