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.mindorks.framework.mvp.ui.base.BaseDialog.java

@NonNull
@Override//w ww.j a va  2  s.  c o m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // the content
    final RelativeLayout root = new RelativeLayout(getActivity());
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    // creating the fullscreen dialog
    final Dialog dialog = new Dialog(getContext());
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(root);
    if (dialog.getWindow() != null) {
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    }
    dialog.setCanceledOnTouchOutside(false);

    return dialog;
}

From source file:com.example.nestedarchetypeactivityexample.InnerArchetypeViewerActivity.java

/**
  * Show info dialog./*w w  w  .ja  va2 s  . co m*/
  *
  * @param content the content
  */
private void showInfoDialog(String content) {
    final Dialog dialog = new Dialog(this);
    dialog.setTitle("Json Adl Structure");
    dialog.setContentView(R.layout.custom_dialog);
    TextView dialogText = (TextView) dialog.findViewById(R.id.dialogText);
    dialogText.setMovementMethod(new ScrollingMovementMethod());
    dialogText.setText(content);

    Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
    dialogButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            dialog.dismiss();

        }
    });

    dialog.show();
}

From source file:com.dcs.fakecurrencydetector.MainActivity.java

public void showHelp() {

    Dialog dialog = new Dialog(MainActivity.this);
    dialog.setTitle(R.string.action_about);
    dialog.setContentView(R.layout.dialog);
    dialog.show();/*www .j  av  a2  s. c o  m*/
}

From source file:com.zpwebsites.linuxonandroid.Install_Debian_Testing_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 av  a 2s.  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_Debian_Testing_Large_ext4,
                        CFG.imageURL_Debian_Testing_Large_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Debian_Testing_Large_ext2,
                        CFG.imageURL_Debian_Testing_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_Debian_Testing_Small_ext4,
                        CFG.imageURL_Debian_Testing_Small_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Debian_Testing_Small_ext2,
                        CFG.imageURL_Debian_Testing_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_Debian_Testing_Core_ext4,
                        CFG.imageURL_Debian_Testing_Core_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Debian_Testing_Core_ext2,
                        CFG.imageURL_Debian_Testing_Core_ext2);
            }
            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);//  w  w w  .  j  a  va  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_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.laquysoft.bycon.GoogleCardsActivity.java

public void postOrder(View w) {
    Log.i("ListActivity", "Post Order");
    new OrderTask().execute();

    // custom dialog
    final Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.payment_dialog);
    dialog.setTitle("Place & Pay Order");

    // set the custom dialog components - text, image and button
    ImageView image = (ImageView) dialog.findViewById(R.id.image);
    image.setImageResource(R.drawable.ic_launcher);

    Button dialogButton = (Button) dialog.findViewById(R.id.btn_accept);
    // if button is clicked, close the custom dialog
    dialogButton.setOnClickListener(new View.OnClickListener() {
        @Override/* ww w  . j a  v a  2s  .  c  o m*/
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    Button dialogCancelButton = (Button) dialog.findViewById(R.id.btn_reject);
    // if button is clicked, close the custom dialog
    dialogCancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
}

From source file:io.spw.hello.SectionsPagerAdapter.java

public void showMatchDialog() throws JSONException, ParseException {

    final Dialog dialog = new Dialog(mActivity);
    dialog.setContentView(R.layout.dialog_match_made);
    dialog.setTitle("An introduction is the essence of possibility");

    // find views
    TextView userName0 = (TextView) dialog.findViewById(R.id.userName0);
    TextView userInfo0 = (TextView) dialog.findViewById(R.id.userInfo0);
    TextView userName1 = (TextView) dialog.findViewById(R.id.userName1);
    TextView userInfo1 = (TextView) dialog.findViewById(R.id.userInfo1);
    TextView userName2 = (TextView) dialog.findViewById(R.id.userName2);
    TextView userInfo2 = (TextView) dialog.findViewById(R.id.userInfo2);
    Button helloButton = (Button) dialog.findViewById(R.id.dialog_hello_button);

    // get member users
    JSONArray userIds = currentUser.getJSONArray(ParseConstants.KEY_MEMBER_IDS);
    ParseRelation<ParseUser> groupMembersRelation = currentUser
            .getRelation(ParseConstants.KEY_GROUP_MEMBERS_RELATION);
    List<ParseUser> users = new ArrayList<>();
    for (int i = 0; i < userIds.length(); i++) {
        if (!currentUser.getObjectId().equals(userIds.getString(i))) {
            ParseUser user = ParseUser.getQuery().get(userIds.getString(i));
            users.add(user);//from w w w .  j  a va 2 s.co m
            groupMembersRelation.add(user);
        }
    }

    // set text
    userName0.setText(users.get(0).getString(ParseConstants.KEY_FIRST_NAME));
    userInfo0.setText(users.get(0).getString(ParseConstants.KEY_AGE) + " // "
            + (users.get(0).getString(ParseConstants.KEY_HOMETOWN)));

    userName1.setText(users.get(1).getString(ParseConstants.KEY_FIRST_NAME));
    userInfo1.setText(users.get(1).getString(ParseConstants.KEY_AGE) + " // "
            + (users.get(1).getString(ParseConstants.KEY_HOMETOWN)));

    userName2.setText(users.get(2).getString(ParseConstants.KEY_FIRST_NAME));
    userInfo2.setText(users.get(2).getString(ParseConstants.KEY_AGE) + " // "
            + (users.get(2).getString(ParseConstants.KEY_HOMETOWN)));

    // set button
    helloButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            currentUser.put(ParseConstants.KEY_MATCH_DIALOG_SEEN, true);
            currentUser.saveInBackground();
            if (mFirstFragment instanceof ThisWeekendFragment) {
                switchToGroupChatFragment();
            }
            dialog.dismiss();
        }
    });

    dialog.show();
}

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

private void downloads(Context context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.download_ubuntu13_menu);
    dialog.setCancelable(true);//from   w w  w.  j  a va 2s .  c  o  m

    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_Ubuntu13_Core_ext4,
                        CFG.imageURL_Ubuntu13_Core_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Ubuntu13_Core_ext2,
                        CFG.imageURL_Ubuntu13_Core_ext2);
            }
            dialog.dismiss();
        }
    });

    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_Ubuntu13_Large_ext4,
                        CFG.imageURL_Ubuntu13_Large_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Ubuntu13_Large_ext2,
                        CFG.imageURL_Ubuntu13_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_Ubuntu13_Small_ext4,
                        CFG.imageURL_Ubuntu13_Small_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Ubuntu13_Small_ext2,
                        CFG.imageURL_Ubuntu13_Small_ext2);
            }
            dialog.dismiss();
        }
    });
    dialog.show();

}

From source file:fr.cph.stock.android.activity.OverallActivity.java

private void showPanelUpdateHistory() {
    final Dialog alert = new Dialog(this);
    alert.setTitle("Update history");
    alert.setContentView(R.layout.history_dialog);

    final Spinner checked = (Spinner) alert.findViewById(R.id.accountList);
    List<String> list = new ArrayList<String>();
    for (Account acc : portfolio.getAccounts()) {
        list.add(acc.getName());//from ww  w . ja v  a 2  s  .  c o  m
    }
    ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
            list);
    dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    checked.setAdapter(dataAdapter);

    Button dialogButton = (Button) alert.findViewById(R.id.dialogButtonOK);
    dialogButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            refreshItem.setActionView(R.layout.progressbar);
            refreshItem.expandActionView();
            Account account = portfolio.getAccounts().get(checked.getSelectedItemPosition());
            EditText liquidityView = (EditText) alert.findViewById(R.id.liquidityMov);
            EditText yieldView = (EditText) alert.findViewById(R.id.yield);
            EditText buyView = (EditText) alert.findViewById(R.id.buy);
            EditText sellView = (EditText) alert.findViewById(R.id.sell);
            EditText taxeView = (EditText) alert.findViewById(R.id.taxe);
            EditText commentaryView = (EditText) alert.findViewById(R.id.commentaryEditText);

            String params = null;
            params = "?accountId=" + account.getId() + "&liquidity=" + liquidityView.getText() + "&yield="
                    + yieldView.getText() + "&buy=" + buyView.getText() + "&sell=" + sellView.getText()
                    + "&taxe=" + taxeView.getText() + "&commentary="
                    + commentaryView.getText().toString().replaceAll(" ", "%20");
            MainTask mainTask = new MainTask(OverallActivity.this, UrlType.UPDATEHISTORY, params);
            mainTask.execute((Void) null);
            alert.dismiss();
        }
    });
    dialogButton = (Button) alert.findViewById(R.id.dialogButtonCancel);
    dialogButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            alert.dismiss();
        }
    });
    alert.show();
}

From source file:piuk.blockchain.android.ui.SendCoinsActivity.java

@Override
protected Dialog onCreateDialog(final int id) {
    final WebView webView = new WebView(this);
    webView.loadUrl("file:///android_asset/help_send_coins" + languagePrefix() + ".html");

    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(webView);
    dialog.setCanceledOnTouchOutside(true);

    return dialog;
}