List of usage examples for android.widget CompoundButton isChecked
@ViewDebug.ExportedProperty @Override public boolean isChecked()
From source file:org.deviceconnect.android.manager.setting.ReqResDebugActivity.java
/** * UI??./*from www.j av a 2 s . c o m*/ */ private void initUI() { // ? mListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1); // ListView listView = (ListView) findViewById(R.id.reqResList); listView.setAdapter(mListAdapter); initSpinner(); // ? mTextPath = (EditText) findViewById(R.id.reqPath); // URL? mSelectUrl = (CheckBox) findViewById(R.id.isUrl); mSelectUrl.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { enableSetting(buttonView.isChecked()); } }); mWebsocketBtn = (ToggleButton) findViewById(R.id.reqWesocket); mWebsocketBtn.setOnClickListener(this); }
From source file:com.pranavpandey.smallapp.dialog.ActionDialog.java
/** * Creates a {@link ActionDialog} with the arguments supplied to the * constructor by using the supplied adapter. * * @param rootView Root view to which the dialog should attach. *///from w ww. j a v a 2 s . c o m public void createDialog(@NonNull View rootView) { if (mType == Type.GRID) { mView = mInflater.inflate(R.layout.sas_dialog_action_grid, new LinearLayout(mContext), false); mActionGridView = (HeaderGridView) mView.findViewById(R.id.action_grid); if (mExtraInfo) { ((ColoredTextView) mView.findViewById(R.id.extra_info_desc)).setText(mExtraInfoText); ((ColoredImageView) mView.findViewById(R.id.extra_info_icon)).setImageDrawable(mExtraInfoIcon); mActionGridView.setExpanded(true); if (mExtraInfoListener != null) { mView.findViewById(R.id.extra_info_layout).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mExtraInfoListener.onExtraInfoClick(v); autoDismiss(); } }); } mView.findViewById(R.id.extra_info_layout).setVisibility(View.VISIBLE); final ScrollView scrollView = (ScrollView) mView.findViewById(R.id.action_grid_scroll); scrollView.post(new Runnable() { @Override public void run() { scrollView.smoothScrollTo(0, 0); } }); } mActionGridView.setAdapter(mAdapter); mActionGridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (mActionItemListener != null) { mActionItemListener.onActionItemClick(mDialog, mAdapter, parent, view, position, id); } autoDismiss(); } }); } else { mView = mInflater.inflate(R.layout.sas_dialog_action_list, new LinearLayout(mContext), false); mActionListView = (ListView) mView.findViewById(R.id.action_list); if (mExtraInfo) { View mHeader = mInflater.inflate(R.layout.sas_dialog_extra_info_list, mActionListView, false); ((ColoredTextView) mHeader.findViewById(R.id.extra_info_desc)).setText(mExtraInfoText); ((ColoredImageView) mHeader.findViewById(R.id.extra_info_icon)).setImageDrawable(mExtraInfoIcon); mActionListView.addHeaderView(mHeader, null, mExtraInfoListener != null ? true : false); } mActionListView.setAdapter(mAdapter); mActionListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (mExtraInfo) { position--; if (position < 0) { if (mExtraInfoListener != null) { mExtraInfoListener.onExtraInfoClick(view); autoDismiss(); } return; } } if (mActionItemListener != null) { mActionItemListener.onActionItemClick(mDialog, mAdapter, parent, view, position, id); } autoDismiss(); } }); } if (mCheckButtonLayout) { final TextView chkText = (TextView) mView.findViewById(R.id.check_text); final View chkLayout = (View) mView.findViewById(R.id.check_layout); final CompoundButton chkButton = (CompoundButton) mView.findViewById(R.id.check_button); chkText.setText(mCheckButtonText); chkLayout.setVisibility(View.VISIBLE); chkLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mCheckButtonState = !chkButton.isChecked(); chkButton.setChecked(mCheckButtonState); if (mCheckButtonListener != null) { mCheckButtonListener.onCheckButtonChanged(chkLayout, chkButton, chkButton.isChecked(), chkText); } } }); chkButton.setChecked(mCheckButtonState); } mDialog = SmallUtils.createDialog(mDialogBuilder.create(), rootView.getWindowToken(), mView); }
From source file:be.billington.calendar.recurrencepicker.RecurrencePickerDialog.java
private void updateDoneButtonState() { if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) { mDone.setEnabled(true);/*from w w w .j a va2 s . c om*/ return; } if (mInterval.getText().toString().length() == 0) { mDone.setEnabled(false); return; } if (mEndCount.getVisibility() == View.VISIBLE && mEndCount.getText().toString().length() == 0) { mDone.setEnabled(false); return; } if (mModel.freq == RecurrenceModel.FREQ_WEEKLY) { for (CompoundButton b : mWeekByDayButtons) { if (b.isChecked()) { mDone.setEnabled(true); return; } } mDone.setEnabled(false); return; } mDone.setEnabled(true); }
From source file:com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment.java
private void updateDoneButtonState() { if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) { mDoneButton.setEnabled(true);// ww w .j a v a2 s . co m return; } if (mInterval.getText().toString().length() == 0) { mDoneButton.setEnabled(false); return; } if (mEndCount.getVisibility() == View.VISIBLE && mEndCount.getText().toString().length() == 0) { mDoneButton.setEnabled(false); return; } if (mModel.freq == RecurrenceModel.FREQ_WEEKLY) { for (CompoundButton b : mWeekByDayButtons) { if (b.isChecked()) { mDoneButton.setEnabled(true); return; } } mDoneButton.setEnabled(false); return; } mDoneButton.setEnabled(true); }
From source file:com.code44.finance.ui.dialogs.recurrencepicker.RecurrencePickerDialogFragment.java
private void updateDoneButtonState() { if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) { mDoneButton.setEnabled(true);//from w w w . java 2 s .c o m return; } if (mInterval.getText().toString().length() == 0) { mDoneButton.setEnabled(false); return; } if (mModel.freq == RecurrenceModel.FREQ_ONCE) { mDoneButton.setEnabled(true); return; } if (mEndCount.getVisibility() == View.VISIBLE && mEndCount.getText().toString().length() == 0) { mDoneButton.setEnabled(false); return; } if (mModel.freq == RecurrenceModel.FREQ_WEEKLY) { for (CompoundButton b : mWeekByDayButtons) { if (b.isChecked()) { mDoneButton.setEnabled(true); return; } } mDoneButton.setEnabled(false); return; } mDoneButton.setEnabled(true); }
From source file:com.intuit.qboecoui.email.SalesFormEmail.java
/** * This method fetches the data from the form and populates the * V3SalesFormEmailJson object./* www. j av a 2 s. c o m*/ * * @param salesFormEmailJson * Return parameter that will be loaded with form data. */ private void retrieveSalesFormEmailData(V3SalesFormEmailJson salesFormEmailJson) { final EditText emailReceiver = (EditText) findViewById(R.id.email_receiver); if (null != emailReceiver) { salesFormEmailJson.DeliveryAddress.Address = emailReceiver.getText().toString(); } final EditText emailSubject = (EditText) findViewById(R.id.email_subject); if (null != emailSubject) { salesFormEmailJson.EmailMessage.Subject = emailSubject.getText().toString(); } final EditText emailBody = (EditText) findViewById(R.id.email_body); if (null != emailBody) { salesFormEmailJson.EmailMessage.Message = emailBody.getText().toString(); } // The online payment preferences picked up from the form to be sent in // the JSON request. final CompoundButton switchBankTransfer = (CompoundButton) findViewById(R.id.switch_bank_transfer); final CompoundButton switchCreditCard = (CompoundButton) findViewById(R.id.switch_credit_card); salesFormEmailJson.AllowOnlineACHPayment = Boolean.toString(switchBankTransfer.isChecked()); salesFormEmailJson.AllowOnlineCreditCardPayment = Boolean.toString(switchCreditCard.isChecked()); }
From source file:com.appeaser.sublimepickerlibrary.recurrencepicker.RecurrenceOptionCreator.java
private void updateDoneButtonState() { if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) { mButtonLayout.updateValidity(true); return;//from www .j av a 2s . c o m } if (mInterval.getText().toString().length() == 0) { mButtonLayout.updateValidity(false); return; } if (mEndCount.getVisibility() == View.VISIBLE && mEndCount.getText().toString().length() == 0) { mButtonLayout.updateValidity(false); return; } if (mModel.freq == RecurrenceModel.FREQ_WEEKLY) { for (CompoundButton b : mWeekByDayButtons) { if (b.isChecked()) { mButtonLayout.updateValidity(true); return; } } mButtonLayout.updateValidity(false); return; } mButtonLayout.updateValidity(true); }
From source file:com.juick.android.MainActivity.java
@TargetApi(VERSION_CODES.ICE_CREAM_SANDWICH) private void selectSourcesForCombined(final String prefix, final String[] codes) { final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); ScrollView v = new ScrollView(this); v.setLayoutParams(new ScrollView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); final LinearLayout ll = new LinearLayout(this); ll.setLayoutParams(new ScrollView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); ll.setOrientation(LinearLayout.VERTICAL); v.addView(ll);// w ww . j a va2 s . com for (int i = 0; i < codes.length; i++) { final CompoundButton sw = VERSION.SDK_INT >= 14 ? new Switch(this) : new CheckBox(this); sw.setPadding(10, 10, 10, 10); sw.setLayoutParams(new ScrollView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); sw.setText(codes[i]); sw.setChecked(sp.getBoolean(prefix + codes[i], true)); ll.addView(sw); } new AlertDialog.Builder(MainActivity.this).setView(v).setCancelable(true) .setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { SharedPreferences.Editor e = sp.edit(); for (int i = 0; i < ll.getChildCount(); i++) { CompoundButton cb = (CompoundButton) ll.getChildAt(i); assert cb != null; e.putBoolean(prefix + codes[i], cb.isChecked()); } e.commit(); } }).create().show(); }
From source file:com.benefit.buy.library.http.query.AbstractAQuery.java
/** * Get checked state of a compound button. * @return checked/*from w w w. j a v a 2s . c o m*/ */ public boolean isChecked() { boolean checked = false; if (view instanceof CompoundButton) { CompoundButton cb = (CompoundButton) view; checked = cb.isChecked(); } return checked; }
From source file:com.androidquery.AbstractAQuery.java
/** * Get checked state of a compound button. * * @return checked/*from w w w. j av a 2 s . c o m*/ */ public boolean isChecked() { boolean checked = false; if (view instanceof CompoundButton) { CompoundButton cb = (CompoundButton) view; checked = cb.isChecked(); } return checked; }