private void setUserProperty() { this.picker_layout = (LinearLayout) findViewById(R.id.picker_layout); TextView text = (TextView) findViewById(R.id.user_property_text); this.hint = (TextView) findViewById(R.id.hint); text.setText(R.string.ov); ((RadioGroup) findViewById(R.id.switch_bottom)).setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.yes: UserMcGoView.this.setBottomVisible(Boolean.valueOf(false)); return; case R.id.no: UserMcGoView.this.setBottomVisible(Boolean.valueOf(true)); return; default: return; } } }); }
public int findSelectedDuration(View view) { RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.stroke_dlg_duration_group); int radioButtonId = radioGroup.getCheckedRadioButtonId(); if( radioButtonId != -1 ) { RadioButton radioButton = (RadioButton) radioGroup.findViewById(radioButtonId); if( radioButton != null ) { return ((Integer)radioButton.getTag()).intValue(); } } return 0; }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mRadioGroup = (RadioGroup) view.findViewById(R.id.radio_group); mShowAllButton = (RadioButton) view.findViewById(R.id.show_all); mRedactSensitiveButton = (RadioButton) view.findViewById(R.id.redact_sensitive); mRadioGroup.setOnCheckedChangeListener(this); // Disable buttons according to policy. if (isSecureNotificationsDisabled(getActivity())) { mShowAllButton.setEnabled(false); mRedactSensitiveButton.setEnabled(false); } else if (isUnredactedNotificationsDisabled(getActivity())) { mShowAllButton.setEnabled(false); } }
private void initHistoryData(List<String> allNames) { int padding = (int) (DensityUtil.dip2px(10f) * DensityUtil.getBaseScale(getContext())); TagAdapter adapter = new TagAdapter<String>(allNames) { @Override public View getView(FlowLayout parent, int position, String s) { TextView textView = new TextView(getContext()); textView.setLayoutParams(new RadioGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); textView.setWidth((int) (DensityUtil.dip2px(80f) * DensityUtil.getBaseScale(getContext()))); textView.setLines(1); textView.setGravity(Gravity.CENTER); textView.setEllipsize(TextUtils.TruncateAt.END); textView.setPadding(padding, padding, padding, padding); textView.setText(s); return textView; } }; mBinding.flowLayoutHistory.setAdapter(adapter); mBinding.flowLayoutHistory.setOnTagClickListener((view, position, parent) -> { String item = (String) adapter.getItem(position); return false; }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivityManager.getActivityManager().addActivity("RegisterActivity", this); setContentView(R.layout.activity_register); etName = (EditText) findViewById(R.id.ETname); etEmail = (EditText) findViewById(R.id.ETemail); spMajor = (Spinner) findViewById(R.id.spiMajor); spProvince = (Spinner) findViewById(R.id.spiProvince); etPassword = (EditText) findViewById(R.id.ETpassword); etConfirmPassword = (EditText) findViewById(R.id.ETconfirmPassword); etCheckCode = (EditText) findViewById(R.id.ETCheckCode); radioGroup = (RadioGroup) findViewById(R.id.rgGender); findViewById(R.id.butRegister).setOnClickListener(this); findViewById(R.id.butMailCode).setOnClickListener(this); }
/** * 最下方,点击切换Fragment的管理 */ // @OnCheckedChanged({R.id.rb_news, R.id.rb_jingxuan, R.id.rb_forum, R.id.rb_my}) //void onTagChecked(RadioButton rbFragment) { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.rb_news: //LogUtils.i("MainActivity onTagChecked() 资讯"); replaceOutFragment(mNewsFragment); break; case R.id.rb_jingxuan: //LogUtils.i("MainActivity onTagChecked() 精选"); replaceOutFragment(mJingXuanFragment); break; case R.id.rb_forum: //LogUtils.i("MainActivity onTagChecked() 社区"); replaceOutFragment(mForumFragment); break; case R.id.rb_my: //LogUtils.i("MainActivity onTagChecked() 我"); replaceOutFragment(mMeFragment); break; } }
@Override protected void initData() { mOrderNo = getIntent().getStringExtra("orderNo"); mPayType = getIntent().getStringExtra("payType"); mPayTypeComments = getIntent().getStringExtra("payTypeComments"); mTextView_Number.setText(mOrderNo); mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int checkedId) { if (mRadioButton_Alipay.getId() == checkedId) { PAY_TYPE = 0; } if (mRadioButton_Balance.getId() == checkedId) { PAY_TYPE = 1; } } }); mPresenter.payVerifyResult(1, mOrderNo,new ArrayMap<>()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialog_alarm_item); ButterKnife.bind(this); fillMap(); mAlarmItemBtns.check(itemMaps.get(mAlarmItem)); mAlarmItemBtns.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { RadioButton selectedBtn = (RadioButton) findViewById(checkedId); mAlarmItem = selectedBtn.getText().toString(); if (mSelectedListener != null) mSelectedListener.onSelected(mAlarmItem); dismiss(); } }); }
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.rb_black: presenter.setSortingMode(SortingMode.BLACK); presenter.hideColorSeekBar(); break; case R.id.rb_white: presenter.setSortingMode(SortingMode.WHITE); presenter.hideColorSeekBar(); break; case R.id.rb_brightness: presenter.setSortingMode(SortingMode.BRIGHTNESS); presenter.hideColorSeekBar(); break; case R.id.rb_color: presenter.setSortingMode(SortingMode.COLOR); presenter.showColorSeekBar(); break; } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.e("MainActivity", "onCreate!!!!!"); MyApplication.activity = this; SingletonData.getInstance(); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.tabcontroller); isFang = getIntent().getExtras().getString("isFang"); int tranId = R.id.firstContentTab; if (isFang != null && isFang.equals("true")) { tranId = R.id.fangYaoTab; } // mContainer = (ViewGroup) findViewById(R.id.content); fragmentManager = getFragmentManager(); radioGroup = (RadioGroup) findViewById(R.id.rg_tab); radioGroup.check(tranId); radioGroup.setVisibility(ViewGroup.GONE); FragmentTransaction transaction = fragmentManager.beginTransaction(); Fragment fragment = FragmentFactory .getInstanceByIndex(tranId); transaction.replace(R.id.content, fragment); transaction.commit(); }
@Override public View onCreateView( final LayoutInflater inflater, final @Nullable ViewGroup container, final @Nullable Bundle savedInstanceState) { final View picker = inflater.inflate(R.layout.fragment_category_picker, container, false); categories = (RadioGroup) picker.findViewById(R.id.categories); categoryLabel = (TextView) picker.findViewById(R.id.selected_category); categories.setOnCheckedChangeListener(new IconPickerWrapper(categoryLabel)); categories.check(R.id.other); return picker; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editText = findViewById(R.id.et); ((RadioGroup) findViewById(R.id.rg)).setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { switch (checkedId) { case R.id.vod: isLive = false; break; case R.id.live: isLive = true; break; } } }); //用于将视频缓存到SDCard,如不授权将缓存到/data/data目录 if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1001); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_capture_claim); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton attach = (FloatingActionButton) findViewById(R.id.attach); attach.setOnClickListener(this); selectedDate = new DatePickerWrapper((TextView) findViewById(R.id.date)); categories = (RadioGroup) findViewById(R.id.categories); categories.setOnCheckedChangeListener( new IconPickerWrapper((TextView) findViewById(R.id.selected_category)) ); categories.check(R.id.other); }
@Override public void initViews() { mLayoutRoot = (LinearLayout) findViewById(R.id.dialog_publish_layout_root); mPubHelptv = (HandyTextView)findViewById(R.id.publish_help_textview); mRgPubDay = (RadioGroup)findViewById(R.id.dialog_publish_rg_day); mPubStartHtv = (HandyTextView)findViewById(R.id.publish_start_time_hour); mPubStartMtv = (HandyTextView)findViewById(R.id.publish_start_time_minute); mPubEndHtv = (HandyTextView)findViewById(R.id.publish_end_time_hour); mPubEndMtv = (HandyTextView)findViewById(R.id.publish_end_time_minute); edtTxt_details = (EditText)findViewById(R.id.pubish_ps_textview); mBtnSubmit = (Button) findViewById(R.id.dialog_publish_btn_submit); mBtnCancel = (Button) findViewById(R.id.dialog_publish_btn_cancel); details_linearLayout = (LinearLayout) findViewById(R.id.pop_pub_details_linearLayout); // if(!relation){ // details_linearLayout.setVisibility(View.GONE); // } else { // details_linearLayout.setVisibility(View.VISIBLE); // } }
private void initView() { selectableTextView = (SelectableTextView) findViewById(R.id.ctv_content); selectableTextView.setText(Html.fromHtml(StringContentUtil.str_hanzi).toString()); selectableTextView.clearFocus(); selectableTextView.setTextJustify(true); selectableTextView.setForbiddenActionMenu(false); selectableTextView.setCustomActionMenuCallBack(this); selectableTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(HoriActivity.this, "SelectableTextView 的onClick事件", Toast.LENGTH_SHORT).show(); } }); rg_text_gravity = (RadioGroup) findViewById(R.id.rg_text_gravity); rg_text_content = (RadioGroup) findViewById(R.id.rg_text_content); ((RadioButton) findViewById(R.id.rb_justify)).setChecked(true); ((RadioButton) findViewById(R.id.rb_hanzi)).setChecked(true); rg_text_gravity.setOnCheckedChangeListener(this); rg_text_content.setOnCheckedChangeListener(this); }
public void initViews() { mHeaderLayout = (HeaderLayout)findViewById(R.id.register_info_header); mHeaderLayout.mySettingTitle("个人资料"); mSeletePhoto = (LinearLayout)findViewById(R.id.register_photo_layout_selectphoto); mTakePhoto = (LinearLayout)findViewById(R.id.register_photo_layout_takepicture); faceImage = (ImageView)findViewById(R.id.register_photo_iv_userphoto); mEtName = (EditText)findViewById(R.id.register_info_new_name); mEtAge = (EditText)findViewById(R.id.register_info_new_age); mRgGender = (RadioGroup)findViewById(R.id.register_user_info_gender); mRlSchool = (RelativeLayout)findViewById(R.id.register_school_layout_item); mTvSchool = (HandyTextView)findViewById(R.id.register_school_item_name); mBtnPrevious = (Button)findViewById(R.id.reg_info_btn_previous); mBtnFinish = (Button)findViewById(R.id.reg_info_btn_next); }
private void initRadioGroupListener() { mRgMain.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { switch (checkedId) { case R.id.rb_movie: switchFragment(BaseConstant.RB_MOVIE); break; case R.id.rb_cinema: switchFragment(BaseConstant.RB_CINEMA); break; case R.id.rb_discover: switchFragment(BaseConstant.RB_DISCOVER); break; case R.id.rb_mine: switchFragment(BaseConstant.RB_MINE); break; } } }); }
/** * {@inheritDoc} */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); radioGroup = (RadioGroup) findViewById(R.id.radioGroup_choose_game); radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { RadioButton buttonChoiceGame = (RadioButton) findViewById(checkedId); String choiceOfGame = buttonChoiceGame.getText().toString(); switch (choiceOfGame) { case "Single Player": startActivity(new Intent(SettingsActivity.this, GameActivity.class)); break; case "Multiplayer": Toast.makeText(SettingsActivity.this, "This feature is not available yet. Coming soon", Toast.LENGTH_SHORT).show(); break; default: startActivity(new Intent(SettingsActivity.this, GameActivity.class)); } } }); }
private void initViews() { this.txtName = findViewById(R.id.txt_addVehicle_name); this.txtManufacturer = findViewById(R.id.txt_addVehicle_manufacturer); this.txtActualMileage = findViewById(R.id.txt_addVehicle_mileage); this.txtActualMileageDistanceUnit = findViewById(R.id.txt_addVehicle_mileage_distanceUnit); this.spinnerType = findViewById(R.id.spinner_addVehicle_types); this.spinnerCurrency = findViewById(R.id.spinner_currency); this.radioGroupVolumeUnit = findViewById(R.id.radio_volume_unit); this.imgCarPhoto = findViewById(R.id.img_addVehicle_photo); this.imgCarPhotoRemove = findViewById(R.id.img_addVehicle_removePhoto); spinnerCurrency.setAdapter(new SpinnerCurrencyAdapter(this)); spinnerType.setAdapter(new SpinnerVehicleTypesAdapter(this)); radioGroupVolumeUnit.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, @IdRes int i) { if (radioGroup.getCheckedRadioButtonId() == R.id.radio_litres) txtActualMileageDistanceUnit.setText(DistanceUnit.km.toString()); else txtActualMileageDistanceUnit.setText(DistanceUnit.mi.toString()); } }); this.radioGroupVolumeUnit.check(R.id.radio_litres); }
private void createViews() { findViewById(R.id.button).setOnClickListener(this); tvTitle = (TextView) findViewById(R.id.tvTitle); etPhone = (EditText) findViewById(R.id.etPhone); etMail = (EditText) findViewById(R.id.etMail); etAccount = (EditText) findViewById(R.id.etAccount); etAmount = (EditText) findViewById(R.id.etAmount); radioGroup = (RadioGroup) findViewById(R.id.radioGroup); llMain = (LinearLayout) findViewById(R.id.llMain); radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { etPhone.setVisibility(checkedId == R.id.rbPhone ? View.VISIBLE : View.GONE); etMail.setVisibility(checkedId == R.id.rbEmail ? View.VISIBLE : View.GONE); etAccount.setVisibility(checkedId == R.id.rbAccount ? View.VISIBLE : View.GONE); tvTitle.setText(getSelectedTitle()); } }); }
@Override public void onFinishInflate() { super.onFinishInflate(); mRadioGroup = (RadioGroup) findViewById(R.id.radio_button_group); mColorModeButtons.put(Theme.LIGHT, initializeAndGetButton(R.id.light_mode, Theme.LIGHT)); mColorModeButtons.put(Theme.DARK, initializeAndGetButton(R.id.dark_mode, Theme.DARK)); mColorModeButtons.put(Theme.SEPIA, initializeAndGetButton(R.id.sepia_mode, Theme.SEPIA)); mColorModeButtons.get(mDistilledPagePrefs.getTheme()).setChecked(true); mFontScaleSeekBar = (SeekBar) findViewById(R.id.font_size); mFontScaleTextView = (TextView) findViewById(R.id.font_size_percentage); mFontFamilySpinner = (Spinner) findViewById(R.id.font_family); initFontFamilySpinner(); // Setting initial progress on font scale seekbar. onChangeFontScaling(mDistilledPagePrefs.getFontScaling()); mFontScaleSeekBar.setOnSeekBarChangeListener(this); }
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { final boolean show = (checkedId == R.id.show_all); final boolean enabled = (checkedId != R.id.hide_all); Settings.Secure.putInt(getContentResolver(), Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, show ? 1 : 0); Settings.Secure.putInt(getContentResolver(), Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0); }
@NonNull @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final LayoutInflater inflater = LayoutInflater.from(getActivity()); // Read button configuration final Bundle args = getArguments(); final int index = args.getInt(ARG_INDEX); final String command = args.getString(ARG_COMMAND); final int eol = args.getInt(ARG_EOL); final int iconIndex = args.getInt(ARG_ICON_INDEX); final boolean active = true; // change to active by default mActiveIcon = iconIndex; // Create view final View view = inflater.inflate(R.layout.feature_uart_dialog_edit, null); final EditText field = mField = (EditText) view.findViewById(R.id.field); final GridView grid = (GridView) view.findViewById(R.id.grid); final CheckBox checkBox = mActiveCheckBox = (CheckBox) view.findViewById(R.id.active); checkBox.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() { @Override public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { field.setEnabled(isChecked); grid.setEnabled(isChecked); if (mIconAdapter != null) mIconAdapter.notifyDataSetChanged(); } }); final RadioGroup eolGroup = mEOLGroup = (RadioGroup) view.findViewById(R.id.uart_eol); switch (Command.Eol.values()[eol]) { case CR_LF: eolGroup.check(R.id.uart_eol_cr_lf); break; case CR: eolGroup.check(R.id.uart_eol_cr); break; case LF: default: eolGroup.check(R.id.uart_eol_lf); break; } field.setText(command); field.setEnabled(active); checkBox.setChecked(active); grid.setOnItemClickListener(this); grid.setEnabled(active); grid.setAdapter(mIconAdapter = new IconAdapter()); // As we want to have some validation we can't user the DialogInterface.OnClickListener as it's always dismissing the dialog. final AlertDialog dialog = new AlertDialog.Builder(getActivity()).setCancelable(false).setTitle(R.string.uart_edit_title).setPositiveButton(R.string.ok, null) .setNegativeButton(R.string.cancel, null).setView(view).show(); final Button okButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE); okButton.setOnClickListener(this); return dialog; }
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { heightUpdate.setEnabled(checkedId == R.id.heightCustom); heightUpdate.setAlpha(checkedId == R.id.heightCustom ? 1f : 0.3f); height.clearFocus(); height.setEnabled(checkedId == R.id.heightCustom); height.setAlpha(checkedId == R.id.heightCustom ? 1f : 0.5f); updateCamera(false, true); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ((RadioGroup)findViewById(R.id.radioGroupTopics)).setOnCheckedChangeListener(this); SharedPreferences preferences = getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE); ((EditText)findViewById(R.id.editTextArguments)) .setText(preferences.getString(Common.KEY_ARGUMENTS, "")); ((EditText)findViewById(R.id.editTextEnvVariables)) .setText(preferences.getString(Common.KEY_ENVIRONMENT_VARIABLES, "")); ((EditText)findViewById(R.id.editTextMasterUrl)) .setText(preferences.getString(Common.KEY_MASTER_URL, "http://localhost:11311")); ((EditText)findViewById(R.id.editTextTopics)) .setText(preferences.getString(Common.KEY_TOPICS_TO_RECORD, "")); boolean recordAllTopics = preferences.getBoolean(Common.KEY_RECORD_ALL_TOPICS, true); if (recordAllTopics) { ((RadioButton) findViewById(R.id.radioButtonAllTopics)).setChecked(true); } else { ((RadioButton) findViewById(R.id.radioButtonSelectedTopics)).setChecked(true); } if (Common.isServiceRunning(RecordService.class, this)) { bindRecordService(); } }
private void initView() { mPaiGroup = (RadioGroup) findViewById(R.id.paiGroup); mApiID1 = (RadioButton) findViewById(R.id.apiID1); mApiID2 = (RadioButton) findViewById(R.id.apiID2); mApiID3 = (RadioButton) findViewById(R.id.apiID3); mApiID4 = (RadioButton) findViewById(R.id.apiID4); mText = (TextView) findViewById(R.id.phone); }
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user); tv=(TextView) findViewById(R.id.textView1); rg=(RadioGroup) findViewById(R.id.radioGroup1); a=(RadioButton) findViewById(R.id.radio0); b=(RadioButton) findViewById(R.id.radio1); c=(RadioButton) findViewById(R.id.radio2); Intent i=getIntent(); n=i.getStringExtra("name"); tv.setText("Welcome "+n); }
private void initializeGuiVariables(View view) { usernameEdit = (EditText) view.findViewById(R.id.usernameEdit); geschlechtRadioGroup = (RadioGroup) view.findViewById(R.id.geschlechtRadioGroup); manRadioButton = (RadioButton) view.findViewById(R.id.user_man); weightEditText = (EditText) view.findViewById(R.id.weightEditText); okButton = (Button) view.findViewById(R.id.userOkButton); abbrechenButton = (Button) view.findViewById(R.id.userCancelButton); }
public void setupRadioGroupCheckedListener() { radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { qa.setAnswer(getAnswer()); daoSession.getSocTestDao().update(socTest); displayNextFragment(); } }); }
@Override public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { switch (checkedId) { case R.id.radioButton_test_qq_activity_style_activity: setActivityStyle(); break; case R.id.radioButton_test_qq_activity_style_normal: setNormalStyle(); break; } }
@Override public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { RadioButton checkedRadioButton = (RadioButton) group.findViewById(checkedId); String text = checkedRadioButton.getText().toString().trim(); currentMoney = Integer.valueOf(text.replace("元", "").trim()); btAlipayCustom.setText("支付宝捐赠(" + currentMoney + "元)"); }
public void riskButtonListener(View v) { RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radio_group); RadioButton radioButton = (RadioButton) findViewById(R.id.radio_yes); TextView message = (TextView) findViewById(R.id.risk_validation); if (radioGroup.getCheckedRadioButtonId() != -1) { message.setVisibility(View.INVISIBLE); mRisk = radioGroup.getCheckedRadioButtonId() == radioButton.getId(); nextPage(); } else { message.setVisibility(View.VISIBLE); } }
public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.yes: mRisk = true; break; case R.id.no: mRisk = false; break; default: break; } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialog_remind_fr); /*findViewById(R.id.drf_cancel).setOnClickListener(this); findViewById(R.id.drf_confirm).setOnClickListener(this);*/ RadioGroup rg = (RadioGroup) findViewById(R.id.remind_fr_buttons); rg.check(map[fr]); rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { for (int i = 0; i < map.length; i++) { if (map[i] == checkedId) { fr = i; if (onResultListener != null) { onResultListener.onResult(fr); } cancel(); return; } } } }); //取消按钮点击监听 TextView cancle = (TextView) findViewById(R.id.tv_cancel); cancle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RemindFrDialog.this.cancel(); } }); ((RadioButton) findViewById(R.id.remind_fr9)).setText(AssistUtils.translateRemindFrequency(9, date)); ((RadioButton) findViewById(R.id.remind_fr10)).setText(AssistUtils.translateRemindFrequency(10, date)); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_remind_fr); intent=getIntent(); if(intent!=null){ type=intent.getIntExtra(TYPE, 0); date.setTimeInMillis(intent.getLongExtra(DATE, System.currentTimeMillis())); } RadioGroup rg=(RadioGroup) findViewById(R.id.remind_fr_buttons); rg.check(map[type]); rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { for(int i=0;i<map.length;i++){ if(map[i]==checkedId){ type=i; return; } } } }); ((RadioButton)findViewById(R.id.remind_fr9)).setText(AssistUtils.translateRemindFrequency(9,date)); ((RadioButton)findViewById(R.id.remind_fr10)).setText(AssistUtils.translateRemindFrequency(10,date)); findViewById(R.id.arf_back).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(intent!=null){ intent.putExtra(TYPE, type); setResult(FOR_FR, intent); } goBack(); } }); }