List of usage examples for android.app Dialog setCancelable
public void setCancelable(boolean flag)
From source file:com.zpwebsites.linuxonandroid.opensource.Install_Archlinux_2.java
private void downloads(Context context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.download_arch_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_Arch_Large, CFG.imageURL_Arch_Large); dialog.dismiss();/*from w w w . j a v a 2s . 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_Arch_Small, CFG.imageURL_Arch_Small); dialog.dismiss(); } }); Button btn_DownloadCore = (Button) dialog.findViewById(R.id.btn_DownloadCore); btn_DownloadCore.setOnClickListener(new OnClickListener() { public void onClick(View v) { downloadImage(v.getContext(), CFG.torrentURL_Arch_Core, CFG.imageURL_Arch_Core); dialog.dismiss(); } }); dialog.show(); }
From source file:com.zpwebsites.linuxonandroid.opensource.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) { downloadImage(v.getContext(), CFG.torrentURL_Fedora_Large, CFG.imageURL_Fedora_Large); dialog.dismiss();// w w w .j a v a 2 s .co 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_Fedora_Small, CFG.imageURL_Fedora_Small); dialog.dismiss(); } }); Button btn_DownloadCore = (Button) dialog.findViewById(R.id.btn_DownloadCore); btn_DownloadCore.setOnClickListener(new OnClickListener() { public void onClick(View v) { downloadImage(v.getContext(), CFG.torrentURL_Fedora_Core, CFG.imageURL_Fedora_Core); dialog.dismiss(); } }); dialog.show(); }
From source file:com.zpwebsites.linuxonandroid.Install_Debian_2.java
private void downloads(Context context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.download_debian_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_Debian_Large, CFG.imageURL_Debian_Large); dialog.dismiss();//from ww w. j av a2 s .co 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_Debian_Small, CFG.imageURL_Debian_Small); dialog.dismiss(); } }); Button btn_DownloadCore = (Button) dialog.findViewById(R.id.btn_DownloadCore); btn_DownloadCore.setOnClickListener(new OnClickListener() { public void onClick(View v) { downloadImage(v.getContext(), CFG.torrentURL_Debian_Core, CFG.imageURL_Debian_Core); dialog.dismiss(); } }); dialog.show(); }
From source file:com.zpwebsites.linuxonandroid.opensource.Install_Ubuntu12_2.java
private void downloads(Context context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.download_ubuntu12_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_Ubuntu12_Large, CFG.imageURL_Ubuntu12_Large); dialog.dismiss();/*from ww w .ja v a 2s. 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_Ubuntu12_Small, CFG.imageURL_Ubuntu12_Small); dialog.dismiss(); } }); Button btn_DownloadCore = (Button) dialog.findViewById(R.id.btn_DownloadCore); btn_DownloadCore.setOnClickListener(new OnClickListener() { public void onClick(View v) { downloadImage(v.getContext(), CFG.torrentURL_Ubuntu12_Core, CFG.imageURL_Ubuntu12_Core); dialog.dismiss(); } }); dialog.show(); }
From source file:com.flowzr.activity.DateFilterActivity.java
@Override protected Dialog onCreateDialog(final int id) { final Dialog d = new Dialog(this); d.setCancelable(true); d.setTitle(id == 1 ? R.string.period_from : R.string.period_to); d.setContentView(R.layout.filter_period_select); Button bOk = (Button) d.findViewById(R.id.bOK); bOk.setOnClickListener(new OnClickListener() { @Override/*ww w . ja v a2 s .c o m*/ public void onClick(View v) { setDialogResult(d, id == 1 ? cFrom : cTo); d.dismiss(); } }); Button bCancel = (Button) d.findViewById(R.id.bCancel); bCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { d.cancel(); } }); return d; }
From source file:com.osama.cryptofm.filemanager.listview.FileSelectionManagement.java
void openFile(final String filename) { if (SharedData.IS_IN_COPY_MODE) { return;/*ww w . j a v a 2 s. co m*/ } if (FileUtils.getExtension(filename).equals("pgp")) { 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_PASSWWORD, SharedData.USERNAME, FileUtils.CURRENT_PATH + filename, SharedData.KEY_PASSWORD) .execute(); } } }); } else { new DecryptTask(mContext, mFileListAdapter, SharedData.DB_PASSWWORD, SharedData.USERNAME, FileUtils.CURRENT_PATH + filename, SharedData.KEY_PASSWORD).execute(); } } else { //open file if (SharedData.EXTERNAL_SDCARD_ROOT_PATH != null && FileUtils.CURRENT_PATH.contains(SharedData.EXTERNAL_SDCARD_ROOT_PATH)) { //open the document file DocumentFile file = FileDocumentUtils.getDocumentFile(FileUtils.getFile(filename)); Intent intent = new Intent(); intent.setDataAndType(file.getUri(), file.getType()); intent.setAction(Intent.ACTION_VIEW); Intent x = Intent.createChooser(intent, "Open with"); mContext.startActivity(x); return; } String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(FileUtils.getExtension(filename)); Intent intent = new Intent(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); Uri uri = FileProvider.getUriForFile(mContext, mContext.getApplicationContext().getPackageName() + ".provider", FileUtils.getFile(filename)); intent.setDataAndType(uri, mimeType); } else { intent.setDataAndType(Uri.fromFile(FileUtils.getFile(filename)), mimeType); } intent.setAction(Intent.ACTION_VIEW); Intent x = Intent.createChooser(intent, "Open with: "); mContext.startActivity(x); } }
From source file:com.zpwebsites.linuxonandroid.Install_Archlinux_2.java
private void downloads(Context context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.download_arch_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_Arch_Large_ext4, CFG.imageURL_Arch_Large_ext4); } else { downloadImage(v.getContext(), CFG.torrentURL_Arch_Large_ext2, CFG.imageURL_Arch_Large_ext2); }// w w w . jav a 2 s . c o m dialog.dismiss(); } }); Button btn_DownloadSmall = (Button) dialog.findViewById(R.id.btn_DownloadSmall); btn_DownloadSmall.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (AppPreferences.getPrefs().getString("ANDROID", "1").equals("4.3")) { downloadImage(v.getContext(), CFG.torrentURL_Arch_Small_ext4, CFG.imageURL_Arch_Small_ext4); } else { downloadImage(v.getContext(), CFG.torrentURL_Arch_Small_ext2, CFG.imageURL_Arch_Small_ext2); } dialog.dismiss(); } }); Button btn_DownloadCore = (Button) dialog.findViewById(R.id.btn_DownloadCore); btn_DownloadCore.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (AppPreferences.getPrefs().getString("ANDROID", "1").equals("4.3")) { downloadImage(v.getContext(), CFG.torrentURL_Arch_Core_ext4, CFG.imageURL_Arch_Core_ext4); } else { downloadImage(v.getContext(), CFG.torrentURL_Arch_Core_ext2, CFG.imageURL_Arch_Core_ext2); } dialog.dismiss(); } }); dialog.show(); }
From source file:com.kircherelectronics.accelerationexplorer.activity.NoiseActivity.java
private void showHelpDialog() { Dialog helpDialog = new Dialog(this); helpDialog.setCancelable(true); helpDialog.setCanceledOnTouchOutside(true); helpDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); View view = getLayoutInflater().inflate(R.layout.layout_help_noise, null); helpDialog.setContentView(view);//w w w . ja v a 2s . c o m helpDialog.show(); }
From source file:com.zpwebsites.linuxonandroid.Install_Archlinux_2.java
private void downloadImage(Context context, final String torrentName, final String sourceforgeName) { if (torrentName.equals("")) { Intent localIntent = new Intent("android.intent.action.VIEW"); localIntent.setData(Uri.parse(sourceforgeName)); startActivity(localIntent);/* w w w.ja va 2 s . c o m*/ return; } final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_download_type_selector); dialog.setCancelable(true); Button btn_Torrent = (Button) dialog.findViewById(R.id.btn_Torrent); btn_Torrent.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent localIntent = new Intent("android.intent.action.VIEW"); localIntent.setData(Uri.parse(torrentName)); startActivity(localIntent); dialog.dismiss(); } }); Button btn_Sourceforge = (Button) dialog.findViewById(R.id.btn_Sourceforge); btn_Sourceforge.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent localIntent = new Intent("android.intent.action.VIEW"); localIntent.setData(Uri.parse(sourceforgeName)); startActivity(localIntent); dialog.dismiss(); } }); Button btn_Cancel = (Button) dialog.findViewById(R.id.btn_Cancel); btn_Cancel.setOnClickListener(new OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
From source file:cn.stj.fphealth.views.dialog.QrcodeDialog.java
/** * Set the dialog edit text and other attribute *///from ww w . j a v a2 s . c o m @Override public void onResume() { super.onResume(); Dialog dialog = getDialog(); dialog.setCanceledOnTouchOutside(false); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); dialog.setCancelable(false); dialog.setOnKeyListener(new QrcodeDialogKeyListener()); }