List of usage examples for android.app AlertDialog.Builder setView
public void setView(View view)
From source file:com.example.administrator.winsoftsalesproject.fragment.LicenseFragment.java
@NonNull @Override//from w w w.j a va 2 s . co m public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater dialogInflater = getActivity().getLayoutInflater(); View openSourceLicensesView = dialogInflater.inflate(R.layout.fragment_licenses, null); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()); dialogBuilder.setView(openSourceLicensesView).setTitle((getString(R.string.dialog_title_licenses))) .setNeutralButton(android.R.string.ok, null); return dialogBuilder.create(); }
From source file:com.esi.mxt07.pfe2017.alpr.PlateDialogFragment.java
@NonNull @Override/* w w w . ja va 2 s. com*/ public Dialog onCreateDialog(Bundle savedInstanceState) { // Get a layout inflater and inflate the layout LayoutInflater inflater = getActivity().getLayoutInflater(); View layout = inflater.inflate(R.layout.dialog_plate, null); // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(layout); // Set the lp number in the edit text EditText etPlateNumber = (EditText) layout.findViewById(R.id.etPlateNumber); etPlateNumber.setText(MainActivity.recognizeLicensePlate(0L)); // Set a listener to the OK button Button btnPlateDialogOK = (Button) layout.findViewById(R.id.btnPlateDialogOK); btnPlateDialogOK.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PlateDialogFragment.this.dismiss(); } }); // Create the AlertDialog object and return it return builder.create(); }
From source file:com.eugene.fithealthmaingit.UI.Dialogs.UpdateWeightDialogFragment.java
@NonNull @Override/*www. j a v a 2 s . c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { v = getActivity().getLayoutInflater().inflate(R.layout.dialog_weight, null); findViews(); // alert Dialog builder implementation AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(v); builder.setPositiveButton("Save", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { WeightLog logMeal = new WeightLog(); logMeal.setDate(new Date()); EditText editText = (EditText) v.findViewById(R.id.updateWeight); logMeal.setCurrentWeight(Double.valueOf(editText.getText().toString())); logMeal.save(); savePreferences(Globals.USER_WEIGHT, editText.getText().toString()); mCallbacks.updateWeight(); } }); builder.setNegativeButton("Cancel", null); return builder.create(); }
From source file:tr.com.turkcellteknoloji.turkcellupdater.UpdaterDialogManager.java
/** * Creates a dialog for given message./* ww w . ja va2s. c om*/ * * @param activity * Parent activity. * @param message * Message contents * @param dismissListener * Listener that will be called when dialog is closed or * cancelled. * @return Created dialog. */ public static Dialog createMessageDialog(Activity activity, Message message, OnDismissListener dismissListener) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final String title = message.description == null ? null : message.description.get(MessageDescription.KEY_TITLE); if (!Utilities.isNullOrEmpty(title)) { builder.setTitle(title); } final View dialogContentsView = createMessageDialogContentsView(activity, message.description); builder.setView(dialogContentsView); initializeMessageDialogButtons(activity, builder, message); builder.setCancelable(true); final AlertDialog dialog = builder.create(); if (Utilities.isNullOrEmpty(title)) { dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); } dialog.setOnDismissListener(dismissListener); return dialog; }
From source file:com.eugene.fithealthmaingit.UI.Dialogs.FragmentSuggestionDialog.java
@NonNull @Override/* w ww . j a v a 2 s .c om*/ public Dialog onCreateDialog(Bundle savedInstanceState) { sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); Bundle bundle = this.getArguments(); if (bundle != null) { mMealType = bundle.getString(Globals.MEAL_TYPE); mDate = (Date) bundle.getSerializable(Globals.SUGGESTION_DATE); } v = getActivity().getLayoutInflater().inflate(R.layout.dialog_fragment_suggestion, null); findViews(); // alert Dialog builder implementation AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(v); builder.setNegativeButton("Done", null); return builder.create(); }
From source file:com.android.argb.edhlc.Utils.java
public static void createAboutDialog(final View view) { @SuppressLint("InflateParams") View aboutDialog = LayoutInflater.from(view.getContext()).inflate(R.layout.dialog_about, null); TextView version = (TextView) aboutDialog.findViewById(R.id.version); TextView aChart = (TextView) aboutDialog.findViewById(R.id.thirdPartyAChartEngine); TextView crop = (TextView) aboutDialog.findViewById(R.id.thirdPartyCrop); TextView picker = (TextView) aboutDialog.findViewById(R.id.thirdColorPicker); TextView apache = (TextView) aboutDialog.findViewById(R.id.apache); try {/* w ww . ja v a 2s . c om*/ PackageInfo pInfo = pInfo = view.getContext().getPackageManager() .getPackageInfo(view.getContext().getPackageName(), 0); version.setText(pInfo.versionName); } catch (PackageManager.NameNotFoundException e) { version.setText(""); } aChart.setText(Html.fromHtml("<u>AChartEngine</u>")); aChart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri uriUrl = Uri.parse("http://www.achartengine.org/index.html"); Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl); view.getContext().startActivity(launchBrowser); } }); crop.setText(Html.fromHtml("<u>Android CropImage</u>")); crop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri uriUrl = Uri.parse("https://github.com/lvillani/android-cropimage"); Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl); view.getContext().startActivity(launchBrowser); } }); picker.setText(Html.fromHtml("<u>Android Stock Color Picker Library</u>")); picker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri uriUrl = Uri.parse("https://github.com/woalk/android-colorpicker"); Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl); view.getContext().startActivity(launchBrowser); } }); apache.setText(Html.fromHtml( "Licensed under Apache License v2.0.<br>You can obtain a copy of the license <u>here</u>.")); apache.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri uriUrl = Uri.parse("http://www.apache.org/licenses/LICENSE-2.0"); Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl); view.getContext().startActivity(launchBrowser); } }); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(view.getContext()); alertDialogBuilder.setView(aboutDialog); alertDialogBuilder.setTitle(""); alertDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialogBuilder.setNeutralButton("MORE", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); AlertDialog.Builder alertDialogBuilder2 = new AlertDialog.Builder(view.getContext()); alertDialogBuilder2 .setView(LayoutInflater.from(view.getContext()).inflate(R.layout.dialog_about2, null)); alertDialogBuilder2.setTitle(""); alertDialogBuilder2.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialogBuilder2.setNegativeButton("BACK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { createAboutDialog(view); } }); final AlertDialog alertDialog2 = alertDialogBuilder2.create(); alertDialog2.show(); } }); final AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); }
From source file:com.booksaround.me.title.LoginDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = LayoutInflater.from(getActivity()); View root = inflater.inflate(R.layout.dialog_login_register, null); // set labels TextView titleText = (TextView) root.findViewById(R.id.textView1); titleText.setText(R.string.login_kii_cloud); // set button Button submitButton = (Button) root.findViewById(R.id.button_submit); submitButton.setText(R.string.login); submitButton.setOnClickListener(new ClickListener(this, root)); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(root); return builder.create(); }
From source file:com.booksaround.me.title.RegistrationDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = LayoutInflater.from(getActivity()); View root = inflater.inflate(R.layout.dialog_login_register, null); // set labels TextView titleText = (TextView) root.findViewById(R.id.textView1); titleText.setText(R.string.register_kii_cloud); // set button Button submitButton = (Button) root.findViewById(R.id.button_submit); submitButton.setText(R.string.register); submitButton.setOnClickListener(new ClickListener(this, root)); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(root); return builder.create(); }
From source file:com.example.sergey.currentweather.dialog.MaterialSimpleDialog.java
@NonNull @Override//from www.j a v a 2s . c o m public Dialog onCreateDialog(Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); if (savedInstanceState != null) { mPositive = savedInstanceState.getString("yes"); mNegative = savedInstanceState.getString("no"); mTitle = savedInstanceState.getString("title"); } Context dialogViewContext = getActivity(); View dialogView = LayoutInflater.from(dialogViewContext).inflate(R.layout.simple_dialog, null); final TextInputEditText editText = (TextInputEditText) dialogView.findViewById(R.id.add_city_edit); editText.addTextChangedListener(new AddListenerOnTextChange(editText)); AlertDialog.Builder adb = new AlertDialog.Builder(getActivity(), R.style.StyledDialog); adb.setView(dialogView); adb.setCancelable(false); adb.setTitle(mTitle); adb.setPositiveButton(mPositive, mDialogInterfaceListener); adb.setNegativeButton(mNegative, mDialogInterfaceListener); return adb.create(); }
From source file:com.cerema.cloud2.ui.dialog.CreateFolderDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { mParentFolder = getArguments().getParcelable(ARG_PARENT_FOLDER); // Inflate the layout for the dialog LayoutInflater inflater = getActivity().getLayoutInflater(); View v = inflater.inflate(R.layout.edit_box_dialog, null); // Setup layout EditText inputText = ((EditText) v.findViewById(R.id.user_input)); inputText.setText(""); inputText.requestFocus();/*from ww w. j a v a2 s . c om*/ // Build the dialog AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(v).setPositiveButton(R.string.common_ok, this) .setNegativeButton(R.string.common_cancel, this).setTitle(R.string.uploader_info_dirname); Dialog d = builder.create(); d.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE); return d; }