@Test public void testToggle() { SwitchItem item = new SwitchItem(); item.setTitle("TestTitle"); item.setSummary("TestSummary"); View view = createLayout(); item.setChecked(true); item.onBindView(view); assertTrue("Switch should be checked", mSwitch.isChecked()); item.toggle(view); assertFalse("Switch should be unchecked", mSwitch.isChecked()); }
public void toggle(View view) { mChecked = !mChecked; final SwitchCompat switchView = (SwitchCompat) view.findViewById(R.id.suw_items_switch); switchView.setChecked(mChecked); }
SwitchItem extends Item implements CompoundButton.OnCheckedChangeListener { public void toggle(View view) { mChecked = !mChecked; final SwitchCompat switchView = (SwitchCompat) view.findViewById(R.id.suw_items_switch); switchView.setChecked(mChecked); } }
SwitchItem extends Item implements CompoundButton.OnCheckedChangeListener { public void toggle(View view) { mChecked = !mChecked; final SwitchCompat switchView = (SwitchCompat) view.findViewById(R.id.suw_items_switch); switchView.setChecked(mChecked); } SwitchItem();  SwitchItem(Context context, AttributeSet attrs); }
SwitchItem extends Item implements CompoundButton.OnCheckedChangeListener { public void toggle(View view) { mChecked = !mChecked; final SwitchCompat switchView = (SwitchCompat) view.findViewById(R.id.suw_items_switch); switchView.setChecked(mChecked); } SwitchItem();  SwitchItem(Context context, AttributeSet attrs); void setChecked(boolean checked); boolean isChecked(); void toggle(View view); @Override void onBindView(View view); void setOnCheckedChangeListener(OnCheckedChangeListener listener); @Override void onCheckedChanged(CompoundButton buttonView, boolean isChecked); }
SwitchItem extends Item implements CompoundButton.OnCheckedChangeListener { public void toggle(View view) { mChecked = !mChecked; final SwitchCompat switchView = (SwitchCompat) view.findViewById(R.id.suw_items_switch); switchView.setChecked(mChecked); } SwitchItem();  SwitchItem(Context context, AttributeSet attrs); void setChecked(boolean checked); boolean isChecked(); void toggle(View view); @Override void onBindView(View view); void setOnCheckedChangeListener(OnCheckedChangeListener listener); @Override void onCheckedChanged(CompoundButton buttonView, boolean isChecked);  }