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: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 w  w w  . ja  va 2s .  co 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:com.agna.setmaster.ui.screen.profile.setting.change.ChangeVolumeSettingDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new ChangeSettingDialog(getActivity(), getTheme());
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    return dialog;
}

From source file:org.solovyev.android.views.llm.app.DialogListFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    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);// www  .j a  va 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();
}

From source file:com.zpwebsites.linuxonandroid.opensource.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);//from   w  ww . j  a va  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_Fedora_Large, CFG.imageURL_Fedora_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_Fedora_Small, CFG.imageURL_Fedora_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_Fedora_Core, CFG.imageURL_Fedora_Core);
            dialog.dismiss();
        }
    });
    dialog.show();
}

From source file:com.zpwebsites.linuxonandroid.Install_Debian_2.java

private void downloads(Context context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.download_debian_menu);
    dialog.setCancelable(true);/* ww w .  j a  v a 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_Debian_Large, CFG.imageURL_Debian_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_Debian_Small, CFG.imageURL_Debian_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_Debian_Core, CFG.imageURL_Debian_Core);
            dialog.dismiss();
        }
    });
    dialog.show();
}

From source file:com.zpwebsites.linuxonandroid.opensource.Install_Ubuntu12_2.java

private void downloads(Context context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.download_ubuntu12_menu);
    dialog.setCancelable(true);/* w w w.j a va2  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_Ubuntu12_Large, CFG.imageURL_Ubuntu12_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_Ubuntu12_Small, CFG.imageURL_Ubuntu12_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_Ubuntu12_Core, CFG.imageURL_Ubuntu12_Core);
            dialog.dismiss();
        }
    });
    dialog.show();
}

From source file:com.fbartnitzek.tasteemall.filter.AttributeFilterBaseDialogFragment.java

@NonNull
@Override//from   w ww  .  java 2  s  .c  o  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    Bundle bundle = getArguments();
    if (bundle == null) {
        bundle = savedInstanceState;
    }
    if (bundle == null) {
        throw new RuntimeException("neither args nor savedInstance - should never happen...");
    }

    mBaseEntity = bundle.getString(BASE_ENTITY);
    mAttributeName = bundle.getString(ATTRIBUTE_NAME);

    // nothing really works to restrict the size => TODO

    Window window = dialog.getWindow();

    if (window != null) {
        window.setGravity(Gravity.CENTER);
        //        dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

        //        WindowManager.LayoutParams p = window.getAttributes();
        //        Log.v(LOG_TAG, "onCreateDialog, p.verticalMargin=" + p.verticalMargin + ", " + "p.horizontalMargin = [" + p.horizontalMargin+ "]");

        //        p.height = getActivity().getResources().getDisplayMetrics().heightPixels / 2;
        //        float vertMargin = p.verticalMargin;
        //        p.verticalMargin = vertMargin + dpToPx(100);
        //        p.y = prevY + dpToPx(100);

        //        p.x = 150;
        //        window.setAttributes(p);
        // fullscreen: height and width = -1
        //        Log.v(LOG_TAG, "onCreateDialog, p.width=" + p.width + ", " + "p.height = [" + p.height+ "]");
    }

    return dialog;
}

From source file:com.zpwebsites.linuxonandroid.Install_Archlinux_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 av a 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.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.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);//from  w w w.  ja v a2  s  .c  om

    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_Arch_Large_ext4, CFG.imageURL_Arch_Large_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Arch_Large_ext2, CFG.imageURL_Arch_Large_ext2);
            }

            dialog.dismiss();
        }
    });

    Button btn_DownloadSmall = (Button) dialog.findViewById(R.id.btn_DownloadSmall);
    btn_DownloadSmall.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            if (AppPreferences.getPrefs().getString("ANDROID", "1").equals("4.3")) {
                downloadImage(v.getContext(), CFG.torrentURL_Arch_Small_ext4, CFG.imageURL_Arch_Small_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Arch_Small_ext2, CFG.imageURL_Arch_Small_ext2);
            }
            dialog.dismiss();
        }
    });

    Button btn_DownloadCore = (Button) dialog.findViewById(R.id.btn_DownloadCore);
    btn_DownloadCore.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            if (AppPreferences.getPrefs().getString("ANDROID", "1").equals("4.3")) {
                downloadImage(v.getContext(), CFG.torrentURL_Arch_Core_ext4, CFG.imageURL_Arch_Core_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Arch_Core_ext2, CFG.imageURL_Arch_Core_ext2);
            }
            dialog.dismiss();
        }
    });
    dialog.show();
}