android.support.v7.app.AppCompatDialog Java Examples

The following examples show how to use android.support.v7.app.AppCompatDialog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LatteLoader.java    From FastWaiMai with MIT License 6 votes vote down vote up
public static void showLoading(Context context,String type){

        final AppCompatDialog dialog = new AppCompatDialog(context, R.style.dialog);
        final AVLoadingIndicatorView avLoadingIndicatorView = LoaderCreator.create(type, context);
        dialog.setContentView(avLoadingIndicatorView);

        int deviceWidth = DimenUtil.getScreenWidth();
        int deviceHeigth = DimenUtil.getScreenHeight();

        final Window dialogWindow = dialog.getWindow();
        if(dialogWindow != null){
            WindowManager.LayoutParams lp = dialogWindow.getAttributes();
            lp.width = deviceWidth/LOADER_SIZE_SCALE;
            lp.height = deviceHeigth/LOADER_SIZE_SCALE;
            lp.height = lp.height + LOADER_OFFSIZE;
            lp.gravity = Gravity.CENTER;

        }
        LOADERS.add(dialog);
        dialog.show();
    }
 
Example #2
Source File: ws_Main3Activity.java    From styT with Apache License 2.0 6 votes vote down vote up
private void eoou2(String dec) {
    //com.tencent.mm.plugin.scanner.ui.BaseScanUI
    final SharedPreferences i = this.getSharedPreferences("Hero", 0);
    Boolean o0 = i.getBoolean("FIRST", true);
    if (o0) {//第一次
        AppCompatDialog alertDialog = new AlertDialog.Builder(ws_Main3Activity.this)
                .setTitle("快捷功能")
                .setMessage("需要ROOT才能使用")
                .setNeutralButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        i.edit().putBoolean("FIRST", false).apply();
                    }
                }).setCancelable(false).create();
        alertDialog.show();
    } else {
        ShellUtils.execCommand("am start -n com.eg.android.AlipayGphone/" + dec, true, true);
    }
}
 
Example #3
Source File: ws_Main3Activity.java    From styT with Apache License 2.0 6 votes vote down vote up
private void eoou(String dec) {
    //com.tencent.mm.plugin.scanner.ui.BaseScanUI
    final SharedPreferences i = this.getSharedPreferences("Hero", 0);
    Boolean o0 = i.getBoolean("FIRST", true);
    if (o0) {//第一次
        AppCompatDialog alertDialog = new AlertDialog.Builder(ws_Main3Activity.this)
                .setTitle("快捷功能")
                .setMessage("需要ROOT才能使用")
                .setNeutralButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        i.edit().putBoolean("FIRST", false).apply();
                    }
                }).setCancelable(false).create();
        alertDialog.show();
    } else {
        ShellUtils.execCommand("am start -n com.tencent.mm/" + dec, true, true);
    }
}
 
Example #4
Source File: DialogUIUtils.java    From KUtils with Apache License 2.0 6 votes vote down vote up
/**
 * 关闭弹出框
 */
public static void dismiss(DialogInterface... dialogs) {
    if (dialogs != null && dialogs.length > 0) {
        for (DialogInterface dialog : dialogs) {
            if (dialog instanceof Dialog) {
                Dialog dialog1 = (Dialog) dialog;
                if (dialog1.isShowing()) {
                    dialog1.dismiss();
                }
            } else if (dialog instanceof AppCompatDialog) {
                AppCompatDialog dialog2 = (AppCompatDialog) dialog;
                if (dialog2.isShowing()) {
                    dialog2.dismiss();
                }
            }
        }

    }


}
 
Example #5
Source File: DialogUIUtils.java    From KUtils-master with Apache License 2.0 6 votes vote down vote up
/**
 * 关闭弹出框
 */
public static void dismiss(DialogInterface... dialogs) {
    if (dialogs != null && dialogs.length > 0) {
        for (DialogInterface dialog : dialogs) {
            if (dialog instanceof Dialog) {
                Dialog dialog1 = (Dialog) dialog;
                if (dialog1.isShowing()) {
                    dialog1.dismiss();
                }
            } else if (dialog instanceof AppCompatDialog) {
                AppCompatDialog dialog2 = (AppCompatDialog) dialog;
                if (dialog2.isShowing()) {
                    dialog2.dismiss();
                }
            }
        }

    }


}
 
Example #6
Source File: CocoQuery.java    From COCOFramework with Apache License 2.0 6 votes vote down vote up
private AppCompatDialog create(String mLicensesText, CharSequence str) {
    //Get resources
    final WebView webView = new WebView(getContext());
    webView.loadDataWithBaseURL(null, mLicensesText, "text/html", "utf-8", null);

    final AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
            .setView(webView).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });
    if (str != null)
        builder.setTitle(str);
    return builder.create();
}
 
Example #7
Source File: ResUtil.java    From Puff-Android with MIT License 6 votes vote down vote up
public AppCompatDialog showProgressbar(Activity activity, long timeout, boolean cancelable) {
    final AppCompatDialog dialog = new AppCompatDialog(activity);
    dialog.setContentView(R.layout.dialog_progress);
    dialog.setCancelable(cancelable);
    dialog.setTitle("Progressing...");
    ProgressBar progressBar = (ProgressBar) dialog.findViewById(R.id.progress);
    if (timeout > 0) {
        Handler handler = new Handler(activity.getMainLooper());
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                dialog.cancel();
                dialog.dismiss();
            }
        }, timeout);
        dialog.show();
    } else {
        dialog.show();
    }
    return dialog;
}
 
Example #8
Source File: LatteLoader.java    From FastWaiMai with MIT License 5 votes vote down vote up
public static void stopLoading(){
    for(AppCompatDialog dialog:LOADERS){
        if(dialog != null){
            if(dialog.isShowing()){
                //cancel可以执行回调
                dialog.cancel();

                //dialog.dismiss();
            }
        }
    }
}
 
Example #9
Source File: MoverActivity.java    From SystemAppMover with Apache License 2.0 5 votes vote down vote up
/**
 * Shows the initial warning dialog
 */
void showWarningDialog() {
    final AppCompatDialog d = new AppCompatDialog(this);
    d.setTitle("Warning");
    d.setCancelable(false);
    d.setContentView(R.layout.warningdialog);

    final CheckBox c = (CheckBox) d.findViewById(R.id.c);
    final Button b = (Button) d.findViewById(R.id.b);

    c.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
            b.setText(checked ? android.R.string.ok : android.R.string.cancel);
        }
    });

    b.setText(android.R.string.cancel);
    b.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (c.isChecked()) {
                getSharedPreferences("settings", MODE_PRIVATE).edit()
                        .putBoolean("warningRead", true).commit();
                d.dismiss();
            } else {
                d.dismiss();
                finish();
            }
        }
    });

    d.show();
}
 
Example #10
Source File: ExampleDialogFragment.java    From SwipeAwayDialog with MIT License 5 votes vote down vote up
@Override
public @NonNull Dialog create(Context context, ExampleDialogFragment fragment) {
    String[] urls = context.getResources().getStringArray(R.array.octocat_urls);
    AppCompatDialog dialog = new AppCompatDialog(context);
    dialog.setContentView(R.layout.dialog_custom);
    Glide.with(fragment)
            .load(urls[sRandom.nextInt(urls.length)])
            .into((ImageView) dialog.findViewById(R.id.customdialog_image));
    return dialog;
}
 
Example #11
Source File: MainActivity.java    From DialogUtils with Apache License 2.0 5 votes vote down vote up
private void showDialog() {
        // AlertDialog dialog = new AlertDialog(this);
        AppCompatDialog dialog = new AppCompatDialog(this);
        dialog.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);//key code to remove title
        Window window = dialog.getWindow();
        window.setGravity(Gravity.BOTTOM);
        window.setWindowAnimations(R.style.mystyle);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));//round corner
        // window.setBackgroundDrawableResource(R.drawable.bg_ios_roundcorner);
        // window.requestFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.dialog_ios_alert_bottom);
        // AlertDialog.Builder builder = new AlertDialog.Builder(this);


        // 可以在此设置显示动画
        WindowManager.LayoutParams wl = window.getAttributes();
       /* wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();*/
// 以下这两句是为了保证按钮可以水平满屏
        int width = getWindowManager().getDefaultDisplay().getWidth();

        // wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.width = (int) (width * 0.85);  // todo keycode gap
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        //wl.horizontalMargin= 0.2f;
// 设置显示位置
        // wl.gravity = Gravity.CENTER_HORIZONTAL;

        dialog.onWindowAttributesChanged(wl);
        dialog.show();
    }
 
Example #12
Source File: ResUtil.java    From Puff-Android with MIT License 4 votes vote down vote up
public AppCompatDialog showProgressbar(Activity activity, long timeout) {
    return showProgressbar(activity, timeout, true);
}
 
Example #13
Source File: ResUtil.java    From Puff-Android with MIT License 4 votes vote down vote up
public AppCompatDialog showProgressbar(Activity activity) {
    return showProgressbar(activity, 0, false);
}
 
Example #14
Source File: StatisticsDialog.java    From mosby with Apache License 2.0 4 votes vote down vote up
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) {

    AppCompatDialog dialog = new AppCompatDialog(getActivity(), getTheme());
    dialog.setTitle(R.string.menu_statistics);
    return dialog;
  }
 
Example #15
Source File: SavePlaylistDialog.java    From VCL-Android with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    return new AppCompatDialog(getActivity(), getTheme());

}
 
Example #16
Source File: StytledDialog.java    From DialogUtils with Apache License 2.0 4 votes vote down vote up
public static void dismiss(AppCompatDialog dialog){
    if (dialog != null && dialog.isShowing()){
        dialog.dismiss();
    }
}
 
Example #17
Source File: AppCompatListPreference.java    From QuickLyric with GNU General Public License v3.0 4 votes vote down vote up
@Override
public AppCompatDialog getDialog() {
    return mDialog;
}
 
Example #18
Source File: AppCompatMultiSelectListPreference.java    From QuickLyric with GNU General Public License v3.0 4 votes vote down vote up
@Override
public AppCompatDialog getDialog() {
    return mDialog;
}
 
Example #19
Source File: ColorGridPreference.java    From QuickLyric with GNU General Public License v3.0 4 votes vote down vote up
@Override
public AppCompatDialog getDialog() {
    return mDialog;
}
 
Example #20
Source File: CanBaseDialog.java    From CanDialog with Apache License 2.0 4 votes vote down vote up
public AppCompatDialog getCompatDialog() {
    return compatDialog;
}