Java Code Examples for android.support.v7.app.AppCompatDialog#show()
The following examples show how to use
android.support.v7.app.AppCompatDialog#show() .
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 |
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 |
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 |
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: ResUtil.java From Puff-Android with MIT License | 6 votes |
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 5
Source File: MainActivity.java From DialogUtils with Apache License 2.0 | 5 votes |
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 6
Source File: MoverActivity.java From SystemAppMover with Apache License 2.0 | 5 votes |
/** * 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(); }