Example usage for android.widget RadioButton isChecked

List of usage examples for android.widget RadioButton isChecked

Introduction

In this page you can find the example usage for android.widget RadioButton isChecked.

Prototype

@ViewDebug.ExportedProperty
    @Override
    public boolean isChecked() 

Source Link

Usage

From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceActionProfile.java

final static private ProfileListItem setProfileActionOkButtonProcess(final GlobalParameters mGlblParms,
        final Dialog dialog, final AdapterProfileList pfla, final String curr_grp) {
    final EditText dlg_prof_name_et = (EditText) dialog.findViewById(R.id.edit_profile_action_profile_et_name);

    final CheckBox cb_active = (CheckBox) dialog.findViewById(R.id.edit_profile_action_enabled);
    final TextView tv_sound_filename = (TextView) dialog
            .findViewById(R.id.edit_profile_action_exec_sound_file_name);
    final CheckBox cb_music_vol = (CheckBox) dialog
            .findViewById(R.id.edit_profile_action_profile_sound_use_volume);
    final SeekBar sb_music_vol = (SeekBar) dialog.findViewById(R.id.edit_profile_action_profile_sound_volume);
    final CheckBox cb_ringtone_vol = (CheckBox) dialog
            .findViewById(R.id.edit_profile_action_profile_ringtone_use_volume);
    final SeekBar sb_ringtone_vol = (SeekBar) dialog
            .findViewById(R.id.edit_profile_action_profile_ringtone_volume);

    final Spinner spinnerActionType = (Spinner) dialog.findViewById(R.id.edit_profile_action_action_type);
    final Spinner spinnerActivityName = (Spinner) dialog
            .findViewById(R.id.edit_profile_action_exec_activity_name);
    final Spinner spinnerActivityDataType = (Spinner) dialog
            .findViewById(R.id.edit_profile_action_exec_activity_data_type);
    final Spinner spinnerRingtoneType = (Spinner) dialog
            .findViewById(R.id.edit_profile_action_exec_ringtone_type);
    final Spinner spinnerRingtoneName = (Spinner) dialog
            .findViewById(R.id.edit_profile_action_exec_ringtone_name);
    final Spinner spinnerCompareType = (Spinner) dialog.findViewById(R.id.edit_profile_action_compare_type);
    final EditText et_comp_value1 = (EditText) dialog.findViewById(R.id.edit_profile_action_compare_value1);
    final EditText et_comp_value2 = (EditText) dialog.findViewById(R.id.edit_profile_action_compare_value2);

    final Spinner spinnerCompareTarget = (Spinner) dialog.findViewById(R.id.edit_profile_action_compare_target);
    final Spinner spinnerCompareResult = (Spinner) dialog.findViewById(R.id.edit_profile_action_compare_result);
    final Spinner spinnerMessageType = (Spinner) dialog.findViewById(R.id.edit_profile_action_message_type);
    final EditText et_msg_text = (EditText) dialog.findViewById(R.id.edit_profile_action_message_message);
    final CheckBox cb_vib_used = (CheckBox) dialog.findViewById(R.id.edit_profile_action_message_vibration);
    final CheckBox cb_led_used = (CheckBox) dialog.findViewById(R.id.edit_profile_action_message_led);
    final RadioButton rb_msg_red = (RadioButton) dialog.findViewById(R.id.edit_profile_action_message_led_red);
    final RadioButton rb_msg_green = (RadioButton) dialog
            .findViewById(R.id.edit_profile_action_message_led_green);
    final Spinner spinnerTimeType = (Spinner) dialog.findViewById(R.id.edit_profile_action_time_type);
    final Spinner spinnerTimeTarget = (Spinner) dialog.findViewById(R.id.edit_profile_action_time_target);
    final Spinner spinnerTaskType = (Spinner) dialog.findViewById(R.id.edit_profile_action_task_type);
    final Spinner spinnerTaskTarget = (Spinner) dialog.findViewById(R.id.edit_profile_action_task_target);

    final EditText uri_data = (EditText) dialog.findViewById(R.id.edit_profile_action_exec_activity_uri_data);
    String prof_active;/*from w w  w  .  j av a  2  s . co  m*/
    if (cb_active.isChecked())
        prof_active = PROFILE_ENABLED;
    else
        prof_active = PROFILE_DISABLED;

    String prof_act_name = null, prof_act_pkgname = null;
    String file_name = "";
    ProfileListItem ntpli = new ProfileListItem();
    String act_type = spinnerActionType.getSelectedItem().toString();
    if (act_type.equals(PROFILE_ACTION_TYPE_ACTIVITY)) {
        String t_tn = spinnerActivityName.getSelectedItem().toString();
        prof_act_name = t_tn.substring(0, t_tn.indexOf("("));
        prof_act_pkgname = t_tn.replace(prof_act_name + "(", "").replace(")", "");
        ArrayList<ActivityExtraDataItem> aed_edit_list = new ArrayList<ActivityExtraDataItem>();
        ntpli.setActionAndroidEntry(PROFILE_VERSION_CURRENT, curr_grp,
                ProfileUtilities.isProfileGroupActive(mGlblParms.util, pfla, curr_grp),
                System.currentTimeMillis(), PROFILE_TYPE_ACTION, dlg_prof_name_et.getText().toString(),
                prof_active, prof_act_name, prof_act_pkgname,
                spinnerActivityDataType.getSelectedItem().toString(), uri_data.getText().toString(),
                aed_edit_list);
    } else if (act_type.equals(PROFILE_ACTION_TYPE_MUSIC)) {
        int vol = -1;
        if (cb_music_vol.isChecked())
            vol = sb_music_vol.getProgress();
        file_name = tv_sound_filename.getText().toString();
        ntpli.setActionMusicEntry(PROFILE_VERSION_CURRENT, curr_grp,
                ProfileUtilities.isProfileGroupActive(mGlblParms.util, pfla, curr_grp),
                System.currentTimeMillis(), PROFILE_TYPE_ACTION, dlg_prof_name_et.getText().toString(),
                prof_active, file_name, String.valueOf(vol), String.valueOf(vol));
    } else if (act_type.equals(PROFILE_ACTION_TYPE_RINGTONE)) {
        int vol = -1;
        if (cb_ringtone_vol.isChecked())
            vol = sb_ringtone_vol.getProgress();
        String rt_type_str = spinnerRingtoneType.getSelectedItem().toString();
        String rt_name_str = spinnerRingtoneName.getSelectedItem().toString();
        String rt_path = "";
        for (int i = 0; i < mGlblParms.ringtoneList.size(); i++) {
            if (mGlblParms.ringtoneList.get(i).ringtone_type == ProfileMaintenance
                    .getRingtoneTypeInt(rt_type_str)) {
                if (mGlblParms.ringtoneList.get(i).ringtone_name.equals(rt_name_str)) {
                    rt_path = mGlblParms.ringtoneList.get(i).ringtone_uri.getPath();
                    break;
                }
            }
        }
        ntpli.setActionRingtoneEntry(PROFILE_VERSION_CURRENT, curr_grp,
                ProfileUtilities.isProfileGroupActive(mGlblParms.util, pfla, curr_grp),
                System.currentTimeMillis(), PROFILE_TYPE_ACTION, dlg_prof_name_et.getText().toString(),
                prof_active, rt_type_str, rt_name_str, rt_path, String.valueOf(vol), String.valueOf(vol));
    } else if (act_type.equals(PROFILE_ACTION_TYPE_COMPARE)) {
        String c_tgt = spinnerCompareTarget.getSelectedItem().toString();
        String c_typ = spinnerCompareType.getSelectedItem().toString();
        String ra = spinnerCompareResult.getSelectedItem().toString();
        String[] c_val = null;
        if (c_tgt.equals(PROFILE_ACTION_TYPE_COMPARE_TARGET_BLUETOOTH)
                || c_tgt.equals(PROFILE_ACTION_TYPE_COMPARE_TARGET_WIFI)) {
            int a_idx = 0;
            for (int i = 0; i < mGlblParms.actionCompareDataAdapter.getCount(); i++) {
                if (mGlblParms.actionCompareDataAdapter.getItem(i).data_value != null
                        && !mGlblParms.actionCompareDataAdapter.getItem(i).data_value.equals("")) {
                    a_idx++;
                }
            }
            c_val = new String[a_idx + 1];
            a_idx = 0;
            for (int i = 0; i < mGlblParms.actionCompareDataAdapter.getCount(); i++) {
                if (mGlblParms.actionCompareDataAdapter.getItem(i).data_value != null
                        && !mGlblParms.actionCompareDataAdapter.getItem(i).data_value.equals("")) {
                    c_val[a_idx] = mGlblParms.actionCompareDataAdapter.getItem(i).data_value;
                    a_idx++;
                }
            }
        } else {
            if (c_typ.equals(PROFILE_ACTION_TYPE_COMPARE_COMPARE_BETWEEN)) {
                c_val = new String[2];
                c_val[0] = et_comp_value1.getText().toString();
                c_val[1] = et_comp_value2.getText().toString();
            } else {
                c_val = new String[1];
                c_val[0] = et_comp_value1.getText().toString();
            }
        }
        ntpli.setActionCompareEntry(PROFILE_VERSION_CURRENT, curr_grp,
                ProfileUtilities.isProfileGroupActive(mGlblParms.util, pfla, curr_grp),
                System.currentTimeMillis(), PROFILE_TYPE_ACTION, dlg_prof_name_et.getText().toString(),
                prof_active, c_tgt, c_typ, c_val, ra);
        //         ntpli.dumpProfile();
    } else if (act_type.equals(PROFILE_ACTION_TYPE_MESSAGE)) {
        String m_typ = spinnerMessageType.getSelectedItem().toString();
        String m_txt = et_msg_text.getText().toString();
        String led_color = PROFILE_ACTION_TYPE_MESSAGE_LED_BLUE;
        if (rb_msg_red.isChecked())
            led_color = PROFILE_ACTION_TYPE_MESSAGE_LED_RED;
        else if (rb_msg_green.isChecked())
            led_color = PROFILE_ACTION_TYPE_MESSAGE_LED_GREEN;
        ntpli.setActionMessageEntry(PROFILE_VERSION_CURRENT, curr_grp,
                ProfileUtilities.isProfileGroupActive(mGlblParms.util, pfla, curr_grp),
                System.currentTimeMillis(), PROFILE_TYPE_ACTION, dlg_prof_name_et.getText().toString(),
                prof_active, m_typ, m_txt, cb_vib_used.isChecked(), cb_led_used.isChecked(), led_color);
    } else if (act_type.equals(PROFILE_ACTION_TYPE_TIME)) {
        String t_typ = spinnerTimeType.getSelectedItem().toString();
        String t_tgt = spinnerTimeTarget.getSelectedItem().toString();
        ntpli.setActionTimeEntry(PROFILE_VERSION_CURRENT, curr_grp,
                ProfileUtilities.isProfileGroupActive(mGlblParms.util, pfla, curr_grp),
                System.currentTimeMillis(), PROFILE_TYPE_ACTION, dlg_prof_name_et.getText().toString(),
                prof_active, t_typ, t_tgt);
    } else if (act_type.equals(PROFILE_ACTION_TYPE_TASK)) {
        String t_typ = spinnerTaskType.getSelectedItem().toString();
        String t_tgt = spinnerTaskTarget.getSelectedItem().toString();
        ntpli.setActionTaskEntry(PROFILE_VERSION_CURRENT, curr_grp,
                ProfileUtilities.isProfileGroupActive(mGlblParms.util, pfla, curr_grp),
                System.currentTimeMillis(), PROFILE_TYPE_ACTION, dlg_prof_name_et.getText().toString(),
                prof_active, t_typ, t_tgt);
    } else if (act_type.equals(PROFILE_ACTION_TYPE_WAIT)) {
        final Spinner spinnerWaitTarget = (Spinner) dialog.findViewById(R.id.edit_profile_action_wait_target);
        final Spinner spinnerWaitTimeoutType = (Spinner) dialog
                .findViewById(R.id.edit_profile_action_wait_timeout);
        final Spinner spinnerWaitTimeoutValue = (Spinner) dialog
                .findViewById(R.id.edit_profile_action_wait_timeout_value);
        final Spinner spinnerWaitTimeoutUnits = (Spinner) dialog
                .findViewById(R.id.edit_profile_action_wait_timeout_units);
        String w_tgt = spinnerWaitTarget.getSelectedItem().toString();
        String w_tov = "";
        String w_tou = "";
        if (spinnerWaitTimeoutType.getSelectedItem().toString()
                .equals(PROFILE_ACTION_TYPE_WAIT_TIMEOUT_TYPE_TIMEOUTIS)) {
            w_tov = spinnerWaitTimeoutValue.getSelectedItem().toString();
            w_tou = spinnerWaitTimeoutUnits.getSelectedItem().toString();
        }
        ntpli.setActionWaitEntry(PROFILE_VERSION_CURRENT, curr_grp,
                ProfileUtilities.isProfileGroupActive(mGlblParms.util, pfla, curr_grp),
                System.currentTimeMillis(), PROFILE_TYPE_ACTION, dlg_prof_name_et.getText().toString(),
                prof_active, w_tgt, w_tov, w_tou);
    } else if (act_type.equals(PROFILE_ACTION_TYPE_BSH_SCRIPT)) {
        final EditText et_bsh_script = (EditText) dialog
                .findViewById(R.id.edit_profile_action_dlg_bsh_script_text);
        String w_text = et_bsh_script.getText().toString().replaceAll("\t", " ");
        ntpli.setActionBeanShellScriptEntry(PROFILE_VERSION_CURRENT, curr_grp,
                ProfileUtilities.isProfileGroupActive(mGlblParms.util, pfla, curr_grp),
                System.currentTimeMillis(), PROFILE_TYPE_ACTION, dlg_prof_name_et.getText().toString(),
                prof_active, w_text);
    }
    ;
    return ntpli;
}