Example usage for android.app Dialog Dialog

List of usage examples for android.app Dialog Dialog

Introduction

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

Prototype

public Dialog(@NonNull Context context) 

Source Link

Document

Creates a dialog window that uses the default dialog theme.

Usage

From source file:com.example.energospolitis.ReportListActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
    case 1://w w  w.ja v a  2 s .c o m
        final Dialog dialog = new Dialog(ReportListActivity.this);
        dialog.setContentView(R.layout.customdialog);
        dialog.setTitle("");

        Button recent = (Button) dialog.findViewById(R.id.recbtn);
        recent.setText("");
        Button type = (Button) dialog.findViewById(R.id.typebtn);
        type.setText("");
        Button rate = (Button) dialog.findViewById(R.id.ratebtn);
        rate.setText("");

        recent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ReportList.sort("recent");
                restart();
                dialog.dismiss();
            }
        });
        rate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ReportList.sort("rate");
                restart();
                dialog.dismiss();
            }

        });
        type.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ReportList.sort("type");
                dialog.dismiss();
            }
        });

        dialog.show();
        break;
    default:
        return super.onOptionsItemSelected(item);
    }

    return true;
}

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);//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) {
            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.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);/*w w  w  . j  a v  a 2 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_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);//  w w  w  . j  a  va2s.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_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_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 w w  . j  av 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_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.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);// w w w  . j a  v  a2s .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.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  www.j a  v a2s  . c o  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_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();
}

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);//from   ww  w  . j  a v a 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:com.zpwebsites.linuxonandroid.Install_Ubuntu1310_2.java

private void downloads(Context context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.download_ubuntu1310_menu);
    dialog.setCancelable(true);//from w w  w .  ja v  a2  s.  c o  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_Ubuntu1310_Large_ext4,
                        CFG.imageURL_Ubuntu1310_Large_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Ubuntu1310_Large_ext2,
                        CFG.imageURL_Ubuntu1310_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_Ubuntu1310_Small_ext4,
                        CFG.imageURL_Ubuntu1310_Small_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Ubuntu1310_Small_ext2,
                        CFG.imageURL_Ubuntu1310_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_Ubuntu1310_Core_ext4,
                        CFG.imageURL_Ubuntu1310_Core_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Ubuntu1310_Core_ext2,
                        CFG.imageURL_Ubuntu1310_Core_ext2);
            }
            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  ww  .  j  ava  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_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();
}