android.widget.RadioGroup#getCheckedRadioButtonId ( )源码实例Demo

下面列出了android.widget.RadioGroup#getCheckedRadioButtonId ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: QNRTC-Android   文件: MainActivity.java
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    switch (group.getCheckedRadioButtonId()) {
        case R.id.camera_capture_button:
            mCaptureMode = Config.CAMERA_CAPTURE;
            break;
        case R.id.screen_capture_button:
            mCaptureMode = Config.SCREEN_CAPTURE;
            break;
        case R.id.audio_capture_button:
            mCaptureMode = Config.ONLY_AUDIO_CAPTURE;
            break;
        case R.id.muti_track_button:
            mCaptureMode = Config.MUTI_TRACK_CAPTURE;
            break;
    }
}
 
源代码2 项目: QNRTC-Android   文件: SettingActivity.java
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    switch (group.getCheckedRadioButtonId()) {
        case R.id.hw_radio_button:
            mEncodeMode = Config.HW;
            mMaintainResRadioGroup.setVisibility(View.GONE);
            break;
        case R.id.sw_radio_button:
            mEncodeMode = Config.SW;
            mMaintainResRadioGroup.setVisibility(View.VISIBLE);
            break;
        case R.id.low_sample_rate_button:
            mSampleRatePos = Config.LOW_SAMPLE_RATE;
            break;
        case R.id.high_sample_rate_button:
            mSampleRatePos = Config.HIGH_SAMPLE_RATE;
            break;
    }
}
 
源代码3 项目: WindView   文件: MainActivity.java
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
    switch (radioGroup.getCheckedRadioButtonId()) {
        case R.id.rv_up:
            windView.setTrendType(TrendType.UP);
            windView.start();
            break;
        case R.id.rv_down:
            windView.setTrendType(TrendType.DOWN);
            windView.start();
            break;
        case R.id.rv_none:
            windView.setTrendType(TrendType.NONE);
            windView.start();
            break;
    }

}
 
@Nullable
private String getSelectedAge(RadioGroup rgAge) {
    String age = null;

    switch (rgAge.getCheckedRadioButtonId()) {
        case R.id.young:
            age = "Young";
            break;
        case R.id.middle:
            age = "Middle";
            break;
        case R.id.old:
            age = "Old";
            break;
    }
    return age;
}
 
源代码5 项目: tuxguitar   文件: TGTremoloPickingDialog.java
public int findSelectedDuration() {
	RadioGroup optionsGroup = (RadioGroup) this.getView().findViewById(R.id.tremolo_picking_dlg_duration_group);
	
	int radioButtonId = optionsGroup.getCheckedRadioButtonId();
	if( radioButtonId != -1 ) {
		RadioButton radioButton = (RadioButton) optionsGroup.findViewById(radioButtonId);
		if( radioButton != null ) {
			return ((Integer)radioButton.getTag()).intValue();
		}
	}
	return TGDuration.EIGHTH;
}
 
源代码6 项目: QNRTC-Android   文件: SettingActivity.java
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    switch (group.getCheckedRadioButtonId()) {
        case R.id.maintain_res_button_yes:
            mMaintainResolution = true;
            break;
        case R.id.maintain_res_button_no:
            mMaintainResolution = false;
            break;
    }
}
 
private boolean decryptIdentityInternal(SQRLStorage storage, boolean useQuickPass) {
    final RadioGroup radgrpAccountOptions = findViewById(R.id.radgrpAccountOptions);

    if (radgrpAccountOptions.getCheckedRadioButtonId() == R.id.radEnableAccount ||
            radgrpAccountOptions.getCheckedRadioButtonId() == R.id.radRemoveAccount) {

        try {
            if (!storage.decryptUnlockKey(mRescueCodeInputHelper.getRescueCodeInput())) {
                showErrorMessage(R.string.decrypt_identity_fail);
                handler.post(() -> hideProgressPopup());
                return false;
            }
            storage.reInitializeMasterKeyIdentity();
            return true;
        } catch (Exception e) {
            showErrorMessage(e.getMessage());
            Log.e(TAG, e.getMessage(), e);
            this.closeActivity();
            storage.clear();
            storage.clearQuickPass();
            return false;
        } finally {
            handler.post(() -> mRescueCodeInputHelper.clearForm());
        }
    } else {
        if(!storage.decryptIdentityKey(txtLoginPassword.getText().toString(), entropyHarvester, useQuickPass)) {
            showErrorMessage(R.string.decrypt_identity_fail);
            handler.post(() -> {
                txtLoginPassword.setHint(R.string.login_identity_password);
                txtLoginPassword.setText("");
                hideProgressPopup();
            });
            storage.clear();
            storage.clearQuickPass();
            return false;
        }
        return true;
    }
}
 
源代码8 项目: sealrtc-android   文件: CallSettingsFragment.java
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {

    switch (radioGroup.getCheckedRadioButtonId()) {
        case R.id.rb_call_settings_tab_video:
            {
                pvCallSettingsPager.showVideoPager();
                break;
            }
        case R.id.rb_call_settings_tab_audio:
            {
                Log.d(TAG, "onCheckedChanged: rb_call_settings_tab_audio");
                pvCallSettingsPager.showAudioPager();
                pvCallSettingsPager.setAudioOn(
                        SessionManager.getInstance()
                                .getBoolean(
                                        SettingActivity.IS_AUDIO_MUSIC,
                                        getResources()
                                                .getBoolean(R.bool.def_audio_music_mode)));
                break;
            }

        case R.id.rb_call_settings_tab_other:
            {
                Log.d(TAG, "onCheckedChanged: rb_call_settings_tab_other");
                pvCallSettingsPager.showOtherPager();
                break;
            }
        default:
            {
            }
    }
}
 
源代码9 项目: habpanelviewer   文件: IntroActivity.java
@Override
public boolean isPolicyRespected() {
    View v = getView();
    if (v != null) {
        final RadioGroup rg = getView().findViewById(R.id.intro_discover_radioGroup);
        return rg.getCheckedRadioButtonId() != -1;
    }

    return true;
}
 
private int getThemeOverlayResId(RadioGroup radioGroup) {
  if (radioGroup.getCheckedRadioButtonId() == View.NO_ID) {
    return 0;
  }

  ThemeAttributeValues overlayFeature =
        (ThemeAttributeValues)
            getDialog().findViewById(radioGroup.getCheckedRadioButtonId()).getTag();

  return overlayFeature.themeOverlay;
}
 
/**
 * Returns a {@link NotificationVisibility} depending on which RadioButton in the radiogroup
 * is selected.
 *
 * @param radiogroup The RadioGroup.
 * @return The instance of {@link NotificationVisibility} corresponding to RadioButton.
 */
private NotificationVisibility getVisibilityFromSelectedRadio(RadioGroup radiogroup) {
    switch (radiogroup.getCheckedRadioButtonId()) {
        case R.id.visibility_public_radio_button:
            return NotificationVisibility.PUBLIC;
        case R.id.visibility_private_radio_button:
            return NotificationVisibility.PRIVATE;
        case R.id.visibility_secret_radio_button:
            return NotificationVisibility.SECRET;
        default:
            //If not selected, returns PUBLIC as default.
            return NotificationVisibility.PUBLIC;
    }
}
 
源代码12 项目: tuxguitar   文件: TGStrokeDialog.java
public int findSelectedDuration() {
	RadioGroup radioGroup = (RadioGroup) this.getView().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;
}
 
源代码13 项目: tuxguitar   文件: TGMeasurePasteDialog.java
public int findSelectedMode() {
	RadioGroup optionsGroup = (RadioGroup) this.getView().findViewById(R.id.measure_paste_dlg_options_group);
	
	int radioButtonId = optionsGroup.getCheckedRadioButtonId();
	if( radioButtonId != -1 ) {
		RadioButton radioButton = (RadioButton) optionsGroup.findViewById(radioButtonId);
		if( radioButton != null ) {
			return ((Integer)radioButton.getTag()).intValue();
		}
	}
	return 1;
}
 
源代码14 项目: AndroidHeros   文件: MainActivity.java
public void visibilityNotify(View view){
    RadioGroup radioGroup = (RadioGroup) findViewById(R.id.visibility_radio_group);
    Notification.Builder builder = new Notification.Builder(this).
            setContentTitle("Notification for Visibility Test");
    switch (radioGroup.getCheckedRadioButtonId()){
        case R.id.radio_button_public:
            builder.setVisibility(Notification.VISIBILITY_PUBLIC);
            builder.setContentText("Public");
            builder.setSmallIcon(R.mipmap.ic_public);
            break;
        case R.id.radio_button_private:
            builder.setVisibility(Notification.VISIBILITY_PRIVATE);
            builder.setContentText("Private");
            builder.setSmallIcon(R.mipmap.ic_private);
            break;
        case R.id.radio_button_secret:
            builder.setVisibility(Notification.VISIBILITY_SECRET);
            builder.setContentText("Secret");
            builder.setSmallIcon(R.mipmap.ic_secret);
            break;
        default:
            break;
    }

    NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    notificationManager.notify(NOTIFICATION_ID_VISIBILITY, builder.build());
}
 
源代码15 项目: tuxguitar   文件: TGGraceDialog.java
public boolean findSelectedOnBeat() {
	RadioGroup radioGroup = (RadioGroup) this.getView().findViewById(R.id.grace_dlg_position_group);
	int radioButtonId = radioGroup.getCheckedRadioButtonId();
	if( radioButtonId != -1 ) {
		RadioButton radioButton = (RadioButton) radioGroup.findViewById(radioButtonId);
		if( radioButton != null ) {
			return ((Boolean)radioButton.getTag()).booleanValue();
		}
	}
	return false;
}
 
源代码16 项目: tuxguitar   文件: TGTripletFeelDialog.java
public Integer parseTripletFeelValue() {
	RadioGroup radioGroup = (RadioGroup) this.getView().findViewById(R.id.triplet_feel_dlg_value);
	int radioButtonId = radioGroup.getCheckedRadioButtonId();
	if( radioButtonId != -1 ) {
		RadioButton radioButton = (RadioButton) radioGroup.findViewById(radioButtonId);
		if( radioButton != null ) {
			return ((Integer)radioButton.getTag()).intValue();
		}
	}
	return TGMeasureHeader.TRIPLET_FEEL_NONE;
}
 
源代码17 项目: tuxguitar   文件: TGTempoDialog.java
public Integer parseApplyTo() {
	RadioGroup radioGroup = (RadioGroup) this.getView().findViewById(R.id.tempo_dlg_options_group);

	int radioButtonId = radioGroup.getCheckedRadioButtonId();
	if( radioButtonId != -1 ) {
		RadioButton radioButton = (RadioButton) radioGroup.findViewById(radioButtonId);
		if( radioButton != null ) {
			return ((Integer)radioButton.getTag()).intValue();
		}
	}
	return TGChangeTempoRangeAction.APPLY_TO_ALL;
}
 
源代码18 项目: android-testdpc   文件: AddAccountActivity.java
public void onNavigateNext(View nextButton) {
    RadioGroup addAccountOptions = findViewById(R.id.add_account_options);
    switch (addAccountOptions.getCheckedRadioButtonId()) {
        case R.id.add_account:
            addAccount(null);
            break;
        case R.id.add_account_with_name:
            final View view = getLayoutInflater().inflate(R.layout.simple_edittext, null);
            new AlertDialog.Builder(this)
                    .setTitle(R.string.add_account_dialog_title)
                    .setView(view)
                    .setPositiveButton(android.R.string.ok,
                            (dialogInterface, i) -> {
                                EditText editText = (EditText) view.findViewById(
                                        R.id.input);
                                String accountName = editText.getText().toString();
                                addAccount(accountName);
                            })
                    .show();
            break;
        case R.id.add_account_skip:
            if (mNextActivityIntent != null) {
                startActivity(mNextActivityIntent);
            }
            finish();
            break;
    }
}
 
public OnRadioButtonCheckedChangeListener(RadioGroup radioGroup) {
    this.checkedId = radioGroup.getCheckedRadioButtonId();
}
 
源代码20 项目: medical-data-android   文件: ProfileActivity.java
/**
 * To update the user's personal information. It checks that that the PIN is correct and, in
 * that case, saves the data in the database and the app and finishes. A {@link Toast} message
 * is used to inform the user if the data has been successfully updated or there has been any
 * problem while connecting with the database.
 *
 * @param view the clicked {@link View}.
 * @see #finish()
 * @see TextView#setError(CharSequence)
 * @see EditText#setError(CharSequence)
 */
public void btnFinish(View view) {
    boolean error = false;

    // check name correction
    EditText name = (EditText) findViewById(R.id.name_answer);
    String name_text = name.getText().toString();
    if (name_text.equals("")) {
        name.setError(getString(R.string.name_blank));
        focusFirstError(name, R.id.name);
        error = true;
    }

    // check email correction
    EditText email = (EditText) findViewById(R.id.email_answer);
    String email_text = email.getText().toString();
    if (email_text.equals("")) {
        email.setError(getString(R.string.email_blank));
        if (!error) {
            focusFirstError(email, R.id.email);
            error = true;
        }
    } else if (!email_text.matches(Variables.emailPattern)) {
        email.setError(getString(R.string.email_format));
        if (!error) {
            focusFirstError(email, R.id.email);
            error = true;
        }
    }

    // check PIN correction
    EditText pin = (EditText) findViewById(R.id.pin_answer);
    String pin_text = pin.getText().toString();
    int pin_number = settings.getInt("pin", -1);
    String original_pin = String.valueOf(pin_number);
    if (!pin_text.equals(original_pin)) {
        pin.setError(getString(R.string.incorrect_pin));
        if (!error) {
            focusFirstError(pin, R.id.pin);
            error = true;
        }
    }

    // ¿Everything correct?
    if (!error) {
        String user_id = settings.getString("user_id", "");
        DatePicker birthDate = (DatePicker) findViewById(R.id.age_answer);
        // gender = false => male, gender = true => female
        RadioGroup radioGroup = (RadioGroup) findViewById(R.id.gender_answer);
        boolean gender = radioGroup.getCheckedRadioButtonId() == R.id.radio_female;
        User user = new User(
                email_text,
                name_text,
                pin_number,
                birthDate.getDayOfMonth(),
                birthDate.getMonth(),
                birthDate.getYear(),
                gender,
                user_id);

        //Save changes in the server database
        try {
            UpdateRegistration runner = new UpdateRegistration();
            runner.execute(user);
            int option = runner.get();
            if (option == 0) {
                // Save register in the app
                user.save(this);
                // Feedback: update profile has been completed
                Toast.makeText(this, R.string.changes_saved, Toast.LENGTH_LONG).show();
            } else if (option == 1) {
                Toast.makeText(this, R.string.repeated_email2, Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(this, R.string.update_error, Toast.LENGTH_LONG).show();
            }
        } catch (Exception e) {
            Toast.makeText(this, R.string.update_error, Toast.LENGTH_LONG).show();
        }

        Variables.hideKeyboard(this);
        finish();
    }
}