Example usage for android.app Dialog getWindow

List of usage examples for android.app Dialog getWindow

Introduction

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

Prototype

public @Nullable Window getWindow() 

Source Link

Document

Retrieve the current Window for the activity.

Usage

From source file:android.support.v7.app.AppCompatDelegate.java

/**
 * Create a {@link android.support.v7.app.AppCompatDelegate} to use with {@code dialog}.
 *
 * @param callback An optional callback for AppCompat specific events
 *///from ww  w .  ja va2s  .  co  m
public static AppCompatDelegate create(Dialog dialog, AppCompatCallback callback) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        return new AppCompatDelegateImplV11(dialog.getContext(), dialog.getWindow(), callback);
    } else {
        return new AppCompatDelegateImplV7(dialog.getContext(), dialog.getWindow(), callback);
    }
}

From source file:Main.java

@SuppressWarnings("deprecation")
static public void setDlgBoxSizeLimit(Dialog dlg, boolean set_max) {
    if (dlg == null)
        return;//from ww w.j  a  v  a  2  s.  c o m
    //      int w=dlg.getWindow().getWindowManager().getDefaultDisplay().getWidth();
    //      int h=dlg.getWindow().getWindowManager().getDefaultDisplay().getHeight();
    if (!set_max) {// W=fill_parent H=fill_parent
        setDlgBoxSizeCompact(dlg);
    } else {// W=fill_parent H=wrap_content
        dlg.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    }
}

From source file:android.support.v7ox.app.AppCompatDelegate.java

/**
 * Create a {@link android.support.v7ox.app.AppCompatDelegate} to use with {@code dialog}.
 *
 * @param callback An optional callback for AppCompat specific events
 */// w  w w  .  ja  v a 2s.  c o m
public static AppCompatDelegate create(Dialog dialog, AppCompatCallback callback) {
    return create(dialog.getContext(), dialog.getWindow(), callback);
}

From source file:com.spoiledmilk.ibikecph.util.Util.java

public static void launchNoConnectionDialog(Context ctx) {
    final Dialog dialog = new Dialog(ctx);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.dialog_no_connection);
    TextView text = (TextView) dialog.findViewById(R.id.textNetworkError);
    text.setTypeface(IbikeApplication.getNormalFont());
    text.setText(IbikeApplication.getString("network_error_text"));
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    dialog.show();/*from   w ww.  j  a v a  2 s.  c o  m*/
    final Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            try {
                dialog.dismiss();
            } catch (Exception e) {
                // dialog not attached to window
            }
        }
    }, 3000);
}

From source file:com.aaplab.android.roboboost.VisibleInjectionContext.java

public VisibleInjectionContext(Dialog dialog) {
    this.rootView = dialog.getWindow().getDecorView();
}

From source file:com.example.stefan.movies.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_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   w  w w .  j av a  2  s .co m
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
    return dialog;
}

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//w ww  .j  av a  2 s .co  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//from  w  ww  .  ja v a2  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//  ww w.  jav a  2s . c  o  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:net.named_data.nfd.FaceCreateDialogFragment.java

@NonNull
@Override//from ww  w  . j a  va2s  .co m
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = getActivity().getLayoutInflater();
    builder.setView(inflater.inflate(R.layout.dialog_create_face, null))
            .setPositiveButton(R.string.face_add_dialog_create_face, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    EditText uriBox = (EditText) getDialog().findViewById(R.id.faceUri);
                    String uri = uriBox.getText().toString();
                    ((OnFaceCreateRequested) getTargetFragment()).createFace(uri);
                }
            }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    FaceCreateDialogFragment.this.getDialog().cancel();
                }
            });

    Dialog faceCreateDialog = builder.create();
    faceCreateDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    return faceCreateDialog;
}