List of usage examples for android.app Dialog requestWindowFeature
public final boolean requestWindowFeature(int featureId)
From source file:biz.bokhorst.xprivacy.ActivityMain.java
private void optionTutorial() { ((ScrollView) findViewById(R.id.svTutorialHeader)).setVisibility(View.VISIBLE); ((ScrollView) findViewById(R.id.svTutorialDetails)).setVisibility(View.VISIBLE); int userId = Util.getUserId(Process.myUid()); PrivacyManager.setSetting(userId, PrivacyManager.cSettingTutorialMain, Boolean.FALSE.toString()); Dialog dlgUsage = new Dialog(this); dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON); dlgUsage.setTitle(R.string.title_usage_header); dlgUsage.setContentView(R.layout.usage); dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); dlgUsage.setCancelable(true);// w ww. ja v a 2 s.co m dlgUsage.show(); }
From source file:biz.bokhorst.xprivacy.ActivityMain.java
private void optionLegend() { // Show help//w w w . java 2s. co m Dialog dialog = new Dialog(ActivityMain.this); dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); dialog.setTitle(R.string.menu_legend); dialog.setContentView(R.layout.legend); 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()); for (View child : Util.getViewsByTag((ViewGroup) dialog.findViewById(android.R.id.content), "details")) child.setVisibility(View.GONE); ((LinearLayout) dialog.findViewById(R.id.llUnsafe)) .setVisibility(PrivacyManager.cVersion3 ? View.VISIBLE : View.GONE); dialog.setCancelable(true); dialog.show(); }
From source file:biz.bokhorst.xprivacy.ActivityMain.java
@SuppressLint("DefaultLocale") private void optionAbout() { // About//from www . j av a 2 s . c o m Dialog dlgAbout = new Dialog(this); dlgAbout.requestWindowFeature(Window.FEATURE_LEFT_ICON); dlgAbout.setTitle(R.string.menu_about); dlgAbout.setContentView(R.layout.about); dlgAbout.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); // Show version try { int userId = Util.getUserId(Process.myUid()); Version currentVersion = new Version(Util.getSelfVersionName(this)); Version storedVersion = new Version( PrivacyManager.getSetting(userId, PrivacyManager.cSettingVersion, "0.0")); boolean migrated = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingMigrated, false); String versionName = currentVersion.toString(); if (currentVersion.compareTo(storedVersion) != 0) versionName += "/" + storedVersion.toString(); if (!migrated) versionName += "!"; int versionCode = Util.getSelfVersionCode(this); TextView tvVersion = (TextView) dlgAbout.findViewById(R.id.tvVersion); tvVersion.setText(String.format(getString(R.string.app_version), versionName, versionCode)); } catch (Throwable ex) { Util.bug(null, ex); } if (!PrivacyManager.cVersion3 || Hook.isAOSP(19)) ((TextView) dlgAbout.findViewById(R.id.tvCompatibility)).setVisibility(View.GONE); // Show license String licensed = Util.hasProLicense(this); TextView tvLicensed1 = (TextView) dlgAbout.findViewById(R.id.tvLicensed); TextView tvLicensed2 = (TextView) dlgAbout.findViewById(R.id.tvLicensedAlt); if (licensed == null) { tvLicensed1.setText(Environment.getExternalStorageDirectory().getAbsolutePath()); tvLicensed2.setText(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) .getAbsolutePath()); } else { tvLicensed1.setText(String.format(getString(R.string.app_licensed), licensed)); tvLicensed2.setVisibility(View.GONE); } // Show some build properties String android = String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT); ((TextView) dlgAbout.findViewById(R.id.tvAndroid)).setText(android); ((TextView) dlgAbout.findViewById(R.id.build_brand)).setText(Build.BRAND); ((TextView) dlgAbout.findViewById(R.id.build_manufacturer)).setText(Build.MANUFACTURER); ((TextView) dlgAbout.findViewById(R.id.build_model)).setText(Build.MODEL); ((TextView) dlgAbout.findViewById(R.id.build_product)).setText(Build.PRODUCT); ((TextView) dlgAbout.findViewById(R.id.build_device)).setText(Build.DEVICE); ((TextView) dlgAbout.findViewById(R.id.build_host)).setText(Build.HOST); ((TextView) dlgAbout.findViewById(R.id.build_display)).setText(Build.DISPLAY); ((TextView) dlgAbout.findViewById(R.id.build_id)).setText(Build.ID); dlgAbout.setCancelable(true); final int userId = Util.getUserId(Process.myUid()); if (PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFirstRun, true)) dlgAbout.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { Dialog dlgUsage = new Dialog(ActivityMain.this); dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON); dlgUsage.setTitle(R.string.app_name); dlgUsage.setContentView(R.layout.usage); dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); dlgUsage.setCancelable(true); dlgUsage.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { PrivacyManager.setSetting(userId, PrivacyManager.cSettingFirstRun, Boolean.FALSE.toString()); optionLegend(); } }); dlgUsage.show(); } }); dlgAbout.show(); }
From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java
private void confirmSendLog() { mGlblParms.util.flushLog();//from ww w. j av a 2s . c om createTempLogFile(); final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.confirm_send_log_dlg); final Button btn_ok = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_ok_btn); final Button btn_cancel = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_cancel_btn); final Button btn_preview = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_preview); CommonDialog.setDlgBoxSizeLimit(dialog, false); btn_preview.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + mEnvParms.settingLogMsgDir + "temp_log.txt"), "text/plain"); startActivity(intent); } }); btn_ok.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mGlblParms.util.sendLogFileToDeveloper(mEnvParms.settingLogMsgDir + "temp_log.txt"); dialog.dismiss(); } }); btn_cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { dialog.dismiss(); } }); dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btn_cancel.performClick(); } }); dialog.show(); }
From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java
final private void renameProfileGroupDlg(final String old_loc) { // ??// ww w .j ava 2s.c om final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // dialog.getWindow().setSoftInputMode( // WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); dialog.setContentView(R.layout.single_item_input_dlg); final TextView dlg_title = (TextView) dialog.findViewById(R.id.single_item_input_title); final EditText dlg_et_name = (EditText) dialog.findViewById(R.id.single_item_input_dir); // final TextView dlg_msg = (TextView) dialog.findViewById(R.id.single_item_input_msg); final Button btnCancel = (Button) dialog.findViewById(R.id.single_item_input_cancel_btn); final Button btnOK = (Button) dialog.findViewById(R.id.single_item_input_ok_btn); btnOK.setEnabled(false); dlg_title.setText(mContext.getString(R.string.msgs_profile_group_rename_profile_group)); CommonDialog.setDlgBoxSizeCompact(dialog); dlg_et_name.setText(old_loc); dlg_et_name.addTextChangedListener(new TextWatcher() { @Override final public void afterTextChanged(Editable s) { if (s.length() != 0) { // dlg_et_name.selectAll(); String newgrp = dlg_et_name.getText().toString(); if (!newgrp.startsWith("*")) { btnOK.setEnabled(true); for (int i = 0; i < mGlblParms.profileGroupAdapter.getCount(); i++) { if (mGlblParms.profileGroupAdapter.getItem(i).getProfileGroupName().equals(newgrp)) { btnOK.setEnabled(false); break; } } } else btnOK.setEnabled(false); } else btnOK.setEnabled(false); } @Override final public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override final public void onTextChanged(CharSequence s, int start, int before, int count) { } }); final NotifyEvent ntfy = new NotifyEvent(mContext); ntfy.setListener(new NotifyEventListener() { @Override final public void positiveResponse(Context c, Object[] o) { dlg_et_name.selectAll(); String new_loc = dlg_et_name.getText().toString(); renameProfileGroup(true, old_loc, new_loc); } @Override final public void negativeResponse(Context c, Object[] o) { } }); // CANCEL? btnCancel.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { dialog.dismiss(); } }); // OK? btnOK.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { ntfy.notifyToListener(POSITIVE, null); dialog.dismiss(); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnCancel.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(context)); // dialog.setCancelable(false); dialog.show(); }
From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java
final private void copyProfileGroupDlg(final String old_loc) { // ??//from w w w . ja v a 2 s . co m final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // dialog.getWindow().setSoftInputMode( // WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); dialog.setContentView(R.layout.single_item_input_dlg); final TextView dlg_title = (TextView) dialog.findViewById(R.id.single_item_input_title); final EditText dlg_et_name = (EditText) dialog.findViewById(R.id.single_item_input_dir); // final TextView dlg_msg = (TextView) dialog.findViewById(R.id.single_item_input_msg); final Button btnCancel = (Button) dialog.findViewById(R.id.single_item_input_cancel_btn); final Button btnOK = (Button) dialog.findViewById(R.id.single_item_input_ok_btn); btnOK.setEnabled(false); dlg_title.setText(mContext.getString(R.string.msgs_profile_group_copy_profile_group)); CommonDialog.setDlgBoxSizeCompact(dialog); dlg_et_name.setText(old_loc); dlg_et_name.addTextChangedListener(new TextWatcher() { @Override final public void afterTextChanged(Editable s) { if (s.length() != 0) { // dlg_et_name.selectAll(); String newgrp = dlg_et_name.getText().toString(); if (!newgrp.startsWith("*")) { btnOK.setEnabled(true); for (int i = 0; i < mGlblParms.profileGroupAdapter.getCount(); i++) { if (mGlblParms.profileGroupAdapter.getItem(i).getProfileGroupName().equals(newgrp)) { btnOK.setEnabled(false); break; } } } else btnOK.setEnabled(false); } else btnOK.setEnabled(false); } @Override final public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override final public void onTextChanged(CharSequence s, int start, int before, int count) { } }); final NotifyEvent ntfy = new NotifyEvent(mContext); ntfy.setListener(new NotifyEventListener() { @Override final public void positiveResponse(Context c, Object[] o) { dlg_et_name.selectAll(); String new_loc = dlg_et_name.getText().toString(); copyProfileGroup(true, old_loc, new_loc); } @Override final public void negativeResponse(Context c, Object[] o) { } }); // CANCEL? btnCancel.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { dialog.dismiss(); } }); // OK? btnOK.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { ntfy.notifyToListener(POSITIVE, null); dialog.dismiss(); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnCancel.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(context)); // dialog.setCancelable(false); dialog.show(); }
From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java
final private void createNewProfileGroup() { // ??//from w w w.ja va 2 s.c om final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // dialog.getWindow().setSoftInputMode( // WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); dialog.setContentView(R.layout.single_item_input_dlg); final TextView dlg_title = (TextView) dialog.findViewById(R.id.single_item_input_title); final EditText dlg_et_name = (EditText) dialog.findViewById(R.id.single_item_input_dir); // final TextView dlg_msg = (TextView) dialog.findViewById(R.id.single_item_input_msg); final Button btnCancel = (Button) dialog.findViewById(R.id.single_item_input_cancel_btn); final Button btnOK = (Button) dialog.findViewById(R.id.single_item_input_ok_btn); btnOK.setEnabled(false); dlg_title.setText(mContext.getString(R.string.msgs_profile_group_create_new_profile_group)); CommonDialog.setDlgBoxSizeCompact(dialog); dlg_et_name.addTextChangedListener(new TextWatcher() { @Override final public void afterTextChanged(Editable s) { if (s.length() != 0) { // dlg_et_name.selectAll(); String newgrp = dlg_et_name.getText().toString(); if (!newgrp.startsWith("*")) { btnOK.setEnabled(true); for (int i = 0; i < mGlblParms.profileGroupAdapter.getCount(); i++) { if (mGlblParms.profileGroupAdapter.getItem(i).getProfileGroupName().equals(newgrp)) { btnOK.setEnabled(false); break; } } } else btnOK.setEnabled(false); } else btnOK.setEnabled(false); } @Override final public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override final public void onTextChanged(CharSequence s, int start, int before, int count) { } }); final NotifyEvent ntfy = new NotifyEvent(mContext); ntfy.setListener(new NotifyEventListener() { @Override final public void positiveResponse(Context c, Object[] o) { dlg_et_name.selectAll(); String newloc = dlg_et_name.getText().toString(); mGlblParms.profileGroupAdapter.add(new ProfileGroupListItem(newloc, false, 0, 0, 0)); mGlblParms.profileGroupAdapter.sort(); mGlblParms.profileGroupAdapter.notifyDataSetChanged(); ProfileListItem tpli = new ProfileListItem(); tpli.setTaskEntry(PROFILE_VERSION_CURRENT, newloc, false, System.currentTimeMillis(), "", mContext.getString(R.string.msgs_no_profile_entry), "", "", "", "", null, null); mGlblParms.profileAdapter.addDataListItem(tpli); mGlblParms.profileAdapter.updateShowList(); setProfileGroupSelectorListener(); } @Override final public void negativeResponse(Context c, Object[] o) { } }); // CANCEL? btnCancel.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { dialog.dismiss(); } }); // OK? btnOK.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { ntfy.notifyToListener(POSITIVE, null); dialog.dismiss(); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnCancel.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(context)); // dialog.setCancelable(false); dialog.show(); }
From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java
@SuppressLint("NewApi") final private void aboutTaskAutomation() { // common ??/* w w w. j a v a 2s. co m*/ final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.about_dialog); ((TextView) dialog.findViewById(R.id.about_dialog_title)) .setText(getString(R.string.msgs_about_dlg_title) + " Ver " + getApplVersionName()); final WebView func_view = (WebView) dialog.findViewById(R.id.about_dialog_function); // func_view.setWebViewClient(new WebViewClient()); // func_view.getSettings().setJavaScriptEnabled(true); func_view.getSettings().setSupportZoom(true); // func_view.setVerticalScrollbarOverlay(true); func_view.setBackgroundColor(Color.LTGRAY); // func_view.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); func_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET); func_view.setVerticalScrollBarEnabled(true); func_view.setScrollbarFadingEnabled(false); if (Build.VERSION.SDK_INT > 10) { func_view.getSettings().setDisplayZoomControls(true); func_view.getSettings().setBuiltInZoomControls(true); } else { func_view.getSettings().setBuiltInZoomControls(true); } func_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_about_dlg_func_html)); final WebView change_view = (WebView) dialog.findViewById(R.id.about_dialog_change_history); if (Build.VERSION.SDK_INT > 10) { func_view.getSettings().setDisplayZoomControls(true); func_view.getSettings().setBuiltInZoomControls(true); } else { func_view.getSettings().setBuiltInZoomControls(true); } change_view.loadDataWithBaseURL("file:///android_asset/", getString(R.string.msgs_about_dlg_change_desc), "text/html", "UTF-8", ""); change_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); change_view.getSettings().setSupportZoom(true); if (Build.VERSION.SDK_INT > 10) { change_view.getSettings().setDisplayZoomControls(true); change_view.getSettings().setBuiltInZoomControls(true); } else { change_view.getSettings().setBuiltInZoomControls(true); } final Button btnFunc = (Button) dialog.findViewById(R.id.about_dialog_btn_show_func); final Button btnChange = (Button) dialog.findViewById(R.id.about_dialog_btn_show_change); final Button btnOk = (Button) dialog.findViewById(R.id.about_dialog_btn_ok); func_view.setVisibility(TextView.VISIBLE); change_view.setVisibility(TextView.GONE); btnChange.setBackgroundResource(R.drawable.button_back_ground_color_selector); btnFunc.setBackgroundResource(R.drawable.button_back_ground_color_selector); btnChange.setTextColor(Color.DKGRAY); btnFunc.setTextColor(Color.GREEN); btnFunc.setEnabled(false); CommonDialog.setDlgBoxSizeLimit(dialog, true); // func? btnFunc.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { change_view.setVisibility(TextView.GONE); func_view.setVisibility(TextView.VISIBLE); CommonDialog.setDlgBoxSizeLimit(dialog, true); btnFunc.setTextColor(Color.GREEN); btnChange.setTextColor(Color.DKGRAY); btnChange.setEnabled(true); btnFunc.setEnabled(false); } }); // change? btnChange.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { change_view.setVisibility(TextView.VISIBLE); func_view.setVisibility(TextView.GONE); CommonDialog.setDlgBoxSizeLimit(dialog, true); btnChange.setTextColor(Color.GREEN); btnFunc.setTextColor(Color.DKGRAY); btnChange.setEnabled(false); btnFunc.setEnabled(true); } }); // OK? btnOk.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnOk.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(context)); // dialog.setCancelable(false); dialog.show(); }
From source file:ua.mkh.settings.full.MainActivity.java
public void update() { final Dialog dialog = new Dialog(this, android.R.style.Theme_Translucent); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); dialog.setContentView(R.layout.activity_update); dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation; Button ButtonInfo = (Button) dialog.getWindow().findViewById(R.id.button1); TextView time = (TextView) dialog.getWindow().findViewById(R.id.textView1); TextView data = (TextView) dialog.getWindow().findViewById(R.id.textView2); TextView textView3 = (TextView) dialog.getWindow().findViewById(R.id.textView3); TextView textView4 = (TextView) dialog.getWindow().findViewById(R.id.textView4); time.setTypeface(typefaceThin);//from www . ja v a 2 s. c o m data.setTypeface(typefaceRoman); textView3.setTypeface(typefaceRoman); textView4.setTypeface(typefaceRoman); ButtonInfo.setTypeface(typefaceRoman); ButtonInfo.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
From source file:ua.mkh.settings.full.MainActivity.java
public void lock() { final Dialog dialog = new Dialog(MainActivity.this, android.R.style.Theme_Translucent); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_inform); // set the custom dialog components - text, image and button Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); TextView text = (TextView) dialog.findViewById(R.id.text); TextView textB = (TextView) dialog.findViewById(R.id.textBold); text.setText(R.string.block_license); textB.setText(R.string.attention);/*from w ww . j a v a 2 s.c om*/ dialogButton.setTypeface(typefaceRoman); text.setTypeface(typefaceRoman); textB.setTypeface(typefaceBold); dialogButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }); dialog.show(); }