From 27f020a4bdc47a14e703a5d19e2391ff2436ad5a Mon Sep 17 00:00:00 2001 From: nift4 Date: Thu, 11 Feb 2021 12:08:16 +0100 Subject: [PATCH] Don't use the deprecated ProgressDialog --- .idea/modules/app/AndroidBootManager.app.iml | 6 +++--- .../app/util/MiscUtils.java | 21 ++++++++++--------- app/src/main/res/layout/progressdialog.xml | 18 ++++++++++++++++ 3 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 app/src/main/res/layout/progressdialog.xml diff --git a/.idea/modules/app/AndroidBootManager.app.iml b/.idea/modules/app/AndroidBootManager.app.iml index 40bccf6e..1e0bd4d0 100644 --- a/.idea/modules/app/AndroidBootManager.app.iml +++ b/.idea/modules/app/AndroidBootManager.app.iml @@ -66,9 +66,9 @@ - - - + + + diff --git a/app/src/main/java/org/androidbootmanager/app/util/MiscUtils.java b/app/src/main/java/org/androidbootmanager/app/util/MiscUtils.java index be463c83..80a34140 100644 --- a/app/src/main/java/org/androidbootmanager/app/util/MiscUtils.java +++ b/app/src/main/java/org/androidbootmanager/app/util/MiscUtils.java @@ -1,16 +1,18 @@ package org.androidbootmanager.app.util; import android.app.AlertDialog; -import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.TextView; import com.topjohnwu.superuser.Shell; import org.androidbootmanager.app.R; public class MiscUtils { - public static ProgressDialog prog; + public static AlertDialog prog; public static void sure(Context c, DialogInterface d, String msg, DialogInterface.OnClickListener v) { d.dismiss(); new AlertDialog.Builder(c) @@ -27,14 +29,13 @@ public static void sure(Context c, DialogInterface d, int msg, DialogInterface.O } public static void w(Context c, String msg, Runnable r) { - //TODO: no more deprecated ProgressDialog - prog = new ProgressDialog(c); - prog.setIndeterminate(true); - prog.setCanceledOnTouchOutside(false); - prog.setCancelable(false); - prog.setTitle(R.string.wait); - prog.setMessage(msg); - prog.show(); + View v = LayoutInflater.from(c).inflate(R.layout.progressdialog, null); + ((TextView) v.findViewById(R.id.prog_message)).setText(msg); + prog = new AlertDialog.Builder(c) + .setCancelable(false) + .setTitle(R.string.wait) + .setView(v) + .show(); r.run(); } diff --git a/app/src/main/res/layout/progressdialog.xml b/app/src/main/res/layout/progressdialog.xml new file mode 100644 index 00000000..c3cd88e2 --- /dev/null +++ b/app/src/main/res/layout/progressdialog.xml @@ -0,0 +1,18 @@ + + + + + +