mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Fix progress dialog deprecation warnings.
Moves everything under our own class and ignores the deprecation. Also gives us future ability to re-style all blocking UI dialogs in the future for mat3 compat.
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
package org.thoughtcrime.securesms.util.task;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
|
||||
import org.thoughtcrime.securesms.components.SignalProgressDialog;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public abstract class ProgressDialogAsyncTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {
|
||||
|
||||
private final WeakReference<Context> contextReference;
|
||||
private ProgressDialog progress;
|
||||
private SignalProgressDialog progress;
|
||||
private final String title;
|
||||
private final String message;
|
||||
|
||||
@@ -29,7 +30,7 @@ public abstract class ProgressDialogAsyncTask<Params, Progress, Result> extends
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
final Context context = contextReference.get();
|
||||
if (context != null) progress = ProgressDialog.show(context, title, message, true);
|
||||
if (context != null) progress = SignalProgressDialog.show(context, title, message, true);
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.thoughtcrime.securesms.util.task;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.view.View;
|
||||
|
||||
@@ -12,6 +10,7 @@ import androidx.lifecycle.Lifecycle;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.components.SignalProgressDialog;
|
||||
|
||||
public abstract class SnackbarAsyncTask<Params>
|
||||
extends AsyncTask<Params, Void, Void>
|
||||
@@ -27,8 +26,8 @@ public abstract class SnackbarAsyncTask<Params>
|
||||
private final int snackbarDuration;
|
||||
private final boolean showProgress;
|
||||
|
||||
private @Nullable Params reversibleParameter;
|
||||
private @Nullable ProgressDialog progressDialog;
|
||||
private @Nullable Params reversibleParameter;
|
||||
private @Nullable SignalProgressDialog progressDialog;
|
||||
|
||||
public SnackbarAsyncTask(@NonNull Lifecycle lifecycle,
|
||||
@NonNull View view,
|
||||
@@ -49,7 +48,7 @@ public abstract class SnackbarAsyncTask<Params>
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
if (this.showProgress) this.progressDialog = ProgressDialog.show(view.getContext(), "", "", true);
|
||||
if (this.showProgress) this.progressDialog = SignalProgressDialog.show(view.getContext(), "", "", true);
|
||||
else this.progressDialog = null;
|
||||
}
|
||||
|
||||
@@ -83,7 +82,7 @@ public abstract class SnackbarAsyncTask<Params>
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
if (showProgress) progressDialog = ProgressDialog.show(view.getContext(), "", "", true);
|
||||
if (showProgress) progressDialog = SignalProgressDialog.show(view.getContext(), "", "", true);
|
||||
else progressDialog = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user