Java Code Examples for android.widget.Switch#OnCheckedChangeListener
The following examples show how to use
android.widget.Switch#OnCheckedChangeListener .
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: MainActivity.java From MockSMS with Apache License 2.0 | 6 votes |
private Switch.OnCheckedChangeListener listener(final int roll) { return (buttonView, isChecked) -> { if (roll == ROLL.READ.val) { Extra.getInstance(getBaseContext()).setRead(isChecked); } else if (roll == ROLL.SEEN.val) { Extra.getInstance(getBaseContext()).setSeen(isChecked); } else if (roll == ROLL.DELIVERED.val) { Extra.getInstance(getBaseContext()).setDelivered(isChecked); } else if (roll == ROLL.SLOT.val) { Extra.getInstance(getBaseContext()).setSLOT_ENABLED(isChecked); } else if (roll == ROLL.IMSI.val) { Extra.getInstance(getBaseContext()).setIMSI_ENABLED(isChecked); } else if (roll == ROLL.REPLY_PATH.val) { Extra.getInstance(getBaseContext()).setREPLY_PATH_PRESENT(isChecked); } else if (roll == ROLL.SERVICE_CENTER.val) { Extra.getInstance(getBaseContext()).setServiceCenterBool(isChecked); } else if (roll == ROLL.TIME_DIFFERENCE.val) { Extra.getInstance(getBaseContext()).setTimeDifferenceBool(isChecked); } else if (roll == ROLL.STATUS.val) { Extra.getInstance(getBaseContext()).setSmsStatusBool(isChecked); } }; }
Example 2
Source File: MainActivity.java From MockSMS with Apache License 2.0 | 6 votes |
private Switch.OnCheckedChangeListener listener(final int roll) { return new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (roll == ROLL.READ.ordinal()) { Extra.getInstance(getBaseContext()).setRead(isChecked); } else if (roll == ROLL.SEEN.ordinal()) { Extra.getInstance(getBaseContext()).setSeen(isChecked); } else if (roll == ROLL.DELIVERED.ordinal()) { Extra.getInstance(getBaseContext()).setDelivered(isChecked); } else if (roll == ROLL.SLOT.ordinal()) { Extra.getInstance(getBaseContext()).setSLOT_ENABLED(isChecked); } else if (roll == ROLL.IMSI.ordinal()) { Extra.getInstance(getBaseContext()).setIMSI_ENABLED(isChecked); } else if (roll == ROLL.REPLY_PATH.ordinal()) { Extra.getInstance(getBaseContext()).setREPLY_PATH_PRESENT(isChecked); } else if (roll == ROLL.SERVICE_CENTER.ordinal()) { Extra.getInstance(getBaseContext()).setServiceCenterBool(isChecked); } else if (roll == ROLL.TIME_DIFFERENCE.ordinal()) { Extra.getInstance(getBaseContext()).setTimeDifferenceBool(isChecked); } else if (roll == ROLL.STATUS.ordinal()) { Extra.getInstance(getBaseContext()).setSmsStatusBool(isChecked); } } }; }