Updater: Migrate away from deprecated ProgressDialog
Follow usage of AlertDialog with ProgressBar as documented in AOSP. https://developer.android.com/reference/android/app/ProgressDialog Change-Id: Ie410f839cb5495a4b37ce926d991d662861ef398
This commit is contained in:
committed by
Michael W
parent
d8e73e380c
commit
b551ebc472
@@ -17,7 +17,6 @@ package org.lineageos.updater;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.app.UiModeManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
@@ -110,8 +109,7 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
|
||||
});
|
||||
|
||||
private UpdateImporter mUpdateImporter;
|
||||
@SuppressWarnings("deprecation")
|
||||
private ProgressDialog importDialog;
|
||||
private AlertDialog importDialog;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -304,14 +302,18 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void onImportStarted() {
|
||||
if (importDialog != null && importDialog.isShowing()) {
|
||||
importDialog.dismiss();
|
||||
}
|
||||
|
||||
importDialog = ProgressDialog.show(this, getString(R.string.local_update_import),
|
||||
getString(R.string.local_update_import_progress), true, false);
|
||||
importDialog = new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.local_update_import)
|
||||
.setView(R.layout.progress_dialog)
|
||||
.setCancelable(false)
|
||||
.create();
|
||||
|
||||
importDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2025 The LineageOS Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="horizontal"
|
||||
android:padding="24dp">
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
app:indicatorColor="?android:attr/colorAccent"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="@string/local_update_import_progress"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user