@Hide @Override public void _initialize(final BA ba, Object activityClass, String EventName) { final Switch _switch = new Switch(ba.context); final String eventName = EventName.toLowerCase(BA.cul); setObject(_switch); innerInitialize(ba, eventName, true); if (ba.subExists(eventName + "_checkedchange")) { getObject().setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { ba.raiseEventFromUI(_switch,eventName + "_checkedchange", isChecked); } }); } }
private void beautyView() { beautyEditText(this.mInputAccount, L10NString.getString("umgr_please_input_username"), this.mAccountTextWatcher); beautyCleanButton(this.mClearInputAccount, this); this.mInputAccountLayout.setOnClickListener(this); beautyCleanButton(this.mClearInputPassword, this); this.mInputPassword.setOnClickListener(this); beautyEditText(this.mInputPassword, L10NString.getString("umgr_please_input_password"), this.mPasswordTextWatcher); beautyColorTextView(this.mRegister, "#007dc4", false, L10NString.getString("umgr_whether_register_ornot"), this); beautyColorTextView(this.mFindpwd, "#007dc4", false, L10NString.getString("umgr_whether_forget_password"), this); beautyColorTextView(this.mSwitchAccount, "#007dc4", false, L10NString.getString("umgr_third_login_qihoo_tip"), this); beautyButtonGreen(this.mLogin, L10NString.getString("umgr_login"), this); beautyTextView(this.mAgreeClause1, L10NString.getString("umgr_login_agree_clause_1")); beautyTextView(this.mAgreeClauseUser, L10NString.getString("umgr_agree_clause_2_user")); beautyColorTextView(this.mAgreement, "#0099e5", true, L10NString.getString("umgr_agree_clause_2_agreement"), this); beautyTextView(this.mAnd, L10NString.getString("umgr_agree_clause_2_and")); beautyColorTextView(this.mPrivacy, "#0099e5", true, L10NString.getString("umgr_agree_clause_2_privacy"), this); beautyCheckButton(this.mShowPwd, new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { LoginActivity.this.mInputPassword.setTransformationMethod(LoginActivity.this.mShowPwd.isChecked() ? HideReturnsTransformationMethod.getInstance() : PasswordTransformationMethod.getInstance()); } }); loadPrivateConfig(); }
@SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_demo); setting = new Settings(this); s = (Switch) findViewById(R.id.switch1); s.setChecked(setting.isStarted()); s.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO 自动生成的方法存根 setting.setStarted(isChecked); } }); }
@Override public void doOnViewCreated(View v, @Nullable Bundle savedInstanceState) { toggleButtonButton = (OneSheeldToggleButton) v .findViewById(R.id.toggle_button_shield_button_toggle_button); if (getApplication().getRunningShields().get( getControllerTag()) == null) { getApplication().getRunningShields().put(getControllerTag(), new ToggleButtonShield(activity, getControllerTag())); } toggleButtonButton .setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub ((ToggleButtonShield) getApplication() .getRunningShields().get(getControllerTag())) .setButton(isChecked); } }); if (getApplication().getRunningShields().get( getControllerTag()) != null) toggleButtonButton.setEnabled(true); }
private void addListener() { this.toggle_bingo.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { AddCameraRecordActivity.this.mInputCalory = AddCameraRecordActivity.this .et_calory.getText().toString(); AddCameraRecordActivity.this.et_calory.getText().clear(); AddCameraRecordActivity.this.et_calory.setHint("请等待顾问为你估算"); AddCameraRecordActivity.this.et_calory.setEnabled(false); return; } if (!TextUtils.isEmpty(AddCameraRecordActivity.this.mInputCalory)) { AddCameraRecordActivity.this.et_calory.setText(AddCameraRecordActivity.this .mInputCalory); Selection.setSelection(AddCameraRecordActivity.this.et_calory.getText(), AddCameraRecordActivity.this.et_calory.getText().length()); } AddCameraRecordActivity.this.et_calory.setHint("所含的热量(可不填)"); AddCameraRecordActivity.this.et_calory.setEnabled(true); } }); }
private void initViews() { this.recyclerView.setLayoutManager(new LinearLayoutManager(this)); List<DownloadRecord> recordList = DownloadHelper.getInstance().getRecordsList(); this.mAdapter = new DownloadAdapter(this, recordList); this.recyclerView.setAdapter(this.mAdapter); if (recordList.size() == 0) { showEmpty(); return; } this.tvDelete.setOnClickListener(new OnClickListener() { public void onClick(View v) { DownloadManageActivity.this.showDeleteDialog(); } }); this.cbSelectAll.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { DownloadManageActivity.this.mAdapter.selectAll(); } else if (!DownloadAdapter.CANCEL_SELECT_ALL.equals(buttonView.getTag())) { DownloadManageActivity.this.mAdapter.selectNone(); } buttonView.setTag(null); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.em_activity_new_group); groupNameEditText = (EditText) findViewById(R.id.edit_group_name); introductionEditText = (EditText) findViewById(R.id.edit_group_introduction); publibCheckBox = (CheckBox) findViewById(R.id.cb_public); memberCheckbox = (CheckBox) findViewById(R.id.cb_member_inviter); secondTextView = (TextView) findViewById(R.id.second_desc); publibCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { secondTextView.setText(R.string.join_need_owner_approval); } else { secondTextView.setText(R.string.Open_group_members_invited); } } }); }
private void bindSwitchToEqualizer() { if (!mSwitchBound && mSwitchButton != null) { mSwitchButton.setChecked(AudioEffects.areAudioEffectsEnabled()); mSwitchButton .setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { AudioEffects.setAudioEffectsEnabled(isChecked); } }); mSwitchBound = true; } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_group); groupNameEditText = (EditText) findViewById(R.id.edit_group_name); introductionEditText = (EditText) findViewById(R.id.edit_group_introduction); checkBox = (CheckBox) findViewById(R.id.cb_public); memberCheckbox = (CheckBox) findViewById(R.id.cb_member_inviter); openInviteContainer = (LinearLayout) findViewById(R.id.ll_open_invite); checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(isChecked){ openInviteContainer.setVisibility(View.INVISIBLE); }else{ openInviteContainer.setVisibility(View.VISIBLE); } } }); }
private void initEvent() { btnNext.setOnClickListener(this); tvSelect.setOnClickListener(this); btnNext.setClickable(false); btnNext.setBackgroundResource(R.drawable.btn_next_shape_gray); cbSelect.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor()); btnNext.setClickable(true); } else { btnNext.setBackgroundResource(R.drawable.btn_next_shape_gray); btnNext.setClickable(false); } } }); }
private void ininEvent() { btnNext.setOnClickListener(this); imgWiFiList.setOnClickListener(this); llChooseMode.setOnClickListener(this); cbLaws.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { String psw = etPsw.getText().toString(); if (isChecked) { etPsw.setInputType(0x90); } else { etPsw.setInputType(0x81); } etPsw.setSelection(psw.length()); } }); }
private void ininEvent() { btnNext.setOnClickListener(this); imgWiFiList.setOnClickListener(this); cbLaws.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { String psw = etPsw.getText().toString(); if (isChecked) { etPsw.setInputType(0x90); } else { etPsw.setInputType(0x81); } etPsw.setSelection(psw.length()); } }); cbLaws.setChecked(true); }
private void ininEvent() { llNext.setOnClickListener(this); imgWiFiList.setOnClickListener(this); cbLaws.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { String psw = etPsw.getText().toString(); if (isChecked) { etPsw.setInputType(0x90); } else { etPsw.setInputType(0x81); } etPsw.setSelection(psw.length()); } }); }
private void initEvent() { tvNoRedLight.setOnClickListener(this); tvSelect.setOnClickListener(this); btnNext.setOnClickListener(this); btnNext.setClickable(false); btnNext.setBackgroundResource(R.drawable.btn_next_shape_gray); cbSelect.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor());; btnNext.setClickable(true); } else { btnNext.setBackgroundResource(R.drawable.btn_next_shape_gray); btnNext.setClickable(false); } } }); }
private void initEvent() { btnLogin.setOnClickListener(this); tvRegister.setOnClickListener(this); tvForget.setOnClickListener(this); tvPass.setOnClickListener(this); llQQ.setOnClickListener(this); llWechat.setOnClickListener(this); cbLaws.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { String psw = etPsw.getText().toString(); if (isChecked) { etPsw.setInputType(0x90); } else { etPsw.setInputType(0x81); } etPsw.setSelection(psw.length()); } }); }
@Override public void onBindViewHolder(final SubscriptionViewHolder holder, int position) { final Subscription subscription = subscriptions.get(position); if (!TextUtils.isEmpty(subscription.getRestaurant().getPhoto())) { Picasso.with(context).load(subscription.getRestaurant().getPhoto()).into(holder.imageView); } holder.tvTitle.setText(subscription.getRestaurant().getName()); holder.subscribe.setChecked(subscription.isSubscribed()); holder.subscribe.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { subscription.setSubscribed(isChecked); } }); }
private void executeResolveError() { Intent intent = getIntent(); //获取CheckBox实例 CheckBox cb = (CheckBox)this.findViewById(R.id.checkBox1); //绑定监听器 cb.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton arg0, boolean checkedState) { SharedPreferences preferences = getSharedPreferences("first", Context.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean(ENABLE_SHOW_HUAWEI_RESOLVE_ERROR_VIEW, !checkedState); editor.commit(); Log4jLog.d(LONG_TAG, "set enable_show_huawei_resolve_error_view:" + !checkedState); } }); int errorCode = intent.getIntExtra(INTENT_ERROR_CODE, -1); HuaweiApiAvailability availability = HuaweiApiAvailability.getInstance(); if (availability.isUserResolvableError(errorCode)) { availability.resolveError(this, errorCode, REQUEST_RESOLVE_ERROR, this); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.em_activity_new_group); groupNameEditText = (EditText) findViewById(R.id.edit_group_name); introductionEditText = (EditText) findViewById(R.id.edit_group_introduction); publibCheckBox = (CheckBox) findViewById(R.id.cb_public); memberCheckbox = (CheckBox) findViewById(R.id.cb_member_inviter); secondTextView = (TextView) findViewById(R.id.second_desc); publibCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(isChecked){ secondTextView.setText(R.string.join_need_owner_approval); }else{ secondTextView.setText(R.string.Open_group_members_invited); } } }); }
private void init() { listView=(ListView) findViewById(R.id.shopcar_listview); totalPrice=(TextView) findViewById(R.id.shopcar_allprice); payall=(CheckBox) findViewById(R.id.shopcar_payall); topay=(TextView) findViewById(R.id.shopcar_zhifu); topay.setOnClickListener(this); payall.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(isChecked){ adapter.initCheckBox(true); adapter.notifyDataSetChanged(); } } }); }
public Runnable bindEditor(View v, final EditableItem item, final Runnable afterChange) { final ViewStub booleanEditorStub = (ViewStub) v.findViewById(R.id.boolean_editor_stub); booleanEditorStub.setLayoutResource(R.layout.boolean_editor); final Switch booleanEditor = (Switch) booleanEditorStub.inflate(); Runnable updateSwitch = new Runnable() { public void run() { booleanEditor.setChecked(item.hasValue() && item.getValueBool()); }}; booleanEditor.setVisibility(View.VISIBLE); updateSwitch.run(); booleanEditor.setOnCheckedChangeListener(new OnCheckedChangeListener(){ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { item.setValue(isChecked); afterChange.run(); }}); return updateSwitch; }
@Override protected void initWidgets() { int switchButtonResId = ResFinder.getId( "umeng_common_switch_button"); mSwitchButton = (SwitchButton) mRootView .findViewById(switchButtonResId); mSwitchButton.setChecked(mSDKConfig.isPushEnable(getActivity())); mSwitchButton.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // 保存配置 CommConfig.getConfig().setSDKPushable(getActivity(), isChecked); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.em_activity_new_group); groupNameEditText = (EditText) findViewById(R.id.edit_group_name); introductionEditText = (EditText) findViewById(R.id.edit_group_introduction); checkBox = (CheckBox) findViewById(R.id.cb_public); memberCheckbox = (CheckBox) findViewById(R.id.cb_member_inviter); openInviteContainer = (LinearLayout) findViewById(R.id.ll_open_invite); checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(isChecked){ openInviteContainer.setVisibility(View.INVISIBLE); }else{ openInviteContainer.setVisibility(View.VISIBLE); } } }); }
/** * Dialog: What's OSBuild? * Show description about OSBuild. */ @TargetApi(11) private void appDescDialog() { ViewGroup viewGroup = (ViewGroup) getLayoutInflater().inflate(R.layout.dialog_text_ask, null); ((MyTextView)viewGroup.findViewById(R.id.mtv_desc)).setText(R.string.dia_app_desc); ((CheckBox)viewGroup.findViewById(R.id.cb_not_show)) .setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton p1, boolean p2) { sharedPreferences.edit() .putBoolean("not_show_about", p2).commit(); } }); AlertDialog alertDialog = (C.SDK >= 21 ? (new AlertDialog.Builder(this, R.style.AlertDialogStyle)) : (new AlertDialog.Builder(this))) .setTitle(R.string.dia_title_about) .setView(viewGroup) .setPositiveButton(R.string.dia_pos_ok, null) .create(); alertDialog.show(); }
private void initEvent() { btnNext.setOnClickListener(this); tvSelect.setOnClickListener(this); btnNext.setClickable(false); btnNext.setBackgroundResource(R.drawable.button_shape_gray); cbSelect.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor()); btnNext.setClickable(true); } else { btnNext.setBackgroundResource(R.drawable.button_shape_gray); btnNext.setClickable(false); } } }); }
private void initEvent() { tvNoRedLight.setOnClickListener(this); tvSelect.setOnClickListener(this); btnNext.setOnClickListener(this); btnNext.setClickable(false); btnNext.setBackgroundResource(R.drawable.button_shape_gray); cbSelect.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor());; btnNext.setClickable(true); } else { btnNext.setBackgroundResource(R.drawable.button_shape_gray); btnNext.setClickable(false); } } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTorch = (ToggleButton) findViewById(R.id.toggleLight); mTorch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { try{ if(isChecked){ mService.activateTorch(); }else{ mService.deactivateTorch(); } }catch (Exception e) { e.printStackTrace(); } } }); Toast.makeText(getApplicationContext(), R.string.hello_msg, Toast.LENGTH_SHORT).show(); }
private View createOutputWidget(MidiDevice midiDevice, final MidiOutput midiOutput) { LinearLayout view = new LinearLayout(getContext()); TextView tv = new TextView(getContext()); tv.setText(new MidiPortAdapter(midiDevice, midiOutput).toString()); CheckBox cb = new CheckBox(getContext()); cb.setChecked(midiManager.isOpened(midiOutput)); cb.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { midiManager.open(midiOutput); } else { midiManager.close(midiOutput); } } }); view.addView(cb); view.addView(tv); return view; }