Example usage for android.app Dialog requestWindowFeature

List of usage examples for android.app Dialog requestWindowFeature

Introduction

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

Prototype

public final boolean requestWindowFeature(int featureId) 

Source Link

Document

Enable extended window features.

Usage

From source file:com.android.timezonepicker.TimeZonePickerDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    return dialog;
}

From source file:com.jooik.tabbeddialog.fragments.FragmentDialog.java

@NonNull
@Override/*  www  .  j  av  a 2s .c  om*/
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    return dialog;
}

From source file:com.itime.team.itime.fragments.QRCodeFragment.java

@NonNull
@Override/*  ww w  .  j a  v a2 s . c  o  m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.fragment_profile_qrcode);
    ImageView imageView = (ImageView) dialog.findViewById(R.id.setting_profile_qrcode_img);

    final Bundle arguments = getArguments();
    if (!arguments.isEmpty()) {
        mUserId = arguments.getString(QRCODE_STRING);
    }

    Bitmap qrCodeBitmap;

    // method1: change a fix dip to pixel
    //final int dim = DensityUtil.dip2px(getContext(), 600);

    // method2: get the display size and scale into 7/8
    // This assumes the view is full screen, which is a good assumption
    WindowManager manager = (WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    Point displaySize = new Point();
    display.getSize(displaySize);
    int width = displaySize.x;
    int height = displaySize.y;
    int smallerDimension = width < height ? width : height;
    final int dim = smallerDimension * 7 / 8;

    try {
        qrCodeBitmap = barcodeEncoder.encodeBitmap(mUserId, BarcodeFormat.QR_CODE, dim, dim);
        imageView.setImageBitmap(qrCodeBitmap);
    } catch (WriterException e) {
        Toast.makeText(getActivity(), "QRCode text can not be empty", Toast.LENGTH_SHORT).show();
    }

    return dialog;
}

From source file:com.codetroopers.betterpickers.timezonepicker.TimeZonePickerDialogFragment.java

@NonNull
@Override/*from  w  w  w  .  j a  v  a  2s  . c  om*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    return dialog;
}

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);/*www. 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) {
            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);//from   ww  w .j  a  va 2  s  .  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 ww w  .  j  a va  2s  . 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 va  2  s  . 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.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);/*  www.  j ava 2s .c om*/

    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.ja  va  2 s  . c  o  m

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