List of usage examples for android.app Dialog setTitle
public void setTitle(@StringRes int titleId)
From source file:com.pileproject.drive.setting.machine.BluetoothMachineSelectFragment.java
@Override @NonNull/*from ww w .j av a 2s . c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = new Dialog(getActivity()); dialog.setTitle(R.string.setting_bluetoothMachineSelect); return dialog; }
From source file:com.coinblesk.client.backup.BackupRestoreDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.setTitle(R.string.fragment_backup_restore_title); return dialog; }
From source file:com.greatnowhere.radar.MainRadarActivity.java
private void showAboutDialog() { final Dialog d = new Dialog(this); d.setContentView(R.layout.about);/* w w w .ja v a2 s.co m*/ d.setTitle(R.string.app_name); Button dialogOk = (Button) d.findViewById(R.id.aboutIdButtonOK); dialogOk.setOnClickListener(new OnClickListener() { public void onClick(View v) { d.dismiss(); } }); d.show(); }
From source file:no.barentswatch.fiskinfo.MyPageActivity.java
private void createSettingsDialog() { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dialog_settings); dialog.setTitle(R.string.settings); Button setStoragePathButton = (Button) dialog.findViewById(R.id.settings_dialog_set_storage_path_button); Button logOutButton = (Button) dialog.findViewById(R.id.settings_dialog_log_out_button); Button okButton = (Button) dialog.findViewById(R.id.settings_dialog_ok_button); setStoragePathButton.setOnClickListener(new View.OnClickListener() { @Override/*from ww w. j a v a 2 s . c om*/ public void onClick(View v) { createFileDialog(); } }); logOutButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { createConfirmLogoutDialog(getContext(), R.string.log_out, R.string.confirm_log_out); } }); okButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.setCanceledOnTouchOutside(false); dialog.show(); }
From source file:nz.ac.otago.psyanlab.common.designer.program.operand.EditOperandDialogFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Bundle args = getArguments();/*from www .j ava2 s .com*/ if (args != null) { if (!args.containsKey(ARG_TITLE)) { throw new RuntimeException("Expected dialogue title."); } if (!args.containsKey(ARG_TYPE)) { throw new RuntimeException("Expected operand type request."); } if (!args.containsKey(ARG_CALLER_KIND)) { throw new RuntimeException("Expected caller kind."); } if (!args.containsKey(ARG_CALLER_ID)) { throw new RuntimeException("Expected caller id."); } if (!args.containsKey(ARG_OPERAND_ID)) { throw new RuntimeException("Expected operand id."); } mCallerId = args.getLong(ARG_CALLER_ID, INVALID_ID); mCallerKind = args.getInt(ARG_CALLER_KIND); mOperandId = args.getLong(ARG_OPERAND_ID, INVALID_ID); mOperandType = args.getInt(ARG_TYPE); mTitle = args.getString(ARG_TITLE); mHideName = args.getBoolean(ARG_HIDE_NAME, true); mEditNameEnabled = args.getBoolean(ARG_EDIT_NAME, false); mOperand = mCallbacks.getOperand(mOperandId); } if (mOperandId == INVALID_ID) { throw new RuntimeException("Invalid operand id given."); } Dialog dialog = getDialog(); dialog.setTitle(mTitle); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); mViews = new ViewHolder(view); mViews.initViews(); Operand operand = mCallbacks.getOperand(mOperandId); if (operand instanceof CallValue) { mViews.pager.setCurrentItem(1); } else { mViews.pager.setCurrentItem(0); } }
From source file:com.adithya321.sharesanalysis.fragments.SalesShareFragment.java
private void setRecyclerViewAdapter() { sharesList = databaseHandler.getShares(); final List<Purchase> salesList = databaseHandler.getSales(); PurchaseShareAdapter purchaseAdapter = new PurchaseShareAdapter(getContext(), salesList); purchaseAdapter.setOnItemClickListener(new PurchaseShareAdapter.OnItemClickListener() { @Override/*from ww w .ja v a 2 s . com*/ public void onItemClick(View itemView, int position) { final Purchase purchase = salesList.get(position); final Dialog dialog = new Dialog(getActivity()); dialog.setTitle("Edit Share Sale"); dialog.setContentView(R.layout.dialog_sell_share_holdings); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT); dialog.show(); final Spinner spinner = (Spinner) dialog.findViewById(R.id.existing_spinner); ArrayList<String> shares = new ArrayList<>(); int pos = 0; for (int i = 0; i < sharesList.size(); i++) { shares.add(sharesList.get(i).getName()); if (sharesList.get(i).getName().equals(purchase.getName())) pos = i; } ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, shares); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(spinnerAdapter); spinner.setSelection(pos); spinner.setVisibility(View.VISIBLE); final EditText quantity = (EditText) dialog.findViewById(R.id.no_of_shares); final EditText price = (EditText) dialog.findViewById(R.id.selling_price); quantity.setText(String.valueOf(purchase.getQuantity())); price.setText(String.valueOf(purchase.getPrice())); Calendar calendar = Calendar.getInstance(); calendar.setTime(purchase.getDate()); year_start = calendar.get(Calendar.YEAR); month_start = calendar.get(Calendar.MONTH) + 1; day_start = calendar.get(Calendar.DAY_OF_MONTH); final Button selectDate = (Button) dialog.findViewById(R.id.select_date); selectDate.setText(new StringBuilder().append(day_start).append("/").append(month_start).append("/") .append(year_start)); selectDate.setOnClickListener(SalesShareFragment.this); Button sellShareBtn = (Button) dialog.findViewById(R.id.sell_share_btn); sellShareBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Purchase p = new Purchase(); p.setId(purchase.getId()); String stringStartDate = year_start + " " + month_start + " " + day_start; DateFormat format = new SimpleDateFormat("yyyy MM dd", Locale.ENGLISH); try { Date date = format.parse(stringStartDate); p.setDate(date); } catch (Exception e) { Toast.makeText(getActivity(), "Invalid Date", Toast.LENGTH_SHORT).show(); return; } try { p.setQuantity(Integer.parseInt(quantity.getText().toString())); } catch (Exception e) { Toast.makeText(getActivity(), "Invalid Number of Shares", Toast.LENGTH_SHORT).show(); return; } try { p.setPrice(Double.parseDouble(price.getText().toString())); } catch (Exception e) { Toast.makeText(getActivity(), "Invalid Buying Price", Toast.LENGTH_SHORT).show(); return; } p.setType("sell"); p.setName(spinner.getSelectedItem().toString()); databaseHandler.updatePurchase(p); setRecyclerViewAdapter(); dialog.dismiss(); } }); } }); salesRecyclerView.setHasFixedSize(true); salesRecyclerView.setAdapter(purchaseAdapter); salesRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); }
From source file:com.adithya321.sharesanalysis.fragments.SalesShareFragment.java
@Nullable @Override/*from www.j a v a 2 s. c o m*/ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_share_sales, container, false); databaseHandler = new DatabaseHandler(getContext()); salesRecyclerView = (RecyclerView) root.findViewById(R.id.sales_recycler_view); setRecyclerViewAdapter(); FloatingActionButton sellShareFab = (FloatingActionButton) root.findViewById(R.id.sell_share_fab); sellShareFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(getContext()); dialog.setTitle("Sell Share Holdings"); dialog.setContentView(R.layout.dialog_sell_share_holdings); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT); dialog.show(); final Spinner spinner = (Spinner) dialog.findViewById(R.id.existing_spinner); ArrayList<String> shares = new ArrayList<>(); for (Share share : sharesList) { shares.add(share.getName()); } ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, shares); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(spinnerAdapter); Calendar calendar = Calendar.getInstance(); year_start = calendar.get(Calendar.YEAR); month_start = calendar.get(Calendar.MONTH) + 1; day_start = calendar.get(Calendar.DAY_OF_MONTH); final Button selectDate = (Button) dialog.findViewById(R.id.select_date); selectDate.setText(new StringBuilder().append(day_start).append("/").append(month_start).append("/") .append(year_start)); selectDate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Dialog dialog = new DatePickerDialog(getActivity(), onDateSetListener, year_start, month_start - 1, day_start); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { selectDate.setText(new StringBuilder().append(day_start).append("/") .append(month_start).append("/").append(year_start)); } }); dialog.show(); } }); Button sellShareBtn = (Button) dialog.findViewById(R.id.sell_share_btn); sellShareBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Purchase purchase = new Purchase(); purchase.setId(databaseHandler.getNextKey("purchase")); purchase.setName(spinner.getSelectedItem().toString()); String stringStartDate = year_start + " " + month_start + " " + day_start; DateFormat format = new SimpleDateFormat("yyyy MM dd", Locale.ENGLISH); try { Date date = format.parse(stringStartDate); purchase.setDate(date); } catch (Exception e) { Toast.makeText(getActivity(), "Invalid Date", Toast.LENGTH_SHORT).show(); return; } EditText quantity = (EditText) dialog.findViewById(R.id.no_of_shares); try { purchase.setQuantity(Integer.parseInt(quantity.getText().toString())); } catch (Exception e) { Toast.makeText(getActivity(), "Invalid Number of Shares", Toast.LENGTH_SHORT).show(); return; } EditText price = (EditText) dialog.findViewById(R.id.selling_price); try { purchase.setPrice(Double.parseDouble(price.getText().toString())); } catch (Exception e) { Toast.makeText(getActivity(), "Invalid Selling Price", Toast.LENGTH_SHORT).show(); return; } purchase.setType("sell"); databaseHandler.addPurchase(spinner.getSelectedItem().toString(), purchase); setRecyclerViewAdapter(); dialog.dismiss(); } }); } }); return root; }
From source file:com.example.com.benasque2014.mercurio.FamiliaMapaFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.action_details) { Dialog d = new Dialog(getActivity()); d.setTitle("Detalles del trayecto"); d.setContentView(R.layout.dialog_details); TextView text = (TextView) d.findViewById(R.id.text); text.setText(""); text.append("Nombre: " + recorrido.getName() + "\n"); text.append("Cdigo: " + recorrido.getCodigo() + "\n"); text.append("Clase: " + recorrido.getClase() + "\n"); text.append("Hora inicio: " + recorrido.getHoraInicio() + "\n"); text.append("Hora fin: " + recorrido.getHoraFin() + "\n"); text.append("Frecuencia: " + recorrido.getFrecuencia() + "\n"); text.append("Incidencia: " + recorrido.getIncidencia() + "\n"); d.show();/* w w w . j a v a 2 s . c o m*/ } return super.onOptionsItemSelected(item); }
From source file:de.hero.vertretungsplan.PrefsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); mySharedPreferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); ListPreference listPref = (ListPreference) findPreference("prefs_benachrichtigungsintervall"); listPref.setSummary(/*from www . j a va2 s . co m*/ getSummaryInterval(mySharedPreferences.getString("prefs_benachrichtigungsintervall", "1"))); listPref.setOnPreferenceChangeListener(new ListPreference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { preference.setSummary(getSummaryInterval(newValue.toString())); MainActivity.setNewAlarm(getBaseContext(), true, newValue.toString()); return true; } }); Preference klasse = findPreference("prefs_klasse"); klasse.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { showDialog(R.string.dialog_klasse); return true; } }); CheckBoxPreference ckBxPref = (CheckBoxPreference) findPreference("prefs_benachrichtigungen"); ckBxPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals("prefs_benachrichtigungen")) { MainActivity.setNewAlarm(getBaseContext(), !((CheckBoxPreference) preference).isChecked(), mySharedPreferences); } return true; } }); CheckBoxPreference ckBxPrefAppUpdate = (CheckBoxPreference) findPreference("prefs_check_for_app_updates"); ckBxPrefAppUpdate.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals("prefs_check_for_app_updates")) { Intent i = new Intent(getBaseContext(), CheckForAppUpdate.class); i.putExtra("setTimer", !((CheckBoxPreference) preference).isChecked()); if (!((CheckBoxPreference) preference).isChecked()) { i.putExtra("checkNow", true); } getBaseContext().startService(i); } return true; } }); Preference ueber = findPreference("ueber"); ueber.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { Dialog ueberDialog = new Dialog(PrefsActivity.this); ueberDialog.setContentView(R.layout.ueber_dialog_layout); ueberDialog.setTitle(getString(R.string.ueber)); ueberDialog.setCancelable(true); ueberDialog.setCanceledOnTouchOutside(true); TextView dialogText = (TextView) ueberDialog.findViewById(R.id.text_in_dialog); dialogText.setTextColor(Color.BLACK); dialogText.setAutoLinkMask(Linkify.ALL); dialogText.setText(String.format(getString(R.string.ueberTextFormated), getString(R.string.version_nr), getString(R.string.emailAdresseEntwickler), getString(R.string.webAdresseAppDownload), getString(R.string.GNU_GPLwebadresse))); ueberDialog.show(); return true; } }); CheckBoxPreference ckBxPrefDebugging = (CheckBoxPreference) findPreference("prefs_debug"); ckBxPrefDebugging.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals("prefs_debug")) { Log.d("PrefsActivity", "new"); if (!((CheckBoxPreference) preference).isChecked()) { AlertDialog.Builder builder = new AlertDialog.Builder(preference.getContext()); builder.setMessage(getString(R.string.debugText)).setTitle(getString(R.string.debugTitel)); AlertDialog dialog = builder.create(); dialog.show(); } } return true; } }); }
From source file:im.neon.fragments.ImageSizeSelectionDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog d = super.onCreateDialog(savedInstanceState); if (null != savedInstanceState) { if (savedInstanceState.containsKey(SELECTIONS_LIST)) { mEntries = (ArrayList<ImageCompressionDescription>) savedInstanceState .getSerializable(SELECTIONS_LIST); }//from w w w. ja va 2s. c o m } d.setTitle(getString(R.string.compression_options)); return d; }