ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.48k stars 2.2k forks source link

Deprecation - handle new deprecation in localbroadcastmanager 1.1.0 #10185

Closed mikehardy closed 2 years ago

mikehardy commented 2 years ago

Expected steps + outcome:

> Task :AnkiDroid:compilePlayReleaseJavaWithJavac
/home/runner/work/Anki-Android/Anki-Android/AnkiDroid/src/main/java/com/ichi2/widget/WidgetStatus.java:22: warning: [deprecation] LocalBroadcastManager in androidx.localbroadcastmanager.content has been deprecated
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
                                             ^
/home/runner/work/Anki-Android/Anki-Android/AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidApp.java:38: warning: [deprecation] LocalBroadcastManager in androidx.localbroadcastmanager.content has been deprecated
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
                                             ^
error: warnings found and -Werror specified
1 error
2 warnings

Need to handle new deprecation

Originally posted by @mikehardy in https://github.com/ankidroid/Anki-Android/issues/10183#issuecomment-1012140708

Supriyo9 commented 2 years ago

@mikehardy Just updating dependency locally in a new branch to localbroadcastmanager 1.1.0 will not work , better if it is replaced with LiveData https://developer.android.com/topic/libraries/architecture/livedata

mikehardy commented 2 years ago

Okay, that is essentially what the deprecation notice on the android developer site says. How do you propose integrating LiveData into these two areas then? If you could lay out a rough design, or maybe put up a really rough pull request, that would help to reason about it

ariondey commented 2 years ago

Noticed that nobody has updated on this issue, but how do we feel if we just replace localbroadcastmanager with green robot's EventBus? Reason being is that the transition will be much smoother because a lot of the code can be simplified. I'll try getting a rough design or ideally a PR in the coming days but in theory it shouldn't be too complicated and it'll fix the depreciation issue.

mikehardy commented 2 years ago

I'm open to that. It's a well maintained project and I use it in some other repos.

github-actions[bot] commented 2 years ago

Hello đź‘‹, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

oyeraghib commented 2 years ago

@mikehardy @david-allison I would like to work on this issue.

david-allison commented 2 years ago

Thanks!

s-deepak-kumar commented 2 years ago

Hello @oyeraghib, are you still working on it?

oyeraghib commented 2 years ago

@s-deepak-kumar I am still working on it. Actually it's not a easy transition from localbroadcastmanager to LiveData and ViewModel. A proper way has to be constructed to make it work. If you have gone through the codebase for that and have information around LiveData and ViewModel I would love to hear your views about the same.