Java Code Examples for android.widget.ToggleButton#isChecked()
The following examples show how to use
android.widget.ToggleButton#isChecked() .
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: QuestionFragment.java From android-galaxyzoo with GNU General Public License v3.0 | 6 votes |
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); }
Example 2
Source File: IMPopupDialog.java From opensudoku with GNU General Public License v3.0 | 6 votes |
/** * 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); } } }
Example 3
Source File: ShowElementFragment.java From ToDay with MIT License | 5 votes |
private String returnUnitValue(ToggleButton units) { if (units.isChecked()) { return AppConstants.UNIT_HOURS; } else { return AppConstants.UNIT_MINUTES; } }
Example 4
Source File: TimeView.java From Viewer with Apache License 2.0 | 5 votes |
void setCheck(ToggleButton toggleBtn,int value){ if(!toggleBtn.isChecked()){ toggleBtn.setChecked(false); dayFlag_1 -=value; }else{ toggleBtn.setChecked(true); dayFlag_1+=value; } }
Example 5
Source File: MainActivity.java From meter with Apache License 2.0 | 5 votes |
/** * 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; }
Example 6
Source File: EditActivity.java From AndroidPirateBox with MIT License | 5 votes |
@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(); }
Example 7
Source File: PostToAccountLoaderTask.java From Onosendai with Apache License 2.0 | 5 votes |
@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); } }
Example 8
Source File: LogAnalysisActivity.java From geopaparazzi with GNU General Public License v3.0 | 5 votes |
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)); } }
Example 9
Source File: HOGPControlActivity.java From DeviceConnect-Android with MIT License | 4 votes |
/** * Capsロックを確認します. * @return Capsロック */ private byte caps() { ToggleButton toggle = findViewById(R.id.activity_control_key_caps); return toggle.isChecked() ? (byte) KeyboardCode.MODIFIER_KEY_SHIFT : 0; }
Example 10
Source File: AlarmListAdapter.java From buyingtime-android with MIT License | 4 votes |
private void toggleAlarm(int idx, View view) { ToggleButton tmpActiveToggle = (ToggleButton) view.findViewById(R.id.activeToggle); Alarms.getCurrent().get(idx).active = tmpActiveToggle.isChecked(); this.notifyDataSetChanged(); }