当前位置: 首页>>代码示例>>Java>>正文


Java Switch.setChecked方法代码示例

本文整理汇总了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;
}
 
开发者ID:saschat,项目名称:WLAN-Opp,代码行数:29,代码来源:MainActivity.java

示例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());
}
 
开发者ID:spirosbond,项目名称:CallerFlashlight,代码行数:14,代码来源:MainPanel.java

示例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);
}
 
开发者ID:spirosbond,项目名称:CallerFlashlight,代码行数:37,代码来源:MainPanel.java

示例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);
}
 
开发者ID:spirosbond,项目名称:CallerFlashlight,代码行数:47,代码来源:MainPanel.java


注:本文中的org.jraf.android.backport.switchwidget.Switch.setChecked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。