Example usage for android.widget RadioGroup check

List of usage examples for android.widget RadioGroup check

Introduction

In this page you can find the example usage for android.widget RadioGroup check.

Prototype

public void check(@IdRes int id) 

Source Link

Document

Sets the selection to the radio button whose identifier is passed in parameter.

Usage

From source file:com.ultrafunk.network_info.config.ConfigActivity.java

private void initShowWidgetView() {
    RadioGroup showWidgetRadioGroup = (RadioGroup) findViewById(R.id.showWidgetRadioGroup);

    if (widgetConfig.showBothWidgets())
        showWidgetRadioGroup.check(R.id.showBothRadioButton);
    else if (widgetConfig.showMobileDataWidget())
        showWidgetRadioGroup.check(R.id.showMobileRadioButton);
    else//from  ww w.  j a v a2 s  . com
        showWidgetRadioGroup.check(R.id.showWifiRadioButton);

    showWidgetRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
            RelativeLayout mobileSettingsScreenRelativeLayout = (RelativeLayout) findViewById(
                    R.id.mobileSettingsScreenRelativeLayout);

            widgetConfig.setBothWidgets(false);

            if (checkedId == R.id.showBothRadioButton) {
                widgetConfig.setBothWidgets(true);
                mobileSettingsScreenRelativeLayout.setVisibility(View.VISIBLE);
            }

            if (checkedId == R.id.showMobileRadioButton) {
                widgetConfig.setMobileDataWidget(true);
                mobileSettingsScreenRelativeLayout.setVisibility(View.VISIBLE);
            }

            if (checkedId == R.id.showWifiRadioButton) {
                widgetConfig.setWifiWidget(true);
                mobileSettingsScreenRelativeLayout.setVisibility(View.GONE);
            }
        }
    });
}

From source file:org.readium.sdk.android.launcher.ViewerSettingsDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    LayoutInflater inflater = getActivity().getLayoutInflater();

    final View dialogView = inflater.inflate(R.layout.viewer_settings, null);

    final RadioGroup spreadGroup = (RadioGroup) dialogView.findViewById(R.id.spreadSettings);
    switch (mOriginalSettings.getSyntheticSpreadMode()) {
    case AUTO:// w  ww .  j  av a2 s  . co  m
        spreadGroup.check(R.id.spreadAuto);
        break;
    case DOUBLE:
        spreadGroup.check(R.id.spreadDouble);
        break;
    case SINGLE:
        spreadGroup.check(R.id.spreadSingle);
        break;
    }

    final RadioGroup scrollGroup = (RadioGroup) dialogView.findViewById(R.id.scrollSettings);
    switch (mOriginalSettings.getScrollMode()) {
    case AUTO:
        scrollGroup.check(R.id.scrollAuto);
        break;
    case DOCUMENT:
        scrollGroup.check(R.id.scrollDocument);
        break;
    case CONTINUOUS:
        scrollGroup.check(R.id.scrollContinuous);
        break;
    }

    final EditText fontSizeText = (EditText) dialogView.findViewById(R.id.fontSize);
    fontSizeText.setText("" + mOriginalSettings.getFontSize());

    final EditText columnGapText = (EditText) dialogView.findViewById(R.id.columnGap);
    columnGapText.setText("" + mOriginalSettings.getColumnGap());

    builder.setView(dialogView).setTitle(R.string.settings)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    if (mListener != null) {
                        int fontSize = parseString(fontSizeText.getText().toString(), 100);
                        int columnGap = parseString(columnGapText.getText().toString(), 20);

                        ViewerSettings.SyntheticSpreadMode syntheticSpreadMode = null;
                        switch (spreadGroup.getCheckedRadioButtonId()) {
                        case R.id.spreadAuto:
                            syntheticSpreadMode = ViewerSettings.SyntheticSpreadMode.AUTO;
                            break;
                        case R.id.spreadSingle:
                            syntheticSpreadMode = ViewerSettings.SyntheticSpreadMode.SINGLE;
                            break;
                        case R.id.spreadDouble:
                            syntheticSpreadMode = ViewerSettings.SyntheticSpreadMode.DOUBLE;
                            break;
                        }

                        ViewerSettings.ScrollMode scrollMode = null;
                        switch (scrollGroup.getCheckedRadioButtonId()) {
                        case R.id.scrollAuto:
                            scrollMode = ViewerSettings.ScrollMode.AUTO;
                            break;
                        case R.id.scrollDocument:
                            scrollMode = ViewerSettings.ScrollMode.DOCUMENT;
                            break;
                        case R.id.scrollContinuous:
                            scrollMode = ViewerSettings.ScrollMode.CONTINUOUS;
                            break;
                        }

                        ViewerSettings settings = new ViewerSettings(syntheticSpreadMode, scrollMode, fontSize,
                                columnGap);
                        mListener.onViewerSettingsChange(settings);
                    }
                    dismiss();
                }

                private int parseString(String s, int defaultValue) {
                    try {
                        return Integer.parseInt(s);
                    } catch (Exception e) {
                        Log.e(TAG, "" + e.getMessage(), e);
                    }
                    return defaultValue;
                }
            }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dismiss();
                }
            });

    return builder.create();
}

From source file:com.ubuntuone.android.files.fragment.AutoUploadSetupFragment.java

private void selectInitialAutoUploadMode(RadioGroup autoUploadMode) {
    final boolean autoUploadEnabled = Preferences.getBoolean(Preferences.PHOTO_UPLOAD_ENABLED_KEY, false);
    final boolean autoUploadWifiOnly = Preferences.getBoolean(Preferences.PHOTO_UPLOAD_ONLY_ON_WIFI, false);

    if (!autoUploadEnabled) {
        autoUploadMode.check(R.id.auto_upload_on_none);
    } else {/*w  w w  . ja va  2 s .  co m*/
        if (autoUploadWifiOnly) {
            autoUploadMode.check(R.id.auto_upload_on_wifi);
        } else {
            autoUploadMode.check(R.id.auto_upload_on_both);
        }
    }
}

From source file:org.deviceconnect.android.deviceplugin.host.activity.KeyEventProfileActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.keyevent_main);

    // Get Application class instance.
    mApp = (HostDeviceApplication) this.getApplication();

    // Set button touchlistener. (Ten Key Emulated)
    findViewById(R.id.button_0).setOnTouchListener(this);
    findViewById(R.id.button_1).setOnTouchListener(this);
    findViewById(R.id.button_2).setOnTouchListener(this);
    findViewById(R.id.button_3).setOnTouchListener(this);
    findViewById(R.id.button_4).setOnTouchListener(this);
    findViewById(R.id.button_5).setOnTouchListener(this);
    findViewById(R.id.button_6).setOnTouchListener(this);
    findViewById(R.id.button_7).setOnTouchListener(this);
    findViewById(R.id.button_8).setOnTouchListener(this);
    findViewById(R.id.button_9).setOnTouchListener(this);
    findViewById(R.id.button_dot).setOnTouchListener(this);
    findViewById(R.id.button_enter).setOnTouchListener(this);
    findViewById(R.id.button_keyevent_close).setOnTouchListener(this);

    RadioGroup radioGroup = (RadioGroup) findViewById(R.id.RadioGroup);
    // Set default select radio button.
    radioGroup.check(R.id.radioButton1);
    mKeyMode = KeyMode.STD_KEY;//from w  w w.  j ava 2s .c o  m
    // set radiogroup changelistener
    radioGroup.setOnCheckedChangeListener(this);

    // Get serviceId.
    Intent intent = getIntent();
    mServiceId = intent.getStringExtra(DConnectMessage.EXTRA_SERVICE_ID);
}

From source file:org.readium.sdk.android.biblemesh.ViewerSettingsDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    mListener = (OnViewerSettingsChange) getArguments().getSerializable("listener");
    mOriginalSettings = (ViewerSettings) getArguments().getSerializable("settings");

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    LayoutInflater inflater = getActivity().getLayoutInflater();

    final View dialogView = inflater.inflate(R.layout.viewer_settings, null);

    final RadioGroup spreadGroup = (RadioGroup) dialogView.findViewById(R.id.spreadSettings);
    switch (mOriginalSettings.getSyntheticSpreadMode()) {
    case AUTO://from  www .ja va2s  .co m
        spreadGroup.check(R.id.spreadAuto);
        break;
    case DOUBLE:
        spreadGroup.check(R.id.spreadDouble);
        break;
    case SINGLE:
        spreadGroup.check(R.id.spreadSingle);
        break;
    }

    final RadioGroup scrollGroup = (RadioGroup) dialogView.findViewById(R.id.scrollSettings);
    switch (mOriginalSettings.getScrollMode()) {
    case AUTO:
        scrollGroup.check(R.id.scrollAuto);
        break;
    case DOCUMENT:
        scrollGroup.check(R.id.scrollDocument);
        break;
    case CONTINUOUS:
        scrollGroup.check(R.id.scrollContinuous);
        break;
    }

    final EditText fontSizeText = (EditText) dialogView.findViewById(R.id.fontSize);
    fontSizeText.setText("" + mOriginalSettings.getFontSize());

    final EditText columnGapText = (EditText) dialogView.findViewById(R.id.columnGap);
    columnGapText.setText("" + mOriginalSettings.getColumnGap());

    final Button minusFont = (Button) dialogView.findViewById(R.id.minusbutton);
    minusFont.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Integer f = Integer.parseInt(fontSizeText.getText().toString());
            f -= 10;
            if (f > 0) {
                fontSizeText.setText(f.toString());
            }
        }
    });

    final Button plusFont = (Button) dialogView.findViewById(R.id.plusbutton);
    plusFont.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Integer f = Integer.parseInt(fontSizeText.getText().toString());
            f += 10;
            fontSizeText.setText(f.toString());
        }
    });

    builder.setView(dialogView).setTitle(R.string.settings)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    if (mListener != null) {
                        int fontSize = parseString(fontSizeText.getText().toString(), 100);
                        int columnGap = parseString(columnGapText.getText().toString(), 20);

                        ViewerSettings.SyntheticSpreadMode syntheticSpreadMode = null;
                        switch (spreadGroup.getCheckedRadioButtonId()) {
                        case R.id.spreadAuto:
                            syntheticSpreadMode = ViewerSettings.SyntheticSpreadMode.AUTO;
                            break;
                        case R.id.spreadSingle:
                            syntheticSpreadMode = ViewerSettings.SyntheticSpreadMode.SINGLE;
                            break;
                        case R.id.spreadDouble:
                            syntheticSpreadMode = ViewerSettings.SyntheticSpreadMode.DOUBLE;
                            break;
                        }

                        ViewerSettings.ScrollMode scrollMode = null;
                        switch (scrollGroup.getCheckedRadioButtonId()) {
                        case R.id.scrollAuto:
                            scrollMode = ViewerSettings.ScrollMode.AUTO;
                            break;
                        case R.id.scrollDocument:
                            scrollMode = ViewerSettings.ScrollMode.DOCUMENT;
                            break;
                        case R.id.scrollContinuous:
                            scrollMode = ViewerSettings.ScrollMode.CONTINUOUS;
                            break;
                        }

                        ViewerSettings settings = new ViewerSettings(syntheticSpreadMode, scrollMode, fontSize,
                                columnGap);
                        mListener.onViewerSettingsChange(settings);
                    }
                    dismiss();
                }

                private int parseString(String s, int defaultValue) {
                    try {
                        return parseInt(s);
                    } catch (Exception e) {
                        Log.e(TAG, "" + e.getMessage(), e);
                    }
                    return defaultValue;
                }
            }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dismiss();
                }
            });

    return builder.create();
}

From source file:com.mbientlab.metawear.app.HomeFragment.java

private void setupFragment(final View v) {
    final String METABOOT_WARNING_TAG = "metaboot_warning_tag", SWITCH_STREAM = "switch_stream";

    if (!mwBoard.isConnected()) {
        return;//  w w w .j  a v  a2  s  .  com
    }

    if (mwBoard.inMetaBootMode()) {
        if (getFragmentManager().findFragmentByTag(METABOOT_WARNING_TAG) == null) {
            new MetaBootWarningFragment().show(getFragmentManager(), METABOOT_WARNING_TAG);
        }
    } else {
        DialogFragment metabootWarning = (DialogFragment) getFragmentManager()
                .findFragmentByTag(METABOOT_WARNING_TAG);
        if (metabootWarning != null) {
            metabootWarning.dismiss();
        }
    }

    mwBoard.readDeviceInformation().onComplete(new AsyncOperation.CompletionHandler<DeviceInformation>() {
        @Override
        public void success(DeviceInformation result) {
            ((TextView) v.findViewById(R.id.manufacturer_value)).setText(result.manufacturer());
            ((TextView) v.findViewById(R.id.model_number_value)).setText(result.modelNumber());
            ((TextView) v.findViewById(R.id.serial_number_value)).setText(result.serialNumber());
            ((TextView) v.findViewById(R.id.firmware_revision_value)).setText(result.firmwareRevision());
            ((TextView) v.findViewById(R.id.hardware_revision_value)).setText(result.hardwareRevision());
            ((TextView) v.findViewById(R.id.device_mac_address_value)).setText(mwBoard.getMacAddress());
        }
    });

    try {
        Switch switchModule = mwBoard.getModule(Switch.class);
        switchModule.routeData().fromSensor().stream(SWITCH_STREAM).commit()
                .onComplete(new AsyncOperation.CompletionHandler<RouteManager>() {
                    @Override
                    public void success(RouteManager result) {
                        result.subscribe(SWITCH_STREAM, new RouteManager.MessageHandler() {
                            @Override
                            public void process(Message msg) {
                                RadioGroup radioGroup = (RadioGroup) v.findViewById(R.id.switch_radio_group);

                                if (msg.getData(Boolean.class)) {
                                    radioGroup.check(R.id.switch_radio_pressed);
                                } else {
                                    radioGroup.check(R.id.switch_radio_released);
                                }
                            }
                        });
                    }
                });
    } catch (UnsupportedModuleException ignored) {
    }

    int[] ledResIds = new int[] { R.id.led_stop, R.id.led_red_on, R.id.led_green_on, R.id.led_blue_on };

    try {
        ledModule = mwBoard.getModule(Led.class);

        for (int id : ledResIds) {
            v.findViewById(id).setEnabled(true);
        }
    } catch (UnsupportedModuleException e) {
        for (int id : ledResIds) {
            v.findViewById(id).setEnabled(false);
        }
    }
}

From source file:com.christophergs.mbientbasic.HomeFragment.java

private void setupFragment(final View v) {
    final String METABOOT_WARNING_TAG = "metaboot_warning_tag", SWITCH_STREAM = "switch_stream";

    if (!mwBoard.isConnected()) {
        return;/*from ww w  .  ja va2s  .  c om*/
    }

    if (mwBoard.inMetaBootMode()) {
        if (getFragmentManager().findFragmentByTag(METABOOT_WARNING_TAG) == null) {
            new MetaBootWarningFragment().show(getFragmentManager(), METABOOT_WARNING_TAG);
        }
    } else {
        DialogFragment metabootWarning = (DialogFragment) getFragmentManager()
                .findFragmentByTag(METABOOT_WARNING_TAG);
        if (metabootWarning != null) {
            metabootWarning.dismiss();
        }
    }

    mwBoard.readDeviceInformation().onComplete(new AsyncOperation.CompletionHandler<DeviceInformation>() {
        @Override
        public void success(DeviceInformation result) {
            ((TextView) v.findViewById(R.id.manufacturer_value)).setText(result.manufacturer());
            ((TextView) v.findViewById(R.id.model_number_value)).setText(result.modelNumber());
            ((TextView) v.findViewById(R.id.serial_number_value)).setText(result.serialNumber());
            ((TextView) v.findViewById(R.id.firmware_revision_value)).setText(result.firmwareRevision());
            ((TextView) v.findViewById(R.id.hardware_revision_value)).setText(result.hardwareRevision());
            ((TextView) v.findViewById(R.id.device_mac_address_value)).setText(mwBoard.getMacAddress());
        }
    });

    try {
        Switch switchModule = mwBoard.getModule(Switch.class);
        switchModule.routeData().fromSensor().stream(SWITCH_STREAM).commit()
                .onComplete(new AsyncOperation.CompletionHandler<RouteManager>() {
                    @Override
                    public void success(RouteManager result) {
                        result.subscribe(SWITCH_STREAM, new RouteManager.MessageHandler() {
                            @Override
                            public void process(Message msg) {
                                RadioGroup radioGroup = (RadioGroup) v.findViewById(R.id.switch_radio_group);

                                if (msg.getData(Boolean.class)) {
                                    radioGroup.check(R.id.switch_radio_pressed);
                                    v.findViewById(R.id.switch_radio_pressed).setEnabled(true);
                                    v.findViewById(R.id.switch_radio_released).setEnabled(false);
                                } else {
                                    radioGroup.check(R.id.switch_radio_released);
                                    v.findViewById(R.id.switch_radio_released).setEnabled(true);
                                    v.findViewById(R.id.switch_radio_pressed).setEnabled(false);
                                }
                            }
                        });
                    }
                });
    } catch (UnsupportedModuleException ignored) {
    }

    int[] ledResIds = new int[] { R.id.led_stop, R.id.led_red_on, R.id.led_green_on, R.id.led_blue_on };

    try {
        ledModule = mwBoard.getModule(Led.class);

        for (int id : ledResIds) {
            v.findViewById(id).setEnabled(true);
        }
    } catch (UnsupportedModuleException e) {
        for (int id : ledResIds) {
            v.findViewById(id).setEnabled(false);
        }
    }
}

From source file:com.tbay.android.FrequentSMS.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout);/*from w w  w.j  a  va 2s .c o m*/

    // Initialize the logging framework.
    initializeLogging();

    // Check if permissions are set, otherwise exit app.
    if (ActivityCompat.checkSelfPermission(this,
            android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {

        Toast.makeText(MainActivity.this, "Please set ACCESS_FINE_LOCATION permission", Toast.LENGTH_LONG)
                .show();

        finish();
        return;
    }

    // Get selection from shared Preferences. The preference is set when selecting a radiobutton.
    // Then set the text in the editable field to the last selected text (currently a default text)
    mAppPrefs = new AppPreferences(getApplicationContext());

    RadioGroup rg = (RadioGroup) findViewById(R.id.whichSMS);

    RadioButton rb = (RadioButton) rg.getChildAt(mAppPrefs.SelectionId);
    rg.check(rb.getId());
    setText(mAppPrefs.SelectionId);

    // Create an instance of GoogleAPIClient.
    if (mGoogleApiClient == null) {
        mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this).addApi(LocationServices.API).build();
    }

    // Create a message handler
    // Currently not in use but keep for future projects.
    UIMsgHandler handler = new UIMsgHandler(TAG);

    // Register context menu for radio button group
    registerForContextMenu(rg);

    mReceiver = new MyBCreceiver();
}

From source file:com.metinkale.prayerapp.vakit.PrefsView.java

@Override
public void onClick(View v) {
    Object o = getValue();//from  w ww  .j  av a  2 s  .com
    if ((mPref == Pref.Sound) || (mPref == Pref.Dua) || (mPref == Pref.Sela)) {
        new SoundChooser().showExpanded(((Activity) getContext()).getFragmentManager(), new Callback() {

            @Override
            public String getCurrent() {
                return (String) getValue();
            }

            @Override
            public void setCurrent(String current) {
                setValue(current);

            }

            @Override
            public Vakit getVakit() {
                return mVakit;
            }

            @Override
            public List<Sound> getSounds() {
                if (mPref == Pref.Sound) {
                    return Sounds.getSounds(mVakit);
                } else if (mPref == Pref.Dua) {
                    return Sounds.getSounds("dua", "extra");
                } else if (mPref == Pref.Sela) {
                    return Sounds.getSounds("sela", "extra");
                }

                return Sounds.getSounds(mVakit);
            }

        });

    } else if (mPref == Pref.SabahTime) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
        LayoutInflater inflater = LayoutInflater.from(getContext());
        View view = inflater.inflate(R.layout.sabahtime_dialog, null);
        final NumberPicker np = (NumberPicker) view.findViewById(R.id.number_picker);
        final RadioGroup rg = (RadioGroup) view.findViewById(R.id.rg);

        int val = (Integer) getValue();
        np.setMinValue(0);
        np.setMaxValue(300);
        np.setValue(Math.abs(val));

        rg.check((val < 0) ? R.id.afterImsak : R.id.beforeGunes);
        builder.setView(view).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int id) {
                setValue(np.getValue() * ((rg.getCheckedRadioButtonId() == R.id.beforeGunes) ? 1 : -1));
            }
        }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int id) {
            }
        });
        builder.show();
    } else if (mPref == Pref.Vibration2) {
        int i = (Integer) o;
        i++;
        if ((i < -1) || (i > 1)) {
            i = -1;
        }
        setValue(i);
        performHapticFeedback(HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING
                | HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
    } else if (o instanceof Boolean) {
        setValue(!(Boolean) o);
        performHapticFeedback(HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING
                | HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
    } else if (o instanceof Integer) {
        int titleId = 0;
        switch (mPref) {
        case Silenter:
            PermissionUtils.get(getContext()).needNotificationPolicy((Activity) getContext());
            titleId = R.string.silenterDuration;
            break;
        case Time:
            titleId = R.string.time;
            break;
        default:
            break;
        }
        NumberPickerDialog npd = new NumberPickerDialog(getContext(), new OnNumberSetListener() {

            @Override
            public void onNumberSet(int dialogId, int number) {
                setValue(number);

            }
        }, (Integer) o, 0, 300, titleId, 0, 0);
        npd.show();
    }

}

From source file:com.kubotaku.android.sample.sensordataviewer.fragments.SelectStreamTimeFragment.java

@Override
protected void setupViews() {

    loadSelectTimeSettings();/* w w  w .  ja  v  a  2s . co  m*/

    final View v = getView();

    RadioGroup rgType = (RadioGroup) v.findViewById(R.id.select_time_rg_type);
    rgType.setOnCheckedChangeListener(onTypeCheckedChangeListener);

    switch (this.selectTimeType) {
    default:
    case AppPreferences.SELECT_TIME_TYPE_PRESET:
        rgType.check(R.id.select_time_rb_preset);
        break;

    case AppPreferences.SELECT_TIME_TYPE_DETAIL:
        rgType.check(R.id.select_time_rb_detail);
        break;
    }

    // ---------------
    // Preset

    RadioGroup rgPreset = (RadioGroup) v.findViewById(R.id.select_time_rg_preset);
    rgPreset.setOnCheckedChangeListener(onPresetCheckedChangeListener);

    switch (this.selectTimePresetIndex) {
    default:
    case AppPreferences.TIME_PRESET_1HOUR:
        rgPreset.check(R.id.select_time_rb_1hour);
        break;

    case AppPreferences.TIME_PRESET_3HOUR:
        rgPreset.check(R.id.select_time_rb_3hour);
        break;

    case AppPreferences.TIME_PRESET_6HOUR:
        rgPreset.check(R.id.select_time_rb_6hour);
        break;

    case AppPreferences.TIME_PRESET_12HOUR:
        rgPreset.check(R.id.select_time_rb_12hour);
        break;

    case AppPreferences.TIME_PRESET_24HOUR:
        rgPreset.check(R.id.select_time_rb_24hour);
        break;
    }

    // ---------------
    // Detail

    Button btnDateFrom = (Button) v.findViewById(R.id.select_time_btn_date_from);
    btnDateFrom.setOnClickListener(onClickDateTimeSelectBtnListener);

    Button btnTimeFrom = (Button) v.findViewById(R.id.select_time_btn_time_from);
    btnTimeFrom.setOnClickListener(onClickDateTimeSelectBtnListener);

    Button btnDateTo = (Button) v.findViewById(R.id.select_time_btn_date_to);
    btnDateTo.setOnClickListener(onClickDateTimeSelectBtnListener);

    Button btnTimeTo = (Button) v.findViewById(R.id.select_time_btn_time_to);
    btnTimeTo.setOnClickListener(onClickDateTimeSelectBtnListener);

    updateDateTimeBtnText();

    // ---------------

    Button btnOk = (Button) v.findViewById(R.id.select_time_btn_ok);
    btnOk.setOnClickListener(onClickOkCancelBtnListener);

    Button btnCancel = (Button) v.findViewById(R.id.select_time_btn_cancel);
    btnCancel.setOnClickListener(onClickOkCancelBtnListener);
}