本文整理了Java中android.widget.Switch.setEnabled()
方法的一些代码示例,展示了Switch.setEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Switch.setEnabled()
方法的具体详情如下:
包路径:android.widget.Switch
类名称:Switch
方法名:setEnabled
暂无
代码示例来源:origin: commonsguy/cw-omnibus
private void onDisconnected() {
binding.connected.setEnabled(true);
binding.entry.setEnabled(false);
}
代码示例来源:origin: commonsguy/cw-omnibus
public void onConnectionChange() {
if (binding.connected.isChecked()) {
binding.connected.setEnabled(false);
connectionSub=rxBluetooth.observeConnectDevice(getDevice(), ShoutingEchoService.SERVICE_ID)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::onConnected, this::onConnectionError);
}
else {
disconnect();
}
}
代码示例来源:origin: commonsguy/cw-omnibus
private void toggleWidgets(boolean enable) {
type.setEnabled(enable);
period.setEnabled(enable);
download.setEnabled(enable);
}
代码示例来源:origin: commonsguy/cw-omnibus
private void toggleWidgets(boolean enable) {
type.setEnabled(enable);
period.setEnabled(enable);
download.setEnabled(enable);
}
代码示例来源:origin: commonsguy/cw-omnibus
private void onConnected(BluetoothSocket socket) throws IOException {
binding.connected.setEnabled(true);
binding.entry.setEnabled(true);
this.socket=socket;
out=new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
responseSub=Bytes.from(socket.getInputStream())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(bytes -> post(new String(bytes)),
throwable -> out.close());
}
代码示例来源:origin: palaima/DebugDrawer
bluetooth.setEnabled(false);
代码示例来源:origin: iotoasis/SI
private void disable_switch() {
switch_red.setEnabled(false);
switch_green.setEnabled(false);
switch_blue.setEnabled(false);
}
代码示例来源:origin: iotoasis/SI
private void enable_switch() {
switch_red.setEnabled(true);
switch_green.setEnabled(true);
switch_blue.setEnabled(true);
}
代码示例来源:origin: thuryn/your-local-weather
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
checked = isChecked;
if (dependentSwitch != null) {
if (isChecked) {
dependentSwitch.setChecked(false);
dependentSwitch.setEnabled(false);
} else {
dependentSwitch.setEnabled(true);
}
}
}
代码示例来源:origin: wasdennnoch/AndroidN-ify
private void handleToggleStateChanged(boolean state, boolean toggleEnabled) {
mSwitchState = state;
if (mAnimatingOpen) {
return;
}
mQsDetailHeaderSwitch.setChecked(state);
mQsDetailHeader.setEnabled(toggleEnabled);
mQsDetailHeaderSwitch.setEnabled(toggleEnabled);
}
代码示例来源:origin: AmazMod/AmazMod
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//WatchfaceActivity.this.send_data = isChecked;
Prefs.putBoolean(Constants.PREF_WATCHFACE_SEND_DATA, isChecked);
//Toast.makeText(WatchfaceActivity.this, "send data: " + isChecked, Toast.LENGTH_SHORT).show();
WatchfaceActivity.this.send_watchface_data_interval.setEnabled(isChecked);
WatchfaceActivity.this.send_on_battery_change_switch.setEnabled(isChecked);
WatchfaceActivity.this.send_on_alarm_change_switch.setEnabled(isChecked);
WatchfaceActivity.this.watchface_sync_now_button.setEnabled(isChecked);
}
});
代码示例来源:origin: AriesHoo/UIWidget
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (delegate != null) {
delegate.init();
}
}
代码示例来源:origin: mbmc/FiInfo
private void activate(Switch switchView, boolean activate) {
switchView.setEnabled(activate);
switchView.setAlpha(activate ? 1.0f : 0.5f);
}
代码示例来源:origin: pili-engineering/QNRTC-Android
private void updateSwitchState(RemoteTrack remoteTrack, Switch switchButton) {
if (remoteTrack != null) {
switchButton.setChecked(remoteTrack.isTrackInclude());
switchButton.setEnabled(true);
} else {
switchButton.setChecked(true);
switchButton.setEnabled(false);
}
}
代码示例来源:origin: WowzaMediaSystems/gocoder-sdk-samples-android
/**
* Update the state of the UI controls
*/
@Override
protected boolean syncUIControlState() {
boolean disableControls = super.syncUIControlState();
if (getBroadcast() != null) {
mMP4Controls.setVisibility(getBroadcast().getStatus().isRunning() ? View.INVISIBLE : View.VISIBLE);
mSwitchMP4.setEnabled(!disableControls);
}
return disableControls;
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
@Override
void onServiceDisconnected() {
Switch sw = (Switch) findViewById(R.id.activity_setting_device_switch);
sw.setOnCheckedChangeListener(null);
sw.setEnabled(false);
findViewById(R.id.activity_setting_btn).setEnabled(false);
HOGPMessageService service = getHOGPMessageService();
if (service != null) {
service.getServiceProvider().removeServiceListener(this);
}
}
代码示例来源:origin: quemb/QMBForm
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
protected void update() {
String title = getFormItemDescriptor().getTitle();
mSwitch.setText(title);
if (getRowDescriptor().getDisabled())
{
mSwitch.setEnabled(false);
setTextColor(mSwitch, CellDescriptor.COLOR_LABEL_DISABLED);
}
else
mSwitch.setEnabled(true);
@SuppressWarnings("unchecked") Value<Boolean> value = (Value<Boolean>) getRowDescriptor().getValue();
if (value != null && value.getValue() != null) {
mSwitch.setChecked(value.getValue());
}
}
代码示例来源:origin: androidthings/sample-simpleui
Log.e(TAG, "Error initializing GPIO: " + name, e);
button.setEnabled(false);
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
@Override
public void onResume() {
super.onResume();
refresh();
if (getView() != null) {
Switch switchBtn = (Switch) getView().findViewById(R.id.fragment_beacon_scan_switch);
if (switchBtn != null) {
switchBtn.setEnabled(LinkingUtil.isApplicationInstalled(getContext()));
}
}
LinkingApplication app = (LinkingApplication) getActivity().getApplication();
LinkingBeaconManager mgr = app.getLinkingBeaconManager();
mgr.addOnBeaconConnectListener(this);
mgr.addOnBeaconScanStateListener(this);
}
代码示例来源:origin: stackoverflow.com
@Override
public void run() {
testSwitch.setEnabled(true);
if (testSwitch.isChecked()) {
testSwitch.setText("ON");
内容来源于网络,如有侵权,请联系作者删除!