本文整理汇总了Java中android.widget.CompoundButton.getId方法的典型用法代码示例。如果您正苦于以下问题:Java CompoundButton.getId方法的具体用法?Java CompoundButton.getId怎么用?Java CompoundButton.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.CompoundButton
的用法示例。
在下文中一共展示了CompoundButton.getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// prevents from infinite recursion
if (mProtectFromCheckedChange) {
return;
}
mProtectFromCheckedChange = true;
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
mProtectFromCheckedChange = false;
int id = buttonView.getId();
setCheckedId(id);
}
示例2: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
switch (buttonView.getId()) {
case R.id.red_color_rb:
mBinding.testQueuedProgressbar.setBallColor(Color.RED);
break;
case R.id.green_color_rb:
mBinding.testQueuedProgressbar.setBallColor(Color.GREEN);
break;
case R.id.blue_color_rb:
mBinding.testQueuedProgressbar.setBallColor(Color.BLUE);
break;
default:
mBinding.testQueuedProgressbar.setBallColor(0);
break;
}
}
}
示例3: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
switch (compoundButton.getId()) {
case R.id.cb_setting_night:
if (isNull) { //防止夜间模式MainActivity执行reCreate后重复调用
SharedPreferenceUtil.setNightModeState(b);
NightModeEvent event = new NightModeEvent();
event.setNightMode(b);
RxBus.getDefault().post(event);
}
break;
case R.id.cb_setting_image:
SharedPreferenceUtil.setNoImageState(b);
break;
case R.id.cb_setting_cache:
SharedPreferenceUtil.setAutoCacheState(b);
break;
}
}
示例4: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(buttonView.getId() == R.id.use_username) {
if(isChecked) {
usernameLayout.setVisibility(View.VISIBLE);
passwordLayout.setVisibility(View.VISIBLE);
phoneNumberEdit.setVisibility(EditText.GONE);
phoneNumberLayout.setVisibility(LinearLayout.GONE);
messagePhoneNumber.setText(getString(R.string.assistant_linphone_login_desc));
recoverAccount = false;
} else {
usernameLayout.setVisibility(View.GONE);
passwordLayout.setVisibility(View.GONE);
phoneNumberEdit.setVisibility(EditText.VISIBLE);
phoneNumberLayout.setVisibility(LinearLayout.VISIBLE);
messagePhoneNumber.setText(getString(R.string.assistant_create_account_part_1));
recoverAccount = true;
}
}
}
示例5: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
switch (buttonView.getId()) {
case R.id.fragment_update_tree_details_missing_tree:
mTreeIsMissing = isChecked;
EditText noteTxt = (EditText) getActivity().findViewById(R.id.fragment_update_tree_details_note);
if (isChecked) {
noteTxt.setHint(getActivity().getResources().getString(R.string.cause_of_death));
} else {
noteTxt.setHint(getActivity().getResources().getString(R.string.your_note));
}
break;
default:
break;
}
}
示例6: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Log.i("AlarmFrcheckListener", "buttonView=" + buttonView);
if (isChecked) {
confirmable = true;
if (buttonView.getId() == map[0]) {
checkedOnce(true);
} else {
checkedOnce(false);
}
} else {
for (int id : map) {
if (((AppCompatCheckBox) findViewById(id)).isChecked()) {
confirmable = true;
break;
}
confirmable = false;
}
}
mTvConfirm.setTextColor(confirmable ? context.getResources().getColor(R.color.base_blue)
: context.getResources().getColor(R.color.forbid_click_color));
}
示例7: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@OnCheckedChanged({R.id.cb_setting_cache, R.id.cb_setting_image, R.id.cb_setting_night})
public void onCheckedChanged(CompoundButton view, boolean isChecked) {
if (!mIsInited)
return;
switch (view.getId()) {
case R.id.cb_setting_cache:
mPresenter.setArticleAutoCacheState(isChecked);
break;
case R.id.cb_setting_image:
mPresenter.setArticleNoImageState(isChecked);
break;
case R.id.cb_setting_night:
if (mIsBundleNull) {
mPresenter.setNightModeState(isChecked);
NightModeEvent event = new NightModeEvent();
event.setNightMode(isChecked);
EventBus.getDefault().post(event);
}
break;
}
}
示例8: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
switch(buttonView.getId()) {
case toggle_midview :
if(isChecked)
recyclerViewMidterm.setVisibility(View.VISIBLE);
else
recyclerViewMidterm.setVisibility(View.GONE);
break;
case toggle_finview :
if (isChecked)
recyclerViewFinals.setVisibility(View.VISIBLE);
else
recyclerViewFinals.setVisibility(View.GONE);
break;
}
}
示例9: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
setChecking();
compoundButton.setChecked(true);
switch (compoundButton.getId()){
case R.id.radioButton1:
builder.setType(TextCounter.BYTE);
seekBar1.setEnabled(false);
type = TextCounter.BYTE;
break;
case R.id.radioButton2:
builder.setType(TextCounter.SHORT);
seekBar1.setEnabled(false);
type = TextCounter.SHORT;
break;
case R.id.radioButton3:
builder.setType(TextCounter.INT);
seekBar1.setEnabled(false);
type = TextCounter.INT;
break;
case R.id.radioButton4:
builder.setType(TextCounter.FLOAT);
seekBar1.setEnabled(true);
type = TextCounter.FLOAT;
break;
case R.id.radioButton5:
builder.setType(TextCounter.LONG);
seekBar1.setEnabled(false);
type = TextCounter.LONG;
break;
case R.id.radioButton6:
builder.setType(TextCounter.DOUBLE);
seekBar1.setEnabled(true);
type = TextCounter.DOUBLE;
break;
default:
return;
}
}
示例10: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
switch (compoundButton.getId()) {
case R.id.toggle_calculator: {
setAppEnabled(PACKAGE_NAME_CALCULATOR, checked);
mCalculatorEnabled = checked;
break;
}
case R.id.toggle_chrome: {
setAppEnabled(PACKAGE_NAME_CHROME, checked);
mChromeEnabled = checked;
break;
}
}
}
示例11: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// FragmentTransaction fragmentTransaction = context.getFragmentManager().beginTransaction();
// BaseFragment fragment = ((BaseFragment) buttonView.getTag());
// if (isChecked) {
// fragmentTransaction.show(fragment);
// } else {
// fragmentTransaction.hide(fragment);
// }
// fragmentTransaction.commit();
switch (buttonView.getId()) {
case R.id.cbMessage:
handleFragment(fragments.get(0), isChecked);
break;
case R.id.cbReceive:
handleFragment(fragments.get(1), isChecked);
break;
case R.id.cbDiliver:
handleFragment(fragments.get(2), isChecked);
break;
case R.id.cbOffice:
handleFragment(fragments.get(3), isChecked);
break;
case R.id.cbMe:
handleFragment(fragments.get(4), isChecked);
break;
}
}
示例12: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (buttonView.getId() == cbVolume.getId()) {
SettingManager.getInstance().saveVolumeFlipEnable(isChecked);
} else if (buttonView.getId() == cbAutoBrightness.getId()) {
if (isChecked) {
startAutoLightness();
} else {
stopAutoLightness();
}
}
}
示例13: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (buttonView.getId() == R.id.switchMessage) {
// 消息通知
SettingsUtil.updateMessageNotification(isChecked);
if (isChecked) {
if (!BaseSettings.sNotifyEnable) {
// 启用消息通知
UnreadService.startService();
enableNotifyInterval();
}
} else {
if (!mSwitchPrivateLetter.isChecked() && BaseSettings.sNotifyEnable) {
// 停止消息通知
UnreadService.stopService();
disableNotifyInterval();
}
}
} else if (buttonView.getId() == R.id.switchPrivateLetter) {
// 私信通知
SettingsUtil.updatePrivateLetterNotification(isChecked);
if (isChecked) {
if (!BaseSettings.sNotifyEnable) {
// 启用消息通知
UnreadService.startService();
enableNotifyInterval();
}
} else {
if (!mSwitchMessage.isChecked() && BaseSettings.sNotifyEnable) {
// 停止消息通知
UnreadService.stopService();
disableNotifyInterval();
}
}
}
}
示例14: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (mProtectFromCheckedChange) {
return;
}
mProtectFromCheckedChange = true;
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
mProtectFromCheckedChange = false;
int id = buttonView.getId();
setCheckedId(id);
}
示例15: onCheckedChanged
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
switch (compoundButton.getId()) {
case R.id.toolbar_switch:
isToolbarVisible = checked;
break;
case R.id.drawer_switch:
isDrawerEnabled = checked;
break;
default:
break;
}
getFlowr().syncScreenState();
}