Skip to content

Commit 173fa50

Browse files
committed
Begin migration from ProgressDialog to custom DialogFragment
This replaces the deprecated ProgressDialog with a DialogFragment-based implementation. ProgressDialog was deprecated in API level 26 (Android 8.0) because it: 1. Fails to handle config changes (e.g. screen rotation) 2. Does not follow Material Design guidelines 3. Can cause window-leak errors in some cases Benefits of the DialogFragment implementation: 1. Handles config changes automatically 2. Material Design compliant via MaterialAlertDialogBuilder 3. Prevents memory leaks via proper lifecycle management 4. Consistent UI on all Android versions Here, only the usage in Sync.kt has been updated, so that we can test with a limited scope initially. All other ProgressDialog usages will be updated in follow-up pull requests. Added AndroidManifest.xml in androidTest directory to declare EmptyFragmentActivity required by FragmentScenario.launchFragmentInContainer() used in the new AnkiProgressDialogFragmentTest. Changed "libs.androidx.fragment.testing.manifest" from debugImplementation to implementation to ensure fragment testing infrastructure is available in all build variants, not just debug builds, since androidTest runs against both debug and release configurations.
1 parent 25d8511 commit 173fa50

File tree

11 files changed

+1503
-4
lines changed

11 files changed

+1503
-4
lines changed

AnkiDroid/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ dependencies {
386386
implementation libs.kotlinx.serialization.json
387387
implementation libs.seismic
388388

389-
debugImplementation libs.androidx.fragment.testing.manifest
389+
implementation libs.androidx.fragment.testing.manifest
390390

391391
// Backend libraries
392392

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<application>
5+
<!-- Needed for FragmentScenario.launchInContainer -->
6+
<activity
7+
android:name="androidx.fragment.app.testing.EmptyFragmentActivity"
8+
android:exported="true" />
9+
</application>
10+
11+
</manifest>

0 commit comments

Comments
 (0)