Skip to content

Commit 27f020a

Browse files
committed
Don't use the deprecated ProgressDialog
1 parent b32129e commit 27f020a

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

.idea/modules/app/AndroidBootManager.app.iml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/org/androidbootmanager/app/util/MiscUtils.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
package org.androidbootmanager.app.util;
22

33
import android.app.AlertDialog;
4-
import android.app.ProgressDialog;
54
import android.content.Context;
65
import android.content.DialogInterface;
6+
import android.view.LayoutInflater;
7+
import android.view.View;
8+
import android.widget.TextView;
79

810
import com.topjohnwu.superuser.Shell;
911

1012
import org.androidbootmanager.app.R;
1113

1214
public class MiscUtils {
13-
public static ProgressDialog prog;
15+
public static AlertDialog prog;
1416
public static void sure(Context c, DialogInterface d, String msg, DialogInterface.OnClickListener v) {
1517
d.dismiss();
1618
new AlertDialog.Builder(c)
@@ -27,14 +29,13 @@ public static void sure(Context c, DialogInterface d, int msg, DialogInterface.O
2729
}
2830

2931
public static void w(Context c, String msg, Runnable r) {
30-
//TODO: no more deprecated ProgressDialog
31-
prog = new ProgressDialog(c);
32-
prog.setIndeterminate(true);
33-
prog.setCanceledOnTouchOutside(false);
34-
prog.setCancelable(false);
35-
prog.setTitle(R.string.wait);
36-
prog.setMessage(msg);
37-
prog.show();
32+
View v = LayoutInflater.from(c).inflate(R.layout.progressdialog, null);
33+
((TextView) v.findViewById(R.id.prog_message)).setText(msg);
34+
prog = new AlertDialog.Builder(c)
35+
.setCancelable(false)
36+
.setTitle(R.string.wait)
37+
.setView(v)
38+
.show();
3839
r.run();
3940
}
4041

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="wrap_content"
5+
android:orientation="horizontal"
6+
android:padding="20dp">
7+
<ProgressBar
8+
android:layout_width="0dp"
9+
android:layout_height="wrap_content"
10+
android:layout_weight="1" />
11+
12+
<TextView
13+
android:layout_width="0dp"
14+
android:layout_height="match_parent"
15+
android:layout_weight="4"
16+
android:gravity="center"
17+
android:id="@+id/prog_message" />
18+
</LinearLayout>

0 commit comments

Comments
 (0)