flackbash / AudioAnchor

Android audio player that tracks the listening progress of your audio books and podcasts
GNU General Public License v3.0
216 stars 40 forks source link

Fix deprecations, optimize code #162

Open PatrykMis opened 2 years ago

PatrykMis commented 2 years ago

Examples:

Loaders in activity, android.app, content, … deprecated

files:

Loaders have been deprecated as of Android P (API 28). The recommended option for dealing with loading data while handling the Activity and Fragment lifecycles is to use a combination of ViewModels and LiveData.

How to replace it: https://developer.android.com/topic/libraries/architecture/viewmodel#loaders

If still there is need to use loaders, in app/build.gradle: implementation("androidx.loader:loader:1.1.0") …and make adjustments accordinly.

PhoneStateListener in android.telephony has been deprecated

files:

This class was deprecated in API level 31. Use TelephonyCallback instead.

May be useful discussion: https://stackoverflow.com/questions/69571012/telephonymanager-deprecated-listen-call-state-ringing-on-android-12

flackbash commented 2 years ago

I agree and if I had more time, I would do it :) It's a good reminder though and thanks for the links.