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.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);// w  w w.jav  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_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);/*from w  w  w .j ava2 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_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);/*from   w  ww .  ja va  2  s.  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_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:org.transdroid.core.gui.navigation.SetTransferRatesDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (onRatesPickedListener == null)
        throw new InvalidParameterException(
                "Please first set the callback listener using setOnRatesPickedListener before opening the dialog.");
    final View transferRatesContent = getActivity().getLayoutInflater().inflate(R.layout.dialog_transferrates,
            null, false);/*  w ww  .j  a  va2s. co m*/
    maxSpeedDown = (TextView) transferRatesContent.findViewById(R.id.maxspeeddown_text);
    maxSpeedUp = (TextView) transferRatesContent.findViewById(R.id.maxspeedup_text);
    bindButtons(transferRatesContent, maxSpeedDown, R.id.down1Button, R.id.down2Button, R.id.down3Button,
            R.id.down4Button, R.id.down5Button, R.id.down6Button, R.id.down7Button, R.id.down8Button,
            R.id.down9Button, R.id.down0Button);
    bindButtons(transferRatesContent, maxSpeedUp, R.id.up1Button, R.id.up2Button, R.id.up3Button,
            R.id.up4Button, R.id.up5Button, R.id.up6Button, R.id.up7Button, R.id.up8Button, R.id.up9Button,
            R.id.up0Button);
    ((Button) transferRatesContent.findViewById(R.id.ok_button)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            int maxDown = -1, maxUp = -1;
            try {
                maxDown = Integer.parseInt(maxSpeedDown.getText().toString());
                maxUp = Integer.parseInt(maxSpeedUp.getText().toString());
            } catch (NumberFormatException e) {
            }
            if (maxDown <= 0 || maxUp <= 0) {
                onRatesPickedListener.onInvalidNumber();
            }
            onRatesPickedListener.onRatesPicked(maxDown, maxUp);
            dismiss();
        }
    });
    ((Button) transferRatesContent.findViewById(R.id.reset_button)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            onRatesPickedListener.resetRates();
            dismiss();
        }
    });
    ((Button) transferRatesContent.findViewById(R.id.cancel_button)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            dismiss();
        }
    });
    Dialog dialog = new Dialog(getActivity());
    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(transferRatesContent);
    return dialog;
}

From source file:com.facebook.samples.sessionlogin.LoginUsingActivityActivity.java

public void showDialog() {
    final Dialog dialog = new Dialog(LoginUsingActivityActivity.this);
    dialog.setContentView(R.layout.list_view_contact);
    dialog.setTitle("Pic Number");
    ListView listView = (ListView) dialog.findViewById(R.id.lc_contacts);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(getApplicationContext(), R.layout.spinner_row_view,
            list);/* w ww.  ja  v  a  2s . c om*/
    listView.setAdapter(adapter);

    dialog.show();
    /*DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
            
    dialog.getWindow().setLayout(metrics.heightPixels, metrics.widthPixels);*/
}

From source file:com.osama.cgpacalculator.MainActivity.java

@SuppressLint("InflateParams")
private void showAboutDialog() {
    final ScaleAnimation animation = new ScaleAnimation(0f, 1f, 0f, 1f);
    animation.setDuration(800);//from   w  ww.  j av  a 2  s. c o  m

    Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.about_dialog);

    final FrameLayout frame = ((FrameLayout) dialog.findViewById(R.id.about_content_layout));
    frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));

    dialog.findViewById(R.id.credit_dialog_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            frame.removeAllViews();
            isShowingLi = false;
            if (!isShowingCr) {
                frame.addView(getLayoutInflater().inflate(R.layout.credits_layout, null));
                isShowingCr = true;
                frame.setAnimation(animation);
            } else {
                frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));
                isShowingCr = false;
                frame.setAnimation(animation);
            }
            frame.animate();
        }
    });

    dialog.findViewById(R.id.license_dialog_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            frame.removeAllViews();
            isShowingCr = false;
            if (!isShowingLi) {
                frame.addView(getLayoutInflater().inflate(R.layout.license_layout, null));
                isShowingLi = true;
                frame.setAnimation(animation);
            } else {
                frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));
                isShowingLi = false;
                frame.setAnimation(animation);
            }
            frame.animate();
        }
    });

    dialog.show();
}

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);// w w  w.  j  a va 2s  .com
        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   www  .  j a  v a2s  .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();
}

From source file:com.applivery.applvsdklib.ui.views.update.MustUpdateViewImpl.java

/**
 * Overrided in order to get fullScreen dialog
 * @param savedInstanceState//from ww w  .j  a  v a  2s .c o m
 * @return
 */
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {

    final RelativeLayout root = new RelativeLayout(getActivity());
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    final Dialog dialog = new Dialog(getActivity());
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(root);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.YELLOW));
    dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

    return dialog;
}

From source file:com.osama.cryptofm.startup.OptionActivity.java

private void generateKeys() {
    //show password dialog
    final Dialog dialog = new Dialog(this);
    dialog.setCancelable(false);//from w w w .  j av a 2  s.co m
    dialog.setContentView(R.layout.passwords_fragment_layout);
    dialog.setTitle("keys password");
    final TextInputEditText editText = (TextInputEditText) dialog.findViewById(R.id.gen_keys_password_edit);
    final TextInputEditText confirmEditText = (TextInputEditText) dialog
            .findViewById(R.id.gen_keys_password_edit_confirm);
    dialog.show();

    dialog.findViewById(R.id.trigger_gen_key_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //test the passwords
            if (isValidPassword(editText.getText())) {
                if (editText.getText().toString().equals(confirmEditText.getText().toString())) {
                    //be sure to dismiss the dialog
                    dialog.dismiss();
                    //start the async task
                    mKeyPassword = editText.getText().toString();
                    new KeyGenerationTask().execute();
                } else {
                    confirmEditText.setError("Password does not match");
                }
            } else {
                editText.setError("Password should contain at least three characters");
            }

        }
    });
    dialog.findViewById(R.id.cancel_dialog_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });
}