Example usage for android.app Dialog Dialog

List of usage examples for android.app Dialog Dialog

Introduction

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

Prototype

public Dialog(@NonNull Context context, @StyleRes int themeResId) 

Source Link

Document

Creates a dialog window that uses a custom dialog style.

Usage

From source file:Main.java

/**
 * create dialog with layout content designed in XML. can used such as a common method.
 * This dialog will full screen// w ww. j av a  2  s  .  c o  m
 * 
 * @param context
 * @param idLayout
 * @return
 */
public static Dialog createDialogFullScreen(Context context, int idLayout) {
    Dialog dialog = new Dialog(context, android.R.style.Theme_Translucent_NoTitleBar);
    dialog.setContentView(idLayout);
    return dialog;
}

From source file:Main.java

public static Dialog creativeDialog(Context context, int layout) {
    Dialog dialog = new Dialog(context, android.R.style.Theme_Holo_Light_Dialog);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    dialog.setContentView(layout);// w  ww  .j av  a 2  s. c  o m
    return dialog;
}

From source file:cn.apputest.ctria.section2.Dialog_DriverLicenseCard.java

public void alert_DriverLicenseCardDialog(Context context, EditText carnum) {
    // TODO Auto-generated method stub
    contextAlawys = context;/*from w ww . j  a va 2s.c o  m*/

    preferencesuser = context.getSharedPreferences(Login.FILE_USER, Context.MODE_PRIVATE);
    String DBName = preferencesuser.getString(Login.KEY_NAME, "1");
    helper = new DBHelper(context, DBName + "_DB");
    mgr = new DBManager(helper);

    final Dialog dialog = new Dialog(context, R.style.add_dialog);
    View vv = LayoutInflater.from(context)
            .inflate(R.layout.section2activity_lucha2_alert_driverlicensecard_dialog, null);
    dialog.setCanceledOnTouchOutside(true);
    dialog.setContentView(vv);
    // dialog.getWindow().setLayout(480, 524);
    // dialog.getWindow().setLayout(720, 1050);
    Resources r = context.getResources();
    int x = (int) r.getDimension(R.dimen.x320);
    int y = (int) r.getDimension(R.dimen.y350);
    dialog.getWindow().setLayout(x, y);
    dialog.getWindow().setGravity(Gravity.BOTTOM);

    Information = (TextView) vv.findViewById(R.id.DriverLicensecard);
    Information.setClickable(false);
    Information.setLongClickable(false);
    Information.setMovementMethod(ScrollingMovementMethod.getInstance());

    getDriverLicense(carnum);
    ImageButton backButton = (ImageButton) vv.findViewById(R.id.backImageButton);
    backButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            dialog.dismiss();
        }
    });
    dialog.show();
}

From source file:click.kobaken.rxirohaandroid_sample.view.fragment.SplashFragment.java

@NonNull
@Override/*from w  ww  . j  a  v  a  2 s .  co  m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new Dialog(getActivity(), R.style.SplashDialogTheme);
    setCancelable(false);
    return dialog;
}

From source file:com.eu.inmite.android.lib.dialogs.BaseDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new Dialog(getActivity(), R.style.SDL_Dialog);
    // custom dialog background
    final TypedArray a = getActivity().getTheme().obtainStyledAttributes(null, R.styleable.DialogStyle,
            R.attr.sdlDialogStyle, 0);/* w w  w  .  ja  v a  2  s .co  m*/
    Drawable dialogBackground = a.getDrawable(R.styleable.DialogStyle_dialogBackground);
    a.recycle();
    dialog.getWindow().setBackgroundDrawable(dialogBackground);
    return dialog;
}

From source file:com.inter.trade.view.styleddialog.BaseDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new Dialog(getActivity(), R.style.SDL_Dialog);
    // custom dialog background
    final TypedArray a = getActivity().getTheme().obtainStyledAttributes(null, R.styleable.DialogStyle,
            R.attr.sdlDialogStyle, 0);/* w  w w  .java2 s  .c  o  m*/
    Drawable dialogBackground = a.getDrawable(R.styleable.DialogStyle_dialogBackground);
    a.recycle();
    dialog.getWindow().setBackgroundDrawable(dialogBackground);
    Bundle args = getArguments();
    if (args != null) {
        dialog.setCanceledOnTouchOutside(args.getBoolean(BaseDialogBuilder.ARG_CANCELABLE_ON_TOUCH_OUTSIDE));
    }
    return dialog;
}

From source file:com.idreamsky.dreamroom.ui.custum.CatLoadingView.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (mDialog == null) {
        mDialog = new Dialog(getActivity(), R.style.cart_dialog);
        mDialog.setContentView(R.layout.catloading_main);
        mDialog.setCanceledOnTouchOutside(true);
        mDialog.getWindow().setGravity(Gravity.CENTER);

        operatingAnim = new RotateAnimation(360f, 0f, Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        operatingAnim.setRepeatCount(Animation.INFINITE);
        operatingAnim.setDuration(2000);

        eye_left_Anim = new RotateAnimation(360f, 0f, Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        eye_left_Anim.setRepeatCount(Animation.INFINITE);
        eye_left_Anim.setDuration(2000);

        eye_right_Anim = new RotateAnimation(360f, 0f, Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        eye_right_Anim.setRepeatCount(Animation.INFINITE);
        eye_right_Anim.setDuration(2000);

        LinearInterpolator lin = new LinearInterpolator();
        operatingAnim.setInterpolator(lin);
        eye_left_Anim.setInterpolator(lin);
        eye_right_Anim.setInterpolator(lin);

        View view = mDialog.getWindow().getDecorView();

        mouse = view.findViewById(R.id.mouse);

        eye_left = view.findViewById(R.id.eye_left);

        eye_right = view.findViewById(R.id.eye_right);

        eyelid_left = (EyelidView) view.findViewById(R.id.eyelid_left);

        eyelid_left.setColor(Color.parseColor("#d0ced1"));

        eyelid_left.setFromFull(true);/* w  w  w .  j  a v  a 2  s  .  co m*/

        eyelid_right = (EyelidView) view.findViewById(R.id.eyelid_right);

        eyelid_right.setColor(Color.parseColor("#d0ced1"));

        eyelid_right.setFromFull(true);

        mGraduallyTextView = (GraduallyTextView) view.findViewById(R.id.graduallyTextView);

        operatingAnim.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
                eyelid_left.resetAnimator();
                eyelid_right.resetAnimator();
            }
        });
    }
    return mDialog;
}

From source file:cn.reflect.dialogs.core.BaseDialogFragment.java

@NonNull
@Override/*w  w  w . j a v  a 2  s . co m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    int theme = R.style.SDL_Dialog;
    Dialog dialog = new Dialog(getActivity(), theme);

    Bundle args = getArguments();
    if (args != null) {
        dialog.setCanceledOnTouchOutside(args.getBoolean(BaseDialogBuilder.ARG_CANCELABLE_ON_TOUCH_OUTSIDE));
    }
    dialog.setOnShowListener(this);
    return dialog;
}

From source file:arefin.dialogs.core.BaseDialogFragment.java

@NonNull
@Override//  w ww .ja  v a2 s .  com
public Dialog onCreateDialog(Bundle savedInstanceState) {
    int theme = resolveTheme();
    Dialog dialog = new Dialog(getActivity(), theme);
    Bundle args = getArguments();
    if (args != null) {
        dialog.setCanceledOnTouchOutside(args.getBoolean(BaseDialogBuilder.ARG_CANCELABLE_ON_TOUCH_OUTSIDE));
    }
    dialog.setOnShowListener(this);
    return dialog;
}

From source file:com.avast.android.dialogs.core.BaseDialogFragment.java

@NonNull
@Override//w w  w  . j a va 2  s  . c o m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    int theme = resolveTheme();
    Dialog dialog = new Dialog(getActivity(), theme);

    Bundle args = getArguments();
    if (args != null) {
        dialog.setCanceledOnTouchOutside(args.getBoolean(BaseDialogBuilder.ARG_CANCELABLE_ON_TOUCH_OUTSIDE));
    }
    dialog.setOnShowListener(this);
    return dialog;
}