Example usage for android.app Dialog setContentView

List of usage examples for android.app Dialog setContentView

Introduction

In this page you can find the example usage for android.app Dialog setContentView.

Prototype

public void setContentView(@NonNull View view) 

Source Link

Document

Set the screen content to an explicit view.

Usage

From source file:com.zpwebsites.linuxonandroid.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);//  ww  w.java  2  s. com

    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_Fedora_Large_ext4, CFG.imageURL_Fedora_Large_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Fedora_Large_ext2, CFG.imageURL_Fedora_Large_ext2);
            }
            dialog.dismiss();
        }
    });

    dialog.show();
}

From source file:com.zpwebsites.linuxonandroid.opensource.Install_Backtrack_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  ww.  ja  va2s. 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.setTitle(R.string.dialog_select_donwload_type_title);
    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:com.hivewallet.androidclient.wallet.ui.WalletAddressDialogFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    address = getArguments().getString(KEY_ADDRESS);
    final Bitmap qrCode = (Bitmap) getArguments().getParcelable(KEY_QR_CODE);

    final Dialog dialog = new Dialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.wallet_address_dialog);
    dialog.setCanceledOnTouchOutside(true);

    final ImageView imageView = (ImageView) dialog.findViewById(R.id.iv_qr_code);
    imageView.setImageBitmap(qrCode);/*from   w  w  w . j  av a2 s  . c o m*/
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            dismiss();
        }
    });

    final TextView textView = (TextView) dialog.findViewById(R.id.tv_bitcoin_address);
    textView.setText(address);

    final ImageButton copyButton = (ImageButton) dialog.findViewById(R.id.ib_copy_wallet_address);
    copyButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            handleCopy();
        }
    });

    final ImageButton shareButton = (ImageButton) dialog.findViewById(R.id.ib_share_wallet_address);
    shareButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            handleShare();
        }
    });

    return dialog;
}

From source file:com.zpwebsites.linuxonandroid.Install_Kali_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);//from  w  w  w .  ja v  a2s.com
        return;
    }

    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.dialog_download_type_selector);
    // dialog.setTitle(R.string.dialog_select_donwload_type_title);
    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:com.zpwebsites.linuxonandroid.opensource.Install_Ubuntu10_2.java

private void downloads(Context context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.download_ubuntu10_menu);
    dialog.setCancelable(true);/*  w  w  w. j  ava 2 s .  co m*/

    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_Ubuntu10_Large, CFG.imageURL_Ubuntu10_Large);
            dialog.dismiss();
        }
    });

    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_Ubuntu10_Small, CFG.imageURL_Ubuntu10_Small);
            dialog.dismiss();
        }
    });
    dialog.show();

}

From source file:org.hopestarter.wallet.util.BitmapFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final Bitmap bitmap = (Bitmap) args.getParcelable(KEY_BITMAP);
    final CharSequence label = args.getCharSequence(KEY_LABEL);
    final CharSequence address = args.getCharSequence(KEY_ADDRESS);

    final Dialog dialog = new Dialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.bitmap_dialog);
    dialog.setCanceledOnTouchOutside(true);

    final ImageView imageView = (ImageView) dialog.findViewById(R.id.bitmap_dialog_image);
    imageView.setImageBitmap(bitmap);/*from  w  w w. j a  va2s .c om*/

    final View labelButtonView = dialog.findViewById(R.id.bitmap_dialog_label_button);
    final TextView labelView = (TextView) dialog.findViewById(R.id.bitmap_dialog_label);
    if (getResources().getBoolean(R.bool.show_bitmap_dialog_label) && label != null) {
        labelView.setText(Html.fromHtml(Formats.maybeRemoveOuterHtmlParagraph(label)));
        labelButtonView.setVisibility(View.VISIBLE);

        if (address != null) {
            labelButtonView.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(final View v) {
                    final Intent intent = new Intent(Intent.ACTION_SEND);
                    intent.setType("text/plain");
                    intent.putExtra(Intent.EXTRA_TEXT, address);
                    startActivity(Intent.createChooser(intent, getString(R.string.bitmap_fragment_share)));
                }
            });
        } else {
            labelButtonView.setEnabled(false);
        }
    } else {
        labelButtonView.setVisibility(View.GONE);
    }

    final View dialogView = dialog.findViewById(R.id.bitmap_dialog_group);
    dialogView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            dismiss();
        }
    });

    return dialog;
}

From source file:de.schildbach.wallet.ui.WalletAddressDialogFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final Address address = (Address) args.getSerializable(KEY_ADDRESS);
    final String addressStr = address.toBase58();
    final String addressLabel = args.getString(KEY_ADDRESS_LABEL);

    final Dialog dialog = new Dialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.wallet_address_dialog);
    dialog.setCanceledOnTouchOutside(true);

    final String uri = BitcoinURI.convertToBitcoinURI(address, null, addressLabel, null);
    final BitmapDrawable bitmap = new BitmapDrawable(getResources(), Qr.bitmap(uri));
    bitmap.setFilterBitmap(false);/*from ww w.  jav a 2s. c o m*/
    final ImageView imageView = (ImageView) dialog.findViewById(R.id.wallet_address_dialog_image);
    imageView.setImageDrawable(bitmap);

    final View labelButtonView = dialog.findViewById(R.id.wallet_address_dialog_label_button);
    final TextView labelView = (TextView) dialog.findViewById(R.id.wallet_address_dialog_label);
    final CharSequence label = WalletUtils.formatHash(addressStr, Constants.ADDRESS_FORMAT_GROUP_SIZE,
            Constants.ADDRESS_FORMAT_LINE_SIZE);
    labelView.setText(label);
    labelButtonView.setVisibility(View.VISIBLE);
    labelButtonView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {
            final Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("text/plain");
            intent.putExtra(Intent.EXTRA_TEXT, addressStr);
            startActivity(Intent.createChooser(intent, getString(R.string.bitmap_fragment_share)));
            log.info("wallet address shared via intent: {}", addressStr);
        }
    });

    final View hintView = dialog.findViewById(R.id.wallet_address_dialog_hint);
    hintView.setVisibility(
            getResources().getBoolean(R.bool.show_wallet_address_dialog_hint) ? View.VISIBLE : View.GONE);

    final View dialogView = dialog.findViewById(R.id.wallet_address_dialog_group);
    dialogView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            dismiss();
        }
    });

    return dialog;
}

From source file:org.cirrus.mobi.pegel.PegelFragmentsActivity.java

private Dialog createAboutDialog() {

    Dialog dialog = new Dialog(this);

    dialog.setContentView(R.layout.about_dialog);
    dialog.setTitle("About Pegel-Online v." + app_ver);

    TextView text = (TextView) dialog.findViewById(R.id.about_d_text);
    text.setText(R.string.about);// w  w w .  ja  v  a  2  s  .c om
    ImageView image = (ImageView) dialog.findViewById(R.id.about_d_logo);
    image.setImageResource(R.drawable.icon);

    return dialog;
}

From source file:com.digitallizard.nicecompass.CompassActivity.java

private Dialog createSelectBearingDialog() {
    Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.bearing_dialog);

    EditText bearingText = (EditText) dialog.findViewById(R.id.bearingSelectionText);
    bearingText.setText(""); // set the initial text
    bearingText.requestFocus(); // get the focus

    return dialog;
}

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);/*ww w . j a  v a  2 s .  c  o m*/

    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();
        }
    });

    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();
}