List of usage examples for android.app Dialog findViewById
@Nullable public <T extends View> T findViewById(@IdRes int id)
From source file:dong.lan.tuyi.activity.MainActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.toolbar_community: startActivity(new Intent(MainActivity.this, TuyiHomeActivity.class)); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break;/*from w w w . ja v a 2s . c o m*/ case R.id.toolbar_tuyi: startActivity(new Intent(MainActivity.this, TuMapActivity.class)); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.my_Favorite: startActivity(new Intent(MainActivity.this, FavoriteActivity.class)); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_des: isGetWeather = true; break; case R.id.offline_tuyi: startActivityForResult(new Intent(MainActivity.this, OfflineTuyiActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_community: Lock.canPop = false; startActivityForResult(new Intent(MainActivity.this, TuyiCommunityActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_head: if (Config.tUser == null) { Show("????"); return; } Lock.canPop = false; final Dialog dialog = new AlertDialog.Builder(MainActivity.this).create(); dialog.setCancelable(true); dialog.show(); dialog.getWindow().setContentView(R.layout.dialog_set_head_img); TextView msg = (TextView) dialog.findViewById(R.id.dialog_msg); msg.setText("?"); TextView dialog_left = (TextView) dialog.findViewById(R.id.dialog_left); TextView dialog_right = (TextView) dialog.findViewById(R.id.dialog_right); dialog_left.setText(""); dialog_right.setText(""); dialog_left.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); File dir = new File(Constant.PICTURE_PATH); if (!dir.exists()) { dir.mkdirs(); } // File file = new File(dir, username + "_head_" + new SimpleDateFormat(TimeUtil.FORMAT_NORMAL).format(new Date())); filePath = file.getAbsolutePath();// ?? Uri imageUri = Uri.fromFile(file); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); startActivityForResult(intent, Constant.REQUESTCODE_UPLOADAVATAR_CAMERA); } }); dialog_right.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); Intent intent = new Intent(Intent.ACTION_PICK, null); intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); startActivityForResult(intent, Constant.REQUESTCODE_UPLOADAVATAR_LOCATION); } }); break; case R.id.user_center: if (Config.tUser != null) { Lock.canPop = false; startActivityForResult( new Intent(MainActivity.this, UserCenter.class).putExtra("USER", Config.tUser), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); } break; case R.id.user_albums: startActivityForResult(new Intent(MainActivity.this, TuyiPlayActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_setting: startActivityForResult(new Intent(MainActivity.this, MyRadarActivity.class), 100); break; case R.id.my_interested: startActivityForResult(new Intent(MainActivity.this, MyInterestedActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; } }
From source file:org.opendatakit.tables.activities.TableDisplayActivity.java
private void showDialogOder() { int i, j = 0, n; int k = 0;/*from w ww. j a va 2 s . c o m*/ final List<String[]> tile = readCsv(context); for (n = 0; n < tile.size(); n++) { if ("sort".equals(tile.get(n)[0])) { j++; } } String[] name = new String[j]; final ViewFragmentType fage = this.mCurrentFragmentType; final Dialog dialog = new Dialog(context); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); View layout = inflater.inflate(R.layout.dialog_sapxep, null); dialog.addContentView(layout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); dialog.setContentView(R.layout.dialog_sapxep); final ListView lv = (ListView) dialog.findViewById(R.id.list_oder); TextView title = (TextView) dialog.findViewById(R.id.title); title.setText("Sp xp theo"); for (i = 0; i < tile.size(); i++) { if ("sort".equals(tile.get(i)[0])) { name[k] = tile.get(i)[1].toString(); k++; } } List<Model> list = new ArrayList<Model>(); for (String elementKey : name) { list.add(new Model(elementKey)); } if (oder_position >= 0) { Model m = new Model(name[oder_position], true); list.set(oder_position, m); } adapter = new Adapter(this, list); lv.setAdapter(adapter); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Model model = (Model) (lv.getItemAtPosition(position)); String selectedFromList = model.getName(); for (int n = 0; n < tile.size(); n++) { if (selectedFromList.equals(tile.get(n)[1])) { String oder_key = tile.get(n)[2].toString(); Intent intent = getIntent(); intent.putExtra("oder", oder_key); intent.putExtra("oder_position", String.valueOf(position)); intent.putExtra("all", "0"); switch (fage) { case SPREADSHEET: intent.putExtra("page", "SPREADSHEET"); break; case LIST: intent.putExtra("page", "LIST"); break; case MAP: intent.putExtra("page", "MAP"); break; case DETAIL: intent.putExtra("page", "DETAIL"); break; default: break; } finish(); startActivity(intent); } } } }); dialog.show(); }
From source file:org.opendatakit.tables.activities.TableDisplayActivity.java
private void showDialogTimkiem() { int i, j = 0, n; int k = 0;/*from ww w. ja v a2 s.c om*/ final List<String[]> tile = readCsv(context); final ViewFragmentType fage = this.mCurrentFragmentType; for (n = 0; n < tile.size(); n++) { if ("filter".equals(tile.get(n)[0])) { j++; } } String[] name = new String[j]; final Dialog dialog = new Dialog(context); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); View layout = inflater.inflate(R.layout.dialog_sapxep, null); dialog.addContentView(layout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); dialog.setContentView(R.layout.dialog_sapxep); final ListView lv = (ListView) dialog.findViewById(R.id.list_oder); TextView title = (TextView) dialog.findViewById(R.id.title); title.setText("L?c theo trng thi"); for (i = 0; i < tile.size(); i++) { if ("filter".equals(tile.get(i)[0])) { name[k] = tile.get(i)[1].toString(); k++; } } List<Model> list = new ArrayList<Model>(); for (String elementKey : name) { list.add(new Model(elementKey)); } if (position_check >= 0) { Model m = new Model(name[position_check], true); list.set(position_check, m); } adapter = new Adapter(this, list); lv.setAdapter(adapter); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { RadioButton checkbox = (RadioButton) view.getTag(R.id.radioBT); checkbox.setChecked(true); Model model = (Model) (lv.getItemAtPosition(position)); String selectedFromList = model.getName(); for (int n = 0; n < tile.size(); n++) { if (selectedFromList.equals(tile.get(n)[1])) { String mj = tile.get(n)[2].toString(); Intent intent = getIntent(); StringBuilder s = new StringBuilder(); s.append(mj); intent.putExtra("timkiem", s.toString()); intent.putExtra("vitri", String.valueOf(position)); intent.putExtra("all", "0"); switch (fage) { case SPREADSHEET: intent.putExtra("page", "SPREADSHEET"); break; case LIST: intent.putExtra("page", "LIST"); break; case MAP: intent.putExtra("page", "MAP"); break; case DETAIL: intent.putExtra("page", "DETAIL"); break; default: break; } finish(); startActivity(intent); } } } }); dialog.show(); }
From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceActionProfile.java
final static private void setProfileActionTaskListener(final GlobalParameters mGlblParms, final Dialog dialog, final AdapterProfileList pfla, final String curr_grp, final CustomSpinnerAdapter adapterTaskType, final CustomSpinnerAdapter adapterTaskTarget, final String tgt_task) { 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); spinnerTaskType.setOnItemSelectedListener(new OnItemSelectedListener() { @Override// ww w. j ava2 s . co m final public void onItemSelected(AdapterView<?> arg0, View arg1, int pos, long arg3) { if (adapterTaskType.getItem(pos).equals(PROFILE_ACTION_TYPE_TASK_START_TASK)) { ProfileMaintenance.setSpinnerTaskTarget(mGlblParms, true, dialog, spinnerTaskTarget, adapterTaskTarget, pfla, curr_grp, tgt_task); } else ProfileMaintenance.setSpinnerTaskTarget(mGlblParms, false, dialog, spinnerTaskTarget, adapterTaskTarget, pfla, curr_grp, tgt_task); } @Override final public void onNothingSelected(AdapterView<?> arg0) { } }); }
From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceActionProfile.java
final static private void setViewVisibilityByActionType(final GlobalParameters mGlblParms, Dialog dialog, String action_type, String data_type) { Spinner sp_exec_android_activity = (Spinner) dialog .findViewById(R.id.edit_profile_action_exec_activity_name); LinearLayout ll_exec_sound = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_exec_sound); LinearLayout ll_exec_ringtone = (LinearLayout) dialog .findViewById(R.id.edit_profile_action_ll_exec_ringtone); LinearLayout ll_exec_compare = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_compare); LinearLayout ll_exec_message = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_message); LinearLayout ll_exec_time = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_time); LinearLayout ll_exec_task = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_task); LinearLayout ll_exec_wait = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_wait); LinearLayout ll_exec_bsh = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_bsh); LinearLayout ll_exec_test = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_test_exec); // TextView tv_layout_normal=(TextView)dialog.findViewById(R.id.edit_profile_action_dlg_bsh_layout_normal); final CheckBox cb_volume = (CheckBox) dialog .findViewById(R.id.edit_profile_action_profile_sound_use_volume); final SeekBar sb_volume = (SeekBar) dialog.findViewById(R.id.edit_profile_action_profile_sound_volume); final Spinner sp_type = (Spinner) dialog.findViewById(R.id.edit_profile_action_exec_activity_data_type); final Button uri_fl = (Button) dialog .findViewById(R.id.edit_profile_action_exec_activity_uri_data_filelist); final EditText uri_data = (EditText) dialog.findViewById(R.id.edit_profile_action_exec_activity_uri_data); // final Button test_exec_btn=(Button)dialog.findViewById(R.id.edit_profile_action_test_exec); final ListView lv_extra_data = (ListView) dialog .findViewById(R.id.edit_profile_action_exec_activity_extra_data_listview); uri_fl.setVisibility(Button.GONE); uri_data.setVisibility(EditText.GONE); ll_exec_test.setVisibility(Button.GONE); lv_extra_data.setVisibility(ListView.GONE); final EditText et_msg_text = (EditText) dialog.findViewById(R.id.edit_profile_action_message_message); et_msg_text.setVisibility(EditText.GONE); sp_exec_android_activity.setVisibility(Spinner.VISIBLE); sp_type.setVisibility(Spinner.VISIBLE); ll_exec_sound.setVisibility(LinearLayout.VISIBLE); ll_exec_ringtone.setVisibility(LinearLayout.VISIBLE); ll_exec_compare.setVisibility(LinearLayout.VISIBLE); ll_exec_message.setVisibility(LinearLayout.VISIBLE); ll_exec_time.setVisibility(LinearLayout.VISIBLE); ll_exec_task.setVisibility(LinearLayout.VISIBLE); ll_exec_wait.setVisibility(LinearLayout.VISIBLE); if (action_type.equals(PROFILE_ACTION_TYPE_ACTIVITY)) { ll_exec_sound.setVisibility(LinearLayout.GONE); ll_exec_ringtone.setVisibility(LinearLayout.GONE); ll_exec_compare.setVisibility(LinearLayout.GONE); ll_exec_message.setVisibility(LinearLayout.GONE); ll_exec_test.setVisibility(Button.VISIBLE); ll_exec_time.setVisibility(LinearLayout.GONE); ll_exec_task.setVisibility(LinearLayout.GONE); ll_exec_wait.setVisibility(LinearLayout.GONE); ll_exec_bsh.setVisibility(LinearLayout.GONE); if (data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_DATA_TYPE_EXTRA)) { uri_fl.setVisibility(Button.GONE); uri_data.setVisibility(EditText.GONE); lv_extra_data.setVisibility(ListView.VISIBLE); } else if (data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_DATA_TYPE_URI)) { uri_fl.setVisibility(Button.VISIBLE); uri_data.setVisibility(EditText.VISIBLE); lv_extra_data.setVisibility(ListView.GONE); }/* w w w . jav a2 s . c om*/ } else if (action_type.equals(PROFILE_ACTION_TYPE_MUSIC)) { sp_type.setVisibility(Spinner.GONE); sp_exec_android_activity.setVisibility(Spinner.GONE); ll_exec_ringtone.setVisibility(LinearLayout.GONE); if (cb_volume.isChecked()) sb_volume.setEnabled(true); else sb_volume.setEnabled(false); ll_exec_compare.setVisibility(LinearLayout.GONE); ll_exec_message.setVisibility(LinearLayout.GONE); ll_exec_time.setVisibility(LinearLayout.GONE); ll_exec_task.setVisibility(LinearLayout.GONE); ll_exec_wait.setVisibility(LinearLayout.GONE); ll_exec_bsh.setVisibility(LinearLayout.GONE); } else if (action_type.equals(PROFILE_ACTION_TYPE_RINGTONE)) { sp_type.setVisibility(Spinner.GONE); sp_exec_android_activity.setVisibility(Spinner.GONE); ll_exec_sound.setVisibility(LinearLayout.GONE); if (cb_volume.isChecked()) sb_volume.setEnabled(true); else sb_volume.setEnabled(false); ll_exec_compare.setVisibility(LinearLayout.GONE); ll_exec_message.setVisibility(LinearLayout.GONE); ll_exec_time.setVisibility(LinearLayout.GONE); ll_exec_task.setVisibility(LinearLayout.GONE); ll_exec_wait.setVisibility(LinearLayout.GONE); ll_exec_bsh.setVisibility(LinearLayout.GONE); } else if (action_type.equals(PROFILE_ACTION_TYPE_COMPARE)) { sp_type.setVisibility(Spinner.GONE); sp_exec_android_activity.setVisibility(Spinner.GONE); ll_exec_sound.setVisibility(LinearLayout.GONE); ll_exec_ringtone.setVisibility(LinearLayout.GONE); ll_exec_compare.setVisibility(LinearLayout.VISIBLE); ll_exec_message.setVisibility(LinearLayout.GONE); ll_exec_time.setVisibility(LinearLayout.GONE); ll_exec_task.setVisibility(LinearLayout.GONE); ll_exec_wait.setVisibility(LinearLayout.GONE); ll_exec_bsh.setVisibility(LinearLayout.GONE); } else if (action_type.equals(PROFILE_ACTION_TYPE_MESSAGE)) { sp_type.setVisibility(Spinner.GONE); sp_exec_android_activity.setVisibility(Spinner.GONE); ll_exec_sound.setVisibility(LinearLayout.GONE); ll_exec_ringtone.setVisibility(LinearLayout.GONE); ll_exec_compare.setVisibility(LinearLayout.GONE); ll_exec_message.setVisibility(LinearLayout.VISIBLE); et_msg_text.setVisibility(EditText.VISIBLE); ll_exec_time.setVisibility(LinearLayout.GONE); ll_exec_task.setVisibility(LinearLayout.GONE); ll_exec_wait.setVisibility(LinearLayout.GONE); ll_exec_bsh.setVisibility(LinearLayout.GONE); } else if (action_type.equals(PROFILE_ACTION_TYPE_TIME)) { sp_type.setVisibility(Spinner.GONE); sp_exec_android_activity.setVisibility(Spinner.GONE); ll_exec_sound.setVisibility(LinearLayout.GONE); ll_exec_ringtone.setVisibility(LinearLayout.GONE); ll_exec_compare.setVisibility(LinearLayout.GONE); ll_exec_message.setVisibility(LinearLayout.GONE); et_msg_text.setVisibility(EditText.GONE); ll_exec_time.setVisibility(LinearLayout.VISIBLE); ll_exec_task.setVisibility(LinearLayout.GONE); ll_exec_wait.setVisibility(LinearLayout.GONE); ll_exec_bsh.setVisibility(LinearLayout.GONE); } else if (action_type.equals(PROFILE_ACTION_TYPE_TASK)) { sp_type.setVisibility(Spinner.GONE); sp_exec_android_activity.setVisibility(Spinner.GONE); ll_exec_sound.setVisibility(LinearLayout.GONE); ll_exec_ringtone.setVisibility(LinearLayout.GONE); ll_exec_compare.setVisibility(LinearLayout.GONE); ll_exec_message.setVisibility(LinearLayout.GONE); et_msg_text.setVisibility(EditText.GONE); ll_exec_time.setVisibility(LinearLayout.GONE); ll_exec_task.setVisibility(LinearLayout.VISIBLE); ll_exec_wait.setVisibility(LinearLayout.GONE); ll_exec_bsh.setVisibility(LinearLayout.GONE); } else if (action_type.equals(PROFILE_ACTION_TYPE_WAIT)) { sp_type.setVisibility(Spinner.GONE); sp_exec_android_activity.setVisibility(Spinner.GONE); ll_exec_sound.setVisibility(LinearLayout.GONE); ll_exec_ringtone.setVisibility(LinearLayout.GONE); ll_exec_compare.setVisibility(LinearLayout.GONE); ll_exec_message.setVisibility(LinearLayout.GONE); et_msg_text.setVisibility(EditText.GONE); ll_exec_time.setVisibility(LinearLayout.GONE); ll_exec_task.setVisibility(LinearLayout.GONE); ll_exec_wait.setVisibility(LinearLayout.VISIBLE); ll_exec_bsh.setVisibility(LinearLayout.GONE); } else if (action_type.equals(PROFILE_ACTION_TYPE_BSH_SCRIPT)) { // test_exec_btn.setVisibility(Button.VISIBLE); sp_type.setVisibility(Spinner.GONE); sp_exec_android_activity.setVisibility(Spinner.GONE); ll_exec_sound.setVisibility(LinearLayout.GONE); ll_exec_ringtone.setVisibility(LinearLayout.GONE); ll_exec_compare.setVisibility(LinearLayout.GONE); ll_exec_message.setVisibility(LinearLayout.GONE); ll_exec_test.setVisibility(Button.VISIBLE); et_msg_text.setVisibility(EditText.GONE); ll_exec_time.setVisibility(LinearLayout.GONE); ll_exec_task.setVisibility(LinearLayout.GONE); ll_exec_wait.setVisibility(LinearLayout.GONE); ll_exec_bsh.setVisibility(LinearLayout.VISIBLE); } }
From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceActionProfile.java
final static private void setProfileActionActivityListener(final GlobalParameters mGlblParms, final Dialog dialog, final AdapterProfileList pfla, final String curr_grp, final ArrayList<ActivityExtraDataItem> p_aed_edit_list) { final Button uri_fl = (Button) dialog .findViewById(R.id.edit_profile_action_exec_activity_uri_data_filelist); final EditText uri_data = (EditText) dialog.findViewById(R.id.edit_profile_action_exec_activity_uri_data); uri_data.setOnKeyListener(new OnKeyListener() { @Override// w w w .ja va 2 s.c om public boolean onKey(View arg0, int keyCode, KeyEvent event) { if (//event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) { return true; } return false; } }); // Uri filelist ? uri_fl.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { NotifyEvent ntfy = new NotifyEvent(mGlblParms.context); ntfy.setListener(new NotifyEventListener() { @Override final public void positiveResponse(Context c, Object[] o) { uri_data.selectAll(); uri_data.setText(Uri.parse((String) o[0]).toString()); } @Override final public void negativeResponse(Context c, Object[] o) { } }); mGlblParms.commonDlg.fileSelectWithoutCreate(LocalMountPoint.getExternalStorageDir(), "", "", "Select file", ntfy); } }); mGlblParms.activityExtraDataEditListAdapter = new AdapterActivityExtraDataEditList(mGlblParms.context, R.layout.edit_activity_extra_data_list_item, p_aed_edit_list); ListView lv_aed = (ListView) dialog .findViewById(R.id.edit_profile_action_exec_activity_extra_data_listview); lv_aed.setAdapter(mGlblParms.activityExtraDataEditListAdapter); if (mGlblParms.activityExtraDataEditListAdapter.getCount() == 0) { ActivityExtraDataItem aedi = new ActivityExtraDataItem(); aedi.key_value = ""; aedi.data_value = mGlblParms.context .getString(R.string.msgs_edit_profile_action_activity_extra_data_no_data_exists); mGlblParms.activityExtraDataEditListAdapter.add(aedi); } lv_aed.setOnItemClickListener(new OnItemClickListener() { @Override final public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) { int t_pos; if (mGlblParms.activityExtraDataEditListAdapter.getItem(pos).key_value.equals("")) t_pos = -1; else t_pos = pos; editActivityExtraDataItem(mGlblParms, t_pos); } }); lv_aed.setOnItemLongClickListener(new OnItemLongClickListener() { @Override final public boolean onItemLongClick(AdapterView<?> arg0, View arg1, final int pos, long arg3) { mGlblParms.ccMenu .addMenuItem(mGlblParms.context .getString(R.string.msgs_edit_profile_action_activity_extra_data_ccmenu_add)) .setOnClickListener(new CustomContextMenuOnClickListener() { @Override final public void onClick(CharSequence menuTitle) { editActivityExtraDataItem(mGlblParms, -1); } }); if (!mGlblParms.activityExtraDataEditListAdapter.getItem(pos).key_value.equals("")) { mGlblParms.ccMenu .addMenuItem(mGlblParms.context .getString(R.string.msgs_edit_profile_action_activity_extra_data_ccmenu_edit)) .setOnClickListener(new CustomContextMenuOnClickListener() { @Override final public void onClick(CharSequence menuTitle) { editActivityExtraDataItem(mGlblParms, pos); } }); mGlblParms.ccMenu .addMenuItem(mGlblParms.context .getString(R.string.msgs_edit_profile_action_activity_extra_data_ccmenu_delete)) .setOnClickListener(new CustomContextMenuOnClickListener() { @Override final public void onClick(CharSequence menuTitle) { mGlblParms.activityExtraDataEditListAdapter.remove(pos); if (mGlblParms.activityExtraDataEditListAdapter.getCount() == 0) { ActivityExtraDataItem aedi = new ActivityExtraDataItem(); aedi.key_value = ""; aedi.data_value = mGlblParms.context.getString( R.string.msgs_edit_profile_action_activity_extra_data_no_data_exists); mGlblParms.activityExtraDataEditListAdapter.add(aedi); } mGlblParms.activityExtraDataEditListAdapter.notifyDataSetChanged(); } }); } mGlblParms.ccMenu.createMenu(); return false; } }); }
From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceActionProfile.java
final static private void setProfileActionCompareListener(final GlobalParameters mGlblParms, final Dialog dialog, final AdapterProfileList pfla, final String curr_grp, final CustomSpinnerAdapter adapterCompareType, final String curr_comp_type) { 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 ListView lv_comp_data = (ListView) dialog .findViewById(R.id.edit_profile_action_compare_value_listview); final Button add_btn = (Button) dialog.findViewById(R.id.edit_profile_action_compare_value_add); add_btn.setVisibility(Button.GONE); lv_comp_data.setVisibility(ListView.GONE); spinnerCompareType.setOnItemSelectedListener(new OnItemSelectedListener() { @Override/* ww w . j a v a2 s. co m*/ final public void onItemSelected(AdapterView<?> arg0, View arg1, int pos, long arg3) { if (spinnerCompareType.getItemAtPosition(pos).toString() .equals(PROFILE_ACTION_TYPE_COMPARE_COMPARE_BETWEEN)) { et_comp_value2.setVisibility(EditText.VISIBLE); } else { et_comp_value2.setVisibility(EditText.GONE); } } @Override final public void onNothingSelected(AdapterView<?> arg0) { } }); spinnerCompareTarget.setOnItemSelectedListener(new OnItemSelectedListener() { @Override final public void onItemSelected(AdapterView<?> arg0, View arg1, int pos, long arg3) { if (spinnerCompareTarget.getItemAtPosition(pos).toString() .equals(PROFILE_ACTION_TYPE_COMPARE_TARGET_BLUETOOTH) || spinnerCompareTarget.getItemAtPosition(pos).toString() .equals(PROFILE_ACTION_TYPE_COMPARE_TARGET_WIFI)) { setSpinnerCompareType(mGlblParms, dialog, spinnerCompareType, adapterCompareType, curr_comp_type, true, true, false, false, false); lv_comp_data.setVisibility(ListView.VISIBLE); add_btn.setVisibility(Button.VISIBLE); et_comp_value1.setVisibility(EditText.GONE); et_comp_value2.setVisibility(EditText.GONE); } else { setSpinnerCompareType(mGlblParms, dialog, spinnerCompareType, adapterCompareType, curr_comp_type, true, true, true, true, true); lv_comp_data.setVisibility(ListView.GONE); add_btn.setVisibility(Button.GONE); et_comp_value1.setVisibility(EditText.VISIBLE); et_comp_value2.setVisibility(EditText.VISIBLE); } setCompareEditTextAttr(mGlblParms, spinnerCompareTarget.getItemAtPosition(pos).toString(), et_comp_value1, et_comp_value1); } @Override final public void onNothingSelected(AdapterView<?> arg0) { } }); NotifyEvent ntfy = new NotifyEvent(mGlblParms.context); ntfy.setListener(new NotifyEventListener() { @Override final public void positiveResponse(Context c, Object[] o) { editDataArrayListItem(mGlblParms, (String) o[0], (Integer) o[1]); } @Override final public void negativeResponse(Context c, Object[] o) { } }); mGlblParms.actionCompareDataAdapter.setEditBtnNotifyListener(ntfy); add_btn.setOnClickListener(new OnClickListener() { @Override final public void onClick(View arg0) { if (mGlblParms.actionCompareDataAdapter.getCount() == 1) { if (mGlblParms.actionCompareDataAdapter.getItem(0).dummy_data) mGlblParms.actionCompareDataAdapter.remove(0); } DataArrayEditListItem daeli = new DataArrayEditListItem(); mGlblParms.actionCompareDataAdapter.add(daeli); mGlblParms.actionCompareDataAdapter.notifyDataSetChanged(); } }); }
From source file:biz.bokhorst.xprivacy.ActivityApp.java
private void optionHelp() { // Show help/*w ww . j a va 2s.co m*/ Dialog dialog = new Dialog(ActivityApp.this); dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); dialog.setTitle(R.string.menu_help); dialog.setContentView(R.layout.help); dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); ((ImageView) dialog.findViewById(R.id.imgHelpHalf)).setImageBitmap(getHalfCheckBox()); ((ImageView) dialog.findViewById(R.id.imgHelpOnDemand)).setImageBitmap(getOnDemandCheckBox()); dialog.setCancelable(true); dialog.show(); }
From source file:co.taqat.call.CallActivity.java
private void showAcceptCallUpdateDialog() { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC)); d.setAlpha(200);/*from w w w . j a v a 2 s . c om*/ dialog.setContentView(R.layout.dialog); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); dialog.getWindow().setBackgroundDrawable(d); TextView customText = (TextView) dialog.findViewById(R.id.customText); customText.setText(getResources().getString(R.string.add_video_dialog)); Button delete = (Button) dialog.findViewById(R.id.delete_button); delete.setText(R.string.accept); Button cancel = (Button) dialog.findViewById(R.id.cancel); cancel.setText(R.string.decline); delete.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { int camera = getPackageManager().checkPermission(Manifest.permission.CAMERA, getPackageName()); Log.i("[Permission] Camera permission is " + (camera == PackageManager.PERMISSION_GRANTED ? "granted" : "denied")); if (camera == PackageManager.PERMISSION_GRANTED) { CallActivity.instance().acceptCallUpdate(true); } else { checkAndRequestPermission(Manifest.permission.CAMERA, PERMISSIONS_REQUEST_CAMERA); } dialog.dismiss(); } }); cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { if (CallActivity.isInstanciated()) { CallActivity.instance().acceptCallUpdate(false); } dialog.dismiss(); } }); dialog.show(); }
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;// w ww. j a va 2s .c om 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; }