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:dk.tinytree.bulldog.Fragments.Other.OpenSourceLicenses.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final Dialog dialog = new Dialog(getActivity());

    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.fragment_dialog_opensource_licenses);

    searchTitleIcon = (ImageView) dialog.findViewById(R.id.searchTitleProfile);
    searchTitleIcon.setImageResource(R.drawable.ic_material_security_black_24dp);
    searchTitleIcon.setColorFilter(ContextCompat.getColor(getContext(), R.color.redOrange));

    searchTitleName = (TextView) dialog.findViewById(R.id.searchTitleName);
    searchTitleName.setText(R.string.licenses_header_title);

    // Closes the Dialog
    Button dialogBtnCancel = (Button) dialog.findViewById(R.id.license_BtnCancel);
    dialogBtnCancel.setOnClickListener(new View.OnClickListener() {
        @Override/*from  ww  w.jav a2 s.  c  o  m*/
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
    return dialog;
}

From source file:dk.tinytree.reader.Fragments.Others.OpenSourceLicenses.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final Dialog dialog = new Dialog(getActivity());

    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.fragment_opensource_licenses);

    searchTitleIcon = (ImageView) dialog.findViewById(R.id.searchTitleProfile);
    searchTitleIcon.setImageResource(R.drawable.ic_material_security_black_24dp);
    searchTitleIcon.setColorFilter(ContextCompat.getColor(getContext(), R.color.redOrange));

    searchTitleName = (TextView) dialog.findViewById(R.id.searchTitleName);
    searchTitleName.setText(R.string.licenses_header_title);

    // Closes the Dialog
    Button dialogBtnCancel = (Button) dialog.findViewById(R.id.license_BtnCancel);
    dialogBtnCancel.setOnClickListener(new View.OnClickListener() {
        @Override//w w w  . j  a  v a 2  s  . c  o  m
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
    return dialog;
}

From source file:dk.tinytree.flashlight.fragments.others.OpenSourceLicenses.java

@NonNull
@Override/*w ww. ja v a  2  s.co m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final Dialog dialog = new Dialog(getActivity());

    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.fragment_opensource_licenses);

    searchTitleIcon = (ImageView) dialog.findViewById(R.id.searchTitleProfile);
    searchTitleIcon.setImageResource(R.drawable.ic_material_security_black_24dp);
    searchTitleIcon.setColorFilter(ContextCompat.getColor(getContext(), R.color.redOrange));

    searchTitleName = (TextView) dialog.findViewById(R.id.searchTitleName);
    searchTitleName.setText(R.string.licenses_header_title);

    // Closes the Dialog
    Button dialogBtnCancel = (Button) dialog.findViewById(R.id.license_BtnCancel);
    dialogBtnCancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
    return dialog;
}

From source file:com.example.android.supportv7.app.DialogUsage.java

private void showSimpleDialog() {
    Dialog dialog = new AppCompatDialog(this);
    dialog.setTitle(R.string.dialog_title);
    dialog.setContentView(R.layout.dialog_content);
    dialog.show();/*  ww  w  .j  a va2  s.  c o  m*/
}

From source file:com.example.android.supportv7.app.DialogUsage.java

private void showButtonBarDialog() {
    Dialog dialog = new AppCompatDialog(this);
    dialog.setTitle(R.string.dialog_title);
    dialog.setContentView(R.layout.dialog_content_buttons);
    dialog.show();//  ww w. j a  v  a2 s  . co m
}

From source file:fi.loezi.unifud.MainActivity.java

public void showAboutDialog() {

    final Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.dialog_fragment);
    dialog.setTitle("UniFud");

    final TextView text = (TextView) dialog.findViewById(R.id.dialogText);
    text.setText(//w  w w.  ja  v  a 2 s. co  m
            "Created by Leo Leppnen (leo.leppanen@helsinki.fi)\n" + "\n" + "Data provided by HYY Ravintolat\n"
                    + "\n" + "Icons by Freepik and Icon Works from www.flaticon.com, licensed under CC BY 3.0");

    String version = null;
    try {
        version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
    } catch (PackageManager.NameNotFoundException exception) {
        version = "unknown";
    }

    text.append("\n\nVersion " + version);

    final Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);

    dialogButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
}

From source file:com.sonymobile.androidapp.gridcomputing.activities.WizardActivity.java

/**
 * Show read more dialog./* w w  w.  ja  v  a2 s  .co  m*/
 */
public final void showReadMoreDialog() {
    final Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.dialog_wizard_info);

    // Fullscreen
    dialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    dialog.setTitle(R.string.more_info);
    final String[] texts = getResources().getStringArray(R.array.help_find_cure);

    ((TextView) dialog.findViewById(R.id.more_info_tv1)).setText(texts[0]);
    ((TextView) dialog.findViewById(R.id.more_info_tv2)).setText(texts[1]);
    ((TextView) dialog.findViewById(R.id.more_info_tv3)).setText(texts[2]);

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

From source file:bos.whu.familytree.ui.activitys.base.BaseActivity.java

@Override
public void onNavigationDrawerItemSelected(int position) {
    switch (position) {
    case DrawerMenu.HOME:
        fragmentTransaction(new HomeFragment());
        break;// w w w  .ja  v  a 2 s. c  o m
    case DrawerMenu.ABOUT:
        Dialog dialog = new Dialog(this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.about_dialog);
        dialog.show();
        break;
    }
}

From source file:com.feathercoin.wallet.feathercoin.util.BitmapFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bitmap bitmap = (Bitmap) getArguments().getParcelable(KEY_BITMAP);

    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 .j  av  a 2  s. co m*/
    imageView.setOnClickListener(new View.OnClickListener() {
        public void onClick(final View v) {
            dismiss();
        }
    });

    return dialog;
}

From source file:cc.mintcoin.wallet.util.BitmapFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bitmap bitmap = (Bitmap) getArguments().getParcelable(KEY_BITMAP);

    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);// w ww .  j  a va 2  s  .com
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            dismiss();
        }
    });

    return dialog;
}