本文整理汇总了Java中org.jraf.android.backport.switchwidget.Switch.setChecked方法的典型用法代码示例。如果您正苦于以下问题:Java Switch.setChecked方法的具体用法?Java Switch.setChecked怎么用?Java Switch.setChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jraf.android.backport.switchwidget.Switch
的用法示例。
在下文中一共展示了Switch.setChecked方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateOptionsMenu
import org.jraf.android.backport.switchwidget.Switch; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
mMasterSwitch =
(Switch) MenuItemCompat.getActionView(menu.findItem(R.id.action_master_switch));
mMasterSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
if (mActionBar.getSelectedNavigationIndex() == 0) {
PolicyFragment fragment = (PolicyFragment) mPagerAdapter.getCurrentItem();
mSupervisor.changePolicy(fragment.getSelectedPolicy());
}
mSupervisor.activateOppNet();
} else {
mSupervisor.deactivateOppNet();
}
}
});
if (mSupervisor != null) {
mMasterSwitch.setChecked(mSupervisor.isActivated());
}
return true;
}
示例2: onResume
import org.jraf.android.backport.switchwidget.Switch; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (CallerFlashlight.LOG) Log.d(TAG, "onResumed");
callFlashButton = (Switch) findViewById(R.id.callFlashToggle);
callFlashButton.setChecked(callerFlashlight.isCallFlash());
callFlashTestButton = (ToggleButton) findViewById(R.id.callFlashTestToggle);
callFlashTestButton.setChecked(callerFlashlight.isCallFlashTest());
msgFlashButton = (Switch) findViewById(R.id.msgFlashToggle);
msgFlashButton.setChecked(callerFlashlight.isMsgFlash());
msgFlashTestButton = (ToggleButton) findViewById(R.id.msgFlashTestToggle);
msgFlashTestButton.setChecked(callerFlashlight.isMsgFlashTest());
}
示例3: callFlashCreate
import org.jraf.android.backport.switchwidget.Switch; //导入方法依赖的package包/类
private void callFlashCreate() {
callFlashButton = (Switch) findViewById(R.id.callFlashToggle);
callFlashButton.setChecked(callerFlashlight.isCallFlash());
// callFlashButton.setOnClickListener(this);
callFlashButton.setOnCheckedChangeListener(this);
callFlashButton.setTextOn(getResources().getString(R.string.ON));
callFlashButton.setTextOff(getResources().getString(R.string.OFF));
callFlashButton.setText(getResources().getString(R.string.Callseperator));
callFlashTestButton = (ToggleButton) findViewById(R.id.callFlashTestToggle);
callFlashTestButton.setChecked(callerFlashlight.isCallFlashTest());
callFlashTestButton.setOnClickListener(this);
callFlashOnBar = (SeekBar) findViewById(R.id.flashOnDurationBar);
callFlashOnBar.setProgress(callerFlashlight.getCallFlashOnDuration());
callFlashOnBar.setMax(1000);
callFlashOffBar = (SeekBar) findViewById(R.id.flashOffDurationBar);
callFlashOffBar.setProgress(callerFlashlight.getCallFlashOffDuration());
callFlashOffBar.setMax(1000);
callFlashOnBarValue = (EditText) findViewById(R.id.flashOnDurationValue);
callFlashOnBarValue.setText(String.valueOf(callFlashOnBar.getProgress()));
callFlashOnBarValue.addTextChangedListener(this);
callFlashOnBarValue.setOnFocusChangeListener(this);
callFlashOffBarValue = (EditText) findViewById(R.id.flashOffDurationValue);
callFlashOffBarValue.setText(String.valueOf(callFlashOffBar.getProgress()));
callFlashOffBarValue.addTextChangedListener(this);
callFlashOffBarValue.setOnFocusChangeListener(this);
callFlashOnBar.setOnSeekBarChangeListener(seekBarChange);
callFlashOffBar.setOnSeekBarChangeListener(seekBarChange);
}
示例4: msgFlashCreate
import org.jraf.android.backport.switchwidget.Switch; //导入方法依赖的package包/类
private void msgFlashCreate() {
msgFlashButton = (Switch) findViewById(R.id.msgFlashToggle);
msgFlashButton.setChecked(callerFlashlight.isMsgFlash());
// msgFlashButton.setOnClickListener(this);
msgFlashButton.setOnCheckedChangeListener(this);
msgFlashButton.setTextOn(getResources().getString(R.string.ON));
msgFlashButton.setTextOff(getResources().getString(R.string.OFF));
msgFlashButton.setText(getResources().getString(R.string.Msgseperator));
msgFlashTestButton = (ToggleButton) findViewById(R.id.msgFlashTestToggle);
msgFlashTestButton.setChecked(callerFlashlight.isMsgFlashTest());
msgFlashTestButton.setOnClickListener(this);
msgFlashOnBar = (SeekBar) findViewById(R.id.flashOnDurationBarMsg);
msgFlashOnBar.setProgress(callerFlashlight.getMsgFlashOnDuration());
msgFlashOnBar.setMax(1000);
msgFlashOffBar = (SeekBar) findViewById(R.id.flashOffDurationBarMsg);
msgFlashOffBar.setProgress(callerFlashlight.getMsgFlashOffDuration());
msgFlashOffBar.setMax(1000);
// msgFlashDurBar = (SeekBar) findViewById(R.id.flashDurationBarMsg);
// msgFlashDurBar.setProgress(callerFlashlight.getMsgFlashDuration());
// msgFlashDurBar.setMax(10);
msgFlashOnBarValue = (EditText) findViewById(R.id.flashOnDurationValueMsg);
msgFlashOnBarValue.setText(String.valueOf(msgFlashOnBar.getProgress()));
msgFlashOnBarValue.addTextChangedListener(this);
msgFlashOnBarValue.setOnFocusChangeListener(this);
msgFlashOffBarValue = (EditText) findViewById(R.id.flashOffDurationValueMsg);
msgFlashOffBarValue.setText(String.valueOf(msgFlashOffBar.getProgress()));
msgFlashOffBarValue.addTextChangedListener(this);
msgFlashOffBarValue.setOnFocusChangeListener(this);
// msgFlashDurBarValue = (EditText) findViewById(R.id.flashDurationValueMsg);
// msgFlashDurBarValue.setText(String.valueOf(msgFlashDurBar.getProgress()));
// msgFlashDurBarValue.addTextChangedListener(this);
msgFlashOnBar.setOnSeekBarChangeListener(seekBarChange);
msgFlashOffBar.setOnSeekBarChangeListener(seekBarChange);
// msgFlashDurBar.setOnSeekBarChangeListener(seekBarChange);
}