List of usage examples for android.app Dialog setContentView
public void setContentView(@NonNull View view)
From source file:com.sentaroh.android.Utilities.LogUtil.CommonLogFileListDialogFragment.java
private void confirmSendLog() { CommonLogUtil.flushLog(mContext, mGp); mThemeColorList = ThemeUtil.getThemeColorList(getActivity()); createTempLogFile();/*from w w w . jav a 2s. c o m*/ final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.confirm_send_log_dlg); dialog.setCanceledOnTouchOutside(false); LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.confirm_send_log_dlg_title_view); title_view.setBackgroundColor(mThemeColorList.dialog_title_background_color); TextView title = (TextView) dialog.findViewById(R.id.confirm_send_log_dlg_title); title.setTextColor(mThemeColorList.text_color_dialog_title); TextView msg = (TextView) dialog.findViewById(R.id.confirm_send_log_dlg_msg); msg.setTextColor(mThemeColorList.text_color_info); msg.setBackgroundColor(mThemeColorList.dialog_msg_background_color); 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://" + mGp.getLogDirName() + "temp_log.txt"), "text/plain"); startActivity(intent); } }); btn_ok.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { sendLogFileToDeveloper(mGp.getLogDirName() + "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.haibison.android.anhuu.utils.ui.bookmark.BookmarkFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (BuildConfig.DEBUG) Log.d(CLASSNAME, "onCreateDialog()"); Dialog dialog = new Dialog(getActivity(), UI.resolveAttribute(getActivity(), R.attr.anhuu_f5be488d_theme_dialog)); dialog.setCanceledOnTouchOutside(true); dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); dialog.setTitle(R.string.anhuu_f5be488d_title_bookmark_manager); dialog.setContentView(initContentView(dialog.getLayoutInflater(), null)); dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.anhuu_f5be488d_bookmarks_dark); return dialog; }
From source file:com.hp.map.CustomerMapActivity.java
public void menuDialog() { final Dialog dialog = new Dialog(this); LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = li.inflate(R.layout.menu_dialog, null, false); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(v); dialog.setTitle("Danh mc chnh"); Display display = getWindowManager().getDefaultDisplay(); dialog.getWindow().setLayout(2 * display.getWidth() / 3, LayoutParams.FILL_PARENT); dialog.getWindow().getAttributes().gravity = Gravity.LEFT | Gravity.CENTER_VERTICAL; lv = (ListView) dialog.findViewById(R.id.menu_list_view); lv.setAdapter(//from w w w. jav a 2 s. c o m new DialogArrayAdapter(context, android.R.layout.simple_list_item_1, DetailListData.MENU_LIST)); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub DetailsList selectedValue = (DetailsList) lv.getAdapter().getItem(arg2); if (selectedValue.activityClass != null) { //if sigout if (selectedValue.activityClass == LoginActivity.class) { //LoginActivity.threadLooper.quit(); } startActivity(new Intent(context, selectedValue.activityClass)); } } }); dialog.show(); // ImageView iv = (ImageView)dialog.findViewById(R.id.menu_list_view); // iv.setImageResource(1); }
From source file:org.thoughtland.xlocation.ActivityApp.java
@SuppressLint("InflateParams") public static void showHelp(ActivityBase context, View parent, Hook hook) { // Build dialog Dialog dlgHelp = new Dialog(context); dlgHelp.requestWindowFeature(Window.FEATURE_LEFT_ICON); dlgHelp.setTitle(R.string.app_name); dlgHelp.setContentView(R.layout.helpfunc); dlgHelp.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, context.getThemed(R.attr.icon_launcher)); dlgHelp.setCancelable(true);/*from w w w . j ava 2s. c o m*/ // Set title TextView tvTitle = (TextView) dlgHelp.findViewById(R.id.tvTitle); tvTitle.setText(hook.getName()); // Set info TextView tvInfo = (TextView) dlgHelp.findViewById(R.id.tvInfo); tvInfo.setText(Html.fromHtml(hook.getAnnotation())); tvInfo.setMovementMethod(LinkMovementMethod.getInstance()); // Set permissions String[] permissions = hook.getPermissions(); if (permissions != null && permissions.length > 0) if (!permissions[0].equals("")) { TextView tvPermissions = (TextView) dlgHelp.findViewById(R.id.tvPermissions); tvPermissions.setText(Html.fromHtml(TextUtils.join("<br />", permissions))); } dlgHelp.show(); }
From source file:com.android.cabapp.fragments.MyAccountFragment.java
void showDialog() { final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.device_id_dialog); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false);// w w w .j a v a2 s . co m etDeviceName = (EditText) dialog.findViewById(R.id.etDeviceName); rlBtnSave = (RelativeLayout) dialog.findViewById(R.id.rlbtnSave); rlBtnCancel = (RelativeLayout) dialog.findViewById(R.id.rlbtnCancel); if (!Util.getPOSDeviceName(mContext).equals("")) etDeviceName.setText(Util.getPOSDeviceName(mContext)); etDeviceName.setSelection(etDeviceName.getText().length()); // dialog.setTitle("Please enter Serial number"); rlBtnSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String szDeviceName = etDeviceName.getText().toString().trim(); if (szDeviceName.isEmpty()) { Util.showToastMessage(mContext, "Field cannot be left empty!", Toast.LENGTH_LONG); } else if (szDeviceName.length() < 11) { Util.showToastMessage(mContext, "Serial number cannot be less than 10!", Toast.LENGTH_LONG); } else { Util.setPOSDeviceName(mContext, szDeviceName); tvDeviceID.setVisibility(View.VISIBLE); tvDeviceID.setText(Util.getPOSDeviceName(mContext)); Util.hideSoftKeyBoard(mContext, rlBtnSave); dialog.dismiss(); } } }); rlBtnCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Util.hideSoftKeyBoard(mContext, v); dialog.dismiss(); } }); dialog.show(); }
From source file:org.mythdroid.remote.TVRemote.java
@Override public Dialog onCreateDialog(int id) { switch (id) { case DIALOG_NUMPAD: final Dialog pad = new Dialog(this); pad.setContentView(R.layout.numpad); pad.findViewById(android.R.id.title).setVisibility(View.GONE); View button;//from w w w. jav a 2 s. c om int size = nums.size(); for (int i = 0; i < size; i++) { int viewId = nums.keyAt(i); button = pad.findViewById(viewId); button.setTag(nums.get(viewId)); button.setOnClickListener(this); } return pad; case DIALOG_GUIDE: return new AlertDialog.Builder(ctx).setIcon(drawable.ic_menu_upload_you_tube) .setTitle(R.string.dispGuide) .setAdapter(new ArrayAdapter<String>(ctx, R.layout.simple_list_item_1, new String[] {}), null) .create(); case DIALOG_QUIT: OnClickListener cl = new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); switch (which) { case Dialog.BUTTON_POSITIVE: jump = true; break; case Dialog.BUTTON_NEUTRAL: jump = false; setResult(REMOTE_RESULT_FINISH); break; default: return; } done(); } }; return new AlertDialog.Builder(ctx).setTitle(R.string.leaveRemote).setMessage(R.string.haltPlayback) .setPositiveButton(R.string.yes, cl).setNeutralButton(R.string.no, cl) .setNegativeButton(R.string.cancel, cl).create(); case FRONTEND_CHOOSER: return moveHelper.frontendChooserDialog(feMgr, feLock); case DIALOG_MOVE: return moveHelper.movePromptDialog(feMgr, feLock); } return super.onCreateDialog(id); }
From source file:nf.frex.android.FrexActivity.java
private Dialog createColorsDialog() { Dialog dialog = new Dialog(this); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setContentView(R.layout.colors_dialog); dialog.setTitle(getString(R.string.colors)); dialog.setCancelable(true);/*from ww w. j a v a 2 s . c o m*/ dialog.setCanceledOnTouchOutside(true); return dialog; }
From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java
void init() { // img=(ImageView)findViewById(R.id.logo); TextView build = (TextView) findViewById(R.id.checkfornew); build.setOnClickListener(new View.OnClickListener() { @Override/*from ww w . j a v a 2s. c om*/ public void onClick(View v) { if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } CommonUtilities.logMe("about to check for version "); try { WebServiceHandler wsb = new WebServiceHandler(); ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>(); String result = wsb.getWebServiceData("http://doe.emergencyskills.com/api/version.php", postParameters); JSONObject jsonObject = new JSONObject(result); String version = jsonObject.getString("version"); String features = jsonObject.getString("features"); System.err.println("version is : " + version); if (!LoginActivity.myversion.equals(version)) { MyToast.popmessagelong( "There is a new build available. Please download for these features: " + features, TabsActivity.this); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://vireo.org/esiapp")); browserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(browserIntent); } else { MyToast.popmessagelong("You have the most current version!", TabsActivity.this); } } catch (Exception exc) { exc.printStackTrace(); } } }); TextView maillog = (TextView) findViewById(R.id.maillog); maillog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(TabsActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_logout); TextView question = (TextView) dialog.findViewById(R.id.question); question.setText("Are you sure you want to email the log?"); TextView extra = (TextView) dialog.findViewById(R.id.extratext); extra.setText(""); dialog.getWindow().setBackgroundDrawable( new ColorDrawable(getResources().getColor(android.R.color.transparent))); Button yes = (Button) dialog.findViewById(R.id.yesbtn); yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, new String[] { "rachelc@gmail.com" }); i.putExtra(Intent.EXTRA_SUBJECT, "Sending Log"); i.putExtra(Intent.EXTRA_TEXT, "body of email"); try { startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(TabsActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } finish(); } }); Button no = (Button) dialog.findViewById(R.id.nobtn); no.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); ImageView close = (ImageView) dialog.findViewById(R.id.ivClose); close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }); listops listops = new listops(TabsActivity.this); CommonUtilities.logMe("logging in as: " + listops.getString("firstname")); TextView name = (TextView) findViewById(R.id.welcome); name.setText("Welcome, " + listops.getString("firstname")); TextView logoutname = (TextView) findViewById(R.id.logoutname); logoutname.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(TabsActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_logout); dialog.getWindow().setBackgroundDrawable( new ColorDrawable(getResources().getColor(android.R.color.transparent))); dialog.setContentView(R.layout.dialog_logout); Button yes = (Button) dialog.findViewById(R.id.yesbtn); yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MyToast.popmessagelong("Logging out... ", TabsActivity.this); SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putString(Constants.loginkey, ""); editor.commit(); listops listops = new listops(TabsActivity.this); //make sure to remove the downloaded schools Intent intent = new Intent(TabsActivity.this, LoginActivity.class); startActivity(intent); ArrayList<Schoolinfomodel> ls = new ArrayList<Schoolinfomodel>(); listops.putdrilllist(ls); listops.putservicelist(ls); listops.putinstallllist(ls); ArrayList<PendingUploadModel> l = new ArrayList<PendingUploadModel>(); listops.putpendinglist(l); finish(); } }); Button no = (Button) dialog.findViewById(R.id.nobtn); no.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); ImageView close = (ImageView) dialog.findViewById(R.id.ivClose); close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }); ll1 = (LinearLayout) findViewById(R.id.ll1); ll2 = (LinearLayout) findViewById(R.id.ll2); ll3 = (LinearLayout) findViewById(R.id.ll3); ll4 = (LinearLayout) findViewById(R.id.ll4); ll5 = (LinearLayout) findViewById(R.id.ll5); ll6 = (LinearLayout) findViewById(R.id.ll6); ll1.setBackgroundColor(getResources().getColor(R.color.White)); llPickSchools = (LinearLayout) findViewById(R.id.llPickSchool); llDrills = (LinearLayout) findViewById(R.id.llDrills); llServiceCalls = (LinearLayout) findViewById(R.id.llServiceCalls); llNewInstalls = (LinearLayout) findViewById(R.id.llNewInstalls); llPendingUploads = (LinearLayout) findViewById(R.id.llPendingUploads); frameLayout = (FrameLayout) findViewById(R.id.frame); }
From source file:org.wso2.emm.agent.AuthenticationActivity.java
/** * Show the license text retrieved from the server. * * @param message Message text to be shown as the license. * @param title Title of the license.//from ww w. ja v a2s.c o m */ private void showAgreement(final String message, String title) { AuthenticationActivity.this.runOnUiThread(new Runnable() { @Override public void run() { final Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.custom_terms_popup); dialog.setTitle(Constants.EULA_TITLE); dialog.setCancelable(false); WebView webView = (WebView) dialog.findViewById(R.id.webview); webView.loadDataWithBaseURL(null, message, Constants.MIME_TYPE, Constants.ENCODING_METHOD, null); Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); Button cancelButton = (Button) dialog.findViewById(R.id.dialogButtonCancel); dialogButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Preference.putBoolean(context, Constants.PreferenceFlag.IS_AGREED, true); dialog.dismiss(); //load the next intent based on ownership type checkManifestPermissions(); } }); cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); CommonUtils.clearClientCredentials(context); cancelEntry(); } }); dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getRepeatCount() == Constants.DEFAILT_REPEAT_COUNT) { return true; } else if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == Constants.DEFAILT_REPEAT_COUNT) { return true; } return false; } }); dialog.show(); } }); }
From source file:org.glucosio.android.fragment.OverviewFragment.java
private void showA1cDialog() { final Dialog a1CDialog = new Dialog(getActivity(), R.style.GlucosioTheme); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(a1CDialog.getWindow().getAttributes()); a1CDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT; a1CDialog.setContentView(R.layout.dialog_a1c); a1CDialog.getWindow().setAttributes(lp); a1CDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); a1CDialog.getWindow().setDimAmount(0.5f); a1CDialog.setCanceledOnTouchOutside(true); a1CDialog.show();//from w w w .j av a 2s. co m ListView a1cListView = (ListView) a1CDialog.findViewById(R.id.dialog_a1c_listview); A1cEstimateAdapter customAdapter = new A1cEstimateAdapter(getActivity(), R.layout.dialog_a1c_item, presenter.getA1cEstimateList()); a1cListView.setAdapter(customAdapter); }