List of usage examples for android.app Dialog setCancelable
public void setCancelable(boolean flag)
From source file:com.amazon.appstream.fireclient.ErrorDialogFragment.java
/** * Standard initialization. Sets up the dialog to quit the * activity on clicking its only button. *//*from w w w .j a v a 2s .co m*/ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); dialog.getWindow().setBackgroundDrawable(ConnectDialogFragment.mEmpty); dialog.setContentView(R.layout.fatal_error); final Button signin = (Button) dialog.findViewById(R.id.signin); final TextView message = (TextView) dialog.findViewById(R.id.message); message.setText(mMessage); signin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); ((FireClientActivity) getActivity()).openConnectDialog(null); } }); return dialog; }
From source file:com.amazon.appstream.sampleclient.ErrorDialogFragment.java
/** * Standard initialization. Sets up the dialog to quit the * activity on clicking its only button. *///from w w w . jav a 2 s . c om @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); dialog.getWindow().setBackgroundDrawable(ConnectDialogFragment.mEmpty); dialog.setContentView(R.layout.fatal_error); final Button signin = (Button) dialog.findViewById(R.id.signin); final TextView message = (TextView) dialog.findViewById(R.id.message); message.setText(mMessage); signin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); ((SampleClientActivity) getActivity()).openConnectDialog(null); } }); return dialog; }
From source file:de.awisus.refugeeaidleipzig.views.login.FragmentAnmelden.java
/** * Called when this dialogue is created; Android-specific * Inflates the layout, initialises text field and spinner, initialises the spinner adapter to * show up accommodations and sets the dialogue buttons * * @param savedInstanceState Bundle of saved instance state * @return dialogue created by the AlertDialog.Builder *///from ww w . j a v a 2s. co m @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Button btAnmelden, btNeu; AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); View view = getActivity().getLayoutInflater().inflate(R.layout.fragment_anmelden, null); warnungID = R.string.warnung_anmelden; etName = (EditText) view.findViewById(R.id.etName); etPasswort = (EditText) view.findViewById(R.id.etPassword); btAnmelden = (Button) view.findViewById(R.id.btAnmelden); btNeu = (Button) view.findViewById(R.id.btNeu); btAnmelden.setOnClickListener(this); btNeu.setOnClickListener(this); builder.setView(view); Dialog dialog = builder.create(); dialog.setTitle(R.string.titel_login); dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); return dialog; }
From source file:com.osama.cryptofm.startup.OptionActivity.java
private void generateKeys() { //show password dialog final Dialog dialog = new Dialog(this); dialog.setCancelable(false); dialog.setContentView(R.layout.passwords_fragment_layout); dialog.setTitle("keys password"); final TextInputEditText editText = (TextInputEditText) dialog.findViewById(R.id.gen_keys_password_edit); final TextInputEditText confirmEditText = (TextInputEditText) dialog .findViewById(R.id.gen_keys_password_edit_confirm); dialog.show();/*from w ww . j a va2s .com*/ dialog.findViewById(R.id.trigger_gen_key_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //test the passwords if (isValidPassword(editText.getText())) { if (editText.getText().toString().equals(confirmEditText.getText().toString())) { //be sure to dismiss the dialog dialog.dismiss(); //start the async task mKeyPassword = editText.getText().toString(); new KeyGenerationTask().execute(); } else { confirmEditText.setError("Password does not match"); } } else { editText.setError("Password should contain at least three characters"); } } }); dialog.findViewById(R.id.cancel_dialog_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); }
From source file:com.doodle.android.chips.dialog.ChipsEmailDialogFragment.java
@NonNull @Override/*ww w . ja v a 2 s . com*/ public Dialog onCreateDialog(Bundle savedInstanceState) { View view = View.inflate(getContext(), R.layout.dialog_chips_email, null); Dialog dialog = new AlertDialog.Builder(getActivity()).setCancelable(true).setView(view).create(); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); setCancelable(true); mEditText = (MaterialEditText) view.findViewById(R.id.et_ch_email); mConfirm = (Button) view.findViewById(R.id.bu_ch_confirm); mCancel = (Button) view.findViewById(R.id.bu_ch_cancel); TextView titleView = (TextView) view.findViewById(R.id.tv_ch_title); mErrorMsg = getString(R.string.please_enter_a_valid_email_address); Bundle bundle = getArguments(); if (bundle != null) { if (bundle.containsKey(EXTRA_STRING_TEXT)) { mInitialText = bundle.getString(EXTRA_STRING_TEXT); mEditText.setText(mInitialText); } if (bundle.containsKey(EXTRA_STRING_TITLE)) titleView.setText(bundle.getString(EXTRA_STRING_TITLE)); if (bundle.containsKey(EXTRA_STRING_PLACEHOLDER)) { mEditText.setHint(bundle.getString(EXTRA_STRING_PLACEHOLDER)); mEditText.setFloatingLabelText(bundle.getString(EXTRA_STRING_PLACEHOLDER)); } if (bundle.containsKey(EXTRA_STRING_CONFIRM)) mConfirm.setText(bundle.getString(EXTRA_STRING_CONFIRM)); if (bundle.containsKey(EXTRA_STRING_CANCEL)) mCancel.setText(bundle.getString(EXTRA_STRING_CANCEL)); if (bundle.containsKey(EXTRA_STRING_ERROR_MSG)) mErrorMsg = bundle.getString(EXTRA_STRING_ERROR_MSG); } mConfirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { positiveClick(); } }); mCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { negativeClick(); } }); mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { positiveClick(); return true; } }); return dialog; }
From source file:com.slownet5.pgprootexplorer.filemanager.listview.FileSelectionManagement.java
void openFile(final String filename) { if (SharedData.IS_IN_COPY_MODE) { return;// w w w . ja v a2 s . c o m } if (FileUtils.isEncryptedFile(filename)) { Log.d(TAG, "openFile: File name is: " + filename); if (SharedData.KEY_PASSWORD == null) { final Dialog dialog = new Dialog(mContext); dialog.setCancelable(false); dialog.setContentView(R.layout.password_dialog_layout); dialog.show(); dialog.findViewById(R.id.cancel_decrypt_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); final EditText editText = (EditText) dialog.findViewById(R.id.key_password); dialog.findViewById(R.id.decrypt_file_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (editText.getText().length() < 1) { editText.setError("please give me your encryption password"); return; } else { SharedData.KEY_PASSWORD = editText.getText().toString(); dialog.dismiss(); new DecryptTask(mContext, mFileListAdapter, SharedData.DB_PASSWORD, SharedData.USERNAME, filename, SharedData.KEY_PASSWORD).execute(); } } }); } else { new DecryptTask(mContext, mFileListAdapter, SharedData.DB_PASSWORD, SharedData.USERNAME, filename, SharedData.KEY_PASSWORD).execute(); } } else { UiUtils.openFile(filename, mContext, mFileListAdapter); } }
From source file:com.zpwebsites.linuxonandroid.Install_Fedora_2.java
private void downloads(Context context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.download_fedora_menu); dialog.setCancelable(true); Button btn_DownloadLarge = (Button) dialog.findViewById(R.id.btn_DownloadLarge); btn_DownloadLarge.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (AppPreferences.getPrefs().getString("ANDROID", "1").equals("4.3")) { downloadImage(v.getContext(), CFG.torrentURL_Fedora_Large_ext4, CFG.imageURL_Fedora_Large_ext4); } else { downloadImage(v.getContext(), CFG.torrentURL_Fedora_Large_ext2, CFG.imageURL_Fedora_Large_ext2); }/* www . ja v a 2s . c o m*/ dialog.dismiss(); } }); dialog.show(); }
From source file:org.tigase.mobile.muc.JoinMucDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Dialog dialog = new Dialog(getActivity()); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); dialog.setContentView(R.layout.join_room_dialog); dialog.setTitle(getString(R.string.aboutButton)); ArrayList<String> accounts = new ArrayList<String>(); for (Account account : AccountManager.get(getActivity()).getAccountsByType(Constants.ACCOUNT_TYPE)) { accounts.add(account.name);//from w w w . jav a 2 s . c o m } final Spinner accountSelector = (Spinner) dialog.findViewById(R.id.muc_accountSelector); final Button joinButton = (Button) dialog.findViewById(R.id.muc_joinButton); final Button cancelButton = (Button) dialog.findViewById(R.id.muc_cancelButton); final TextView name = (TextView) dialog.findViewById(R.id.muc_name); final TextView roomName = (TextView) dialog.findViewById(R.id.muc_roomName); final TextView mucServer = (TextView) dialog.findViewById(R.id.muc_server); final TextView nickname = (TextView) dialog.findViewById(R.id.muc_nickname); final TextView password = (TextView) dialog.findViewById(R.id.muc_password); final CheckBox autojoin = (CheckBox) dialog.findViewById(R.id.muc_autojoin); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, accounts.toArray(new String[] {})); accountSelector.setAdapter(adapter); Bundle data = getArguments(); final boolean editMode = data != null && data.containsKey("editMode") && data.getBoolean("editMode"); final String id = data != null ? data.getString("id") : null; if (data != null) { accountSelector.setSelection(adapter.getPosition(data.getString("account"))); name.setText(data.getString("name")); roomName.setText(data.getString("room")); mucServer.setText(data.getString("server")); nickname.setText(data.getString("nick")); password.setText(data.getString("password")); autojoin.setChecked(data.getBoolean("autojoin")); } if (!editMode) { name.setVisibility(View.GONE); autojoin.setVisibility(View.GONE); } else { joinButton.setText("Save"); } cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); joinButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (editMode) { BareJID account = BareJID.bareJIDInstance(accountSelector.getSelectedItem().toString()); final Jaxmpp jaxmpp = ((MessengerApplication) getActivity().getApplicationContext()) .getMultiJaxmpp().get(account); Bundle data = new Bundle(); data.putString("id", id); data.putString("account", account.toString()); data.putString("name", name.getText().toString()); data.putString("room", roomName.getText().toString()); data.putString("server", mucServer.getText().toString()); data.putString("nick", nickname.getText().toString()); data.putString("password", password.getText().toString()); data.putBoolean("autojoin", autojoin.isChecked()); ((BookmarksActivity) getActivity()).saveItem(data); dialog.dismiss(); return; } BareJID account = BareJID.bareJIDInstance(accountSelector.getSelectedItem().toString()); final Jaxmpp jaxmpp = ((MessengerApplication) getActivity().getApplicationContext()) .getMultiJaxmpp().get(account); Runnable r = new Runnable() { @Override public void run() { try { Room room = jaxmpp.getModule(MucModule.class).join( roomName.getEditableText().toString(), mucServer.getEditableText().toString(), nickname.getEditableText().toString(), password.getEditableText().toString()); if (task != null) task.execute(room); } catch (Exception e) { Log.w("MUC", "", e); // TODO Auto-generated catch block e.printStackTrace(); } } }; (new Thread(r)).start(); dialog.dismiss(); } }); return dialog; }
From source file:net.bither.ui.base.DialogFragmentHDMSingularColdSeed.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); setCancelable(false);// w w w .ja v a 2 s .co m return dialog; }
From source file:com.zpwebsites.linuxonandroid.opensource.Install_Ubuntu10_2.java
private void downloads(Context context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.download_ubuntu10_menu); dialog.setCancelable(true); Button btn_DownloadLarge = (Button) dialog.findViewById(R.id.btn_DownloadLarge); btn_DownloadLarge.setOnClickListener(new OnClickListener() { public void onClick(View v) { downloadImage(v.getContext(), CFG.torrentURL_Ubuntu10_Large, CFG.imageURL_Ubuntu10_Large); dialog.dismiss();/*from ww w .j a v a 2 s . c o m*/ } }); Button btn_DownloadSmall = (Button) dialog.findViewById(R.id.btn_DownloadSmall); btn_DownloadSmall.setOnClickListener(new OnClickListener() { public void onClick(View v) { downloadImage(v.getContext(), CFG.torrentURL_Ubuntu10_Small, CFG.imageURL_Ubuntu10_Small); dialog.dismiss(); } }); dialog.show(); }