Java Code Examples for android.app.Dialog#addContentView()
The following examples show how to use
android.app.Dialog#addContentView() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From heifreader with MIT License | 6 votes |
private void showImage(Bitmap bitmap) { Dialog builder = new Dialog(this); builder.requestWindowFeature(Window.FEATURE_NO_TITLE); builder.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); ImageView imageView = new ImageView(this); if (bitmap != null) { imageView.setImageBitmap(bitmap); } else { // fallback image imageView.setImageResource(android.R.drawable.ic_delete); } builder.addContentView(imageView, new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); builder.show(); }
Example 2
Source File: ItemChooserDialog.java From delion with Apache License 2.0 | 6 votes |
private void showDialogForView(View view) { mDialog = new Dialog(mActivity); mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.addContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { mItemSelectedCallback.onItemSelected(""); } }); Window window = mDialog.getWindow(); if (!DeviceFormFactor.isTablet(mActivity)) { // On smaller screens, make the dialog fill the width of the screen, // and appear at the top. window.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); window.setGravity(Gravity.TOP); window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } mDialog.show(); }
Example 3
Source File: UIFactory.java From Android-SDK with MIT License | 6 votes |
public static Dialog getLocationSettingsDialog( final Context context ) { final Dialog result = new Dialog( context ); layoutInflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE ); LinearLayout dialogLayout = (LinearLayout) layoutInflater.inflate( R.layout.provider_dialog, null ); dialogLayout.findViewById( R.id.openSettings ).setOnClickListener( new View.OnClickListener() { @Override public void onClick( View view ) { result.dismiss(); Intent settingsIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS ); context.startActivity( settingsIntent ); } } ); result.addContentView( dialogLayout, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT ) ); return result; }
Example 4
Source File: CertificateViewer.java From delion with Apache License 2.0 | 5 votes |
private void showDialogForView(View view) { Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.addContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); dialog.show(); }
Example 5
Source File: CertificateViewer.java From AndroidChromium with Apache License 2.0 | 5 votes |
private void showDialogForView(View view) { Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.addContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); dialog.show(); }
Example 6
Source File: ItemChooserDialog.java From AndroidChromium with Apache License 2.0 | 5 votes |
private void showDialogForView(View view) { mDialog = new Dialog(mActivity) { @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (!hasFocus) super.dismiss(); } }; mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.setCanceledOnTouchOutside(true); mDialog.addContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { mItemSelectedCallback.onItemSelected(""); } }); Window window = mDialog.getWindow(); if (!DeviceFormFactor.isTablet(mActivity)) { // On smaller screens, make the dialog fill the width of the screen, // and appear at the top. window.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); window.setGravity(Gravity.TOP); window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } mDialog.show(); }
Example 7
Source File: CertificateViewer.java From 365browser with Apache License 2.0 | 5 votes |
private void showDialogForView(View view) { Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.addContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); dialog.show(); }
Example 8
Source File: ItemChooserDialog.java From 365browser with Apache License 2.0 | 5 votes |
private void showDialogForView(View view) { mDialog = new Dialog(mActivity) { @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (!mIgnorePendingWindowFocusChangeForClose && !hasFocus) super.dismiss(); setIgnorePendingWindowFocusChangeForClose(false); } }; mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.setCanceledOnTouchOutside(true); mDialog.addContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { mItemSelectedCallback.onItemSelected(""); } }); Window window = mDialog.getWindow(); if (!DeviceFormFactor.isTablet()) { // On smaller screens, make the dialog fill the width of the screen, // and appear at the top. window.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); window.setGravity(Gravity.TOP); window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } mDialog.show(); }
Example 9
Source File: CertificateViewer.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
private void showDialogForView(View view) { Dialog dialog = new Dialog(mContext); dialog.setTitle(R.string.certtitle); ScrollView scrollView = new ScrollView(mContext); scrollView.addView(view); dialog.addContentView(scrollView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); dialog.show(); }
Example 10
Source File: CertificateViewer.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
private void showDialogForView(View view) { Dialog dialog = new Dialog(mContext); dialog.setTitle(R.string.certtitle); ScrollView scrollView = new ScrollView(mContext); scrollView.addView(view); dialog.addContentView(scrollView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); dialog.show(); }