Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Android's per-app language setting. #4228

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

MohitMaliFtechiz
Copy link
Collaborator

@MohitMaliFtechiz MohitMaliFtechiz commented Feb 14, 2025

Fixes #4222

  • Introduced the per-app language feature in application.
  • Added androidx.appcompat:appcompat-resources dependency.
  • Setting the chosen language in AppCompatDelegate to update the selected language globally so that it is displayed in the system settings.
  • Migrated the previously chosen language in AppCompatDelegate so that the previously selected language will remain active.
  • Added support for pre Android 13 devices since this API is introduced in Android 13 so we have added the backward compatibility for this API.
  • Since now, AppCompatDelegate is handling our locales and we don't need to handle it by ourself so we have removed the unused code from our application.
  • Refactored the test cases to use this new API for handling the locales.
  • Fixed: The message was showing in the previously chosen language when saving the file, and showing the downloading estimate time in the previously chosen language.
  • Fixed: Some unnecessary memory leaks were reported in Android 14 and above devices due to UiModeManager has a memory leak in Android U square/leakcanary#2559.

Below Android 13 devices

Per_app_language_android8.mp4

Above Android 15 devices

Per_app_language_android15.mp4

@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as draft February 14, 2025 11:21
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 6 lines in your changes missing coverage. Please review.

Project coverage is 57.62%. Comparing base (102162f) to head (2b007c5).

Files with missing lines Patch % Lines
...va/org/kiwix/kiwixmobile/core/main/KiwixWebView.kt 0.00% 5 Missing ⚠️
...wix/kiwixmobile/core/settings/CorePrefsFragment.kt 75.00% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (66.66%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4228      +/-   ##
============================================
+ Coverage     57.49%   57.62%   +0.13%     
- Complexity     1582     1601      +19     
============================================
  Files           316      316              
  Lines         13786    13755      -31     
  Branches       1729     1728       -1     
============================================
+ Hits           7926     7927       +1     
+ Misses         4669     4650      -19     
+ Partials       1191     1178      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

* Introduced the per-app language feature in application.
* Added `androidx.appcompat:appcompat-resources` dependency.
…ed language globally so that it is displayed in the system settings.
…t previously selected language will remains active.
…ices.

* Since now, `AppCompatDelegate` is handling our local and we don't need to handle it by ourself so we have removed the unused code from our application.
* Refactored the test cases to use this new API for handling the locales.
…ing the file, and showing the downloading estimate time.
…above devices.

* Upgraded the `com.squareup.leakcanary` version to `2.14`.
…dResumeInOtherLanguage` and `verifyHelpActivity` test cases, as it is incorrectly detecting leaks in Android's internal classes.
…istoryDialogTest` test case, as it is incorrectly detecting leaks in Android's internal classes.
@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as ready for review February 18, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Android's per-app language setting
2 participants