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:com.magnet.samples.android.quickstart.fragments.NewMessageDialogFragment.java

@Override
public void onStart() {
    super.onStart();

    Dialog dialog = getDialog();
    if (dialog != null) {
        dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    }/*w  w w. j  a v a 2  s  .  co  m*/
}

From source file:nz.ac.otago.psyanlab.common.designer.program.object.PickObjectDialogueFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    Dialog dialog = getDialog();
    dialog.setTitle(R.string.title_dialogue_pick_object);
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    Bundle args = getArguments();/*  ww w.  java2  s  .co  m*/
    if (args != null) {
        mCallerId = args.getLong(ARG_CALLER_ID, INVALID_ID);
        mCallerKind = args.getInt(ARG_CALLER_KIND);
        mFilter = args.getInt(ARG_FILTER);
        mRequestCode = args.getInt(ARG_REQUEST_CODE);
    }

    if (mCallerId == INVALID_ID) {
        throw new RuntimeException("Invalid caller object id given.");
    }

    mFragmentFactory = new FragmentFactory(mCallerKind, mCallerId, mFilter);
    mViews = new ViewHolder(view);
    mViews.initViews();
}

From source file:org.lunci.dumbthing.dialog.AddDumbThingDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.setTitle(getResources().getString(R.string.add_dumb_thing));
    dialog.setCanceledOnTouchOutside(true);
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    return dialog;
}

From source file:br.com.anteros.vendas.gui.ProdutoConsultaDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    /**/*from   w  w w  . j a  va2 s  . c o m*/
     * Remove ttulo da dialog.
     */
    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    return dialog;
}

From source file:de.grobox.transportr.trips.search.ProductDialogFragment.java

@Override
public void onStart() {
    super.onStart();

    // adjust width and height to be shown properly in landscape orientation
    Dialog dialog = getDialog();
    if (dialog != null) {
        Window window = dialog.getWindow();
        if (window != null) {
            int width = ViewGroup.LayoutParams.MATCH_PARENT;
            int height = ViewGroup.LayoutParams.MATCH_PARENT;
            window.setLayout(width, height);
        }// w ww.  ja  va  2  s.  c o m
    }
}

From source file:net.margaritov.preference.colorpicker.dialog.ColorPickerDialogFragment.java

@NonNull
@Override//from   w  ww  . j  a va  2s . com
public Dialog onCreateDialog(Bundle savedInstanceState) {

    if (getActivity() != null) {
        final Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_DeviceDefault_Light_Dialog);
        dialog.getWindow().setFormat(PixelFormat.RGBA_8888);

        dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
        dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        dialog.setContentView(R.layout.view_color_picker_dialog);

        colorPicker = (ColorPickerView) dialog.findViewById(R.id.color_picker_view);
        oldColor = (ColorPanelView) dialog.findViewById(R.id.color_panel_old);
        newColor = (ColorPanelView) dialog.findViewById(R.id.color_panel_new);
        ((LinearLayout) oldColor.getParent()).setPadding(Math.round(colorPicker.getDrawingOffset()), 0,
                Math.round(colorPicker.getDrawingOffset()), 0);
        colorPicker.setOnColorChangedListener(this);
        oldColor.setColor(initialColor);
        if (savedInstanceState == null) {
            colorPicker.setColor(initialColor, true);
        }

        buttonNegative = (Button) dialog.findViewById(R.id.dialog_button_negative);
        buttonPositive = (Button) dialog.findViewById(R.id.dialog_button_positive);

        buttonNegative.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onDialogButtonClickedListener != null) {
                    onDialogButtonClickedListener.onNegativeButtonClicked(ColorPickerDialogFragment.this);
                }
                dismiss();
            }
        });
        buttonPositive.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onDialogButtonClickedListener != null) {
                    onDialogButtonClickedListener.onPositiveButtonClicked(ColorPickerDialogFragment.this);
                }
                dismiss();
            }
        });
        return dialog;
    } else {
        return super.onCreateDialog(savedInstanceState);
    }
}

From source file:com.kubotaku.android.code4kyoto5374.fragments.OpenSourceLicenseDialog.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    final Dialog dialog = getDialog();
    dialog.setCancelable(true);/*from ww w  . j  a v a 2 s.  co m*/

    DisplayMetrics metrics = getResources().getDisplayMetrics();
    int dialogWidth = (int) (metrics.widthPixels * 0.95f);

    WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
    lp.width = dialogWidth;
    dialog.getWindow().setAttributes(lp);

    dialog.setCanceledOnTouchOutside(true);
}

From source file:com.github.rutvijkumar.twittfuse.fragments.ComposeDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Dialog dialog = getDialog();
    Window window = dialog.getWindow();
    View view = inflater.inflate(R.layout.compose_dialog, container);
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    setUpUI(view);/*from  www .j a  v  a2s.  c  om*/
    getUserAccountDetails();
    return view;
}

From source file:com.magnet.samples.android.quickstart.fragments.NewMessageDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    // request a window without the title
    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    return dialog;
}

From source file:com.kubotaku.android.sample.sensordataviewer.fragments.AbsDialogFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    final Dialog dialog = getDialog();
    dialog.setCancelable(false);/*w w  w. j a v a  2  s . c o  m*/

    DisplayMetrics metrics = getResources().getDisplayMetrics();
    int dialogWidth = (int) (metrics.widthPixels * getDialogWidthRatio());

    WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
    lp.width = dialogWidth;
    dialog.getWindow().setAttributes(lp);
}