chinwag-android/app/src/main/java/com/keylesspalace/tusky/interfaces
Christophe Beyls ad1afdd241
Refactor permissions requests to use ActivityResultContract (#4391)
The app currently uses a custom callback system for requesting
permissions, located in `BaseActivity`.
This code doesn't work when the activity gets re-created before the
permission is granted: the callback will be lost with the Activity and
no action will be performed after the permission is granted.

To avoid these issues while still simplifying the code, Google
recommends to use the ActivityResultContract APIs to request
permissions, which allow to register persistent callbacks. This pull
request removes the legacy API and replaces the calls with
`registerForActivityResult(ActivityResultContracts.RequestPermission())`.

- `ActivityResultContracts.RequestPermission` will check if the
permission is already granted and call the callback synchronously when
possible. So this check doesn't need to be performed anymore.
- In `SearchStatusesFragment` and `SFragment`, the download action to
launch after granting the permission requires an argument (a list of
media URLs). This argument is temporarily stored in a Fragment field and
saved and restored as part of the instance state, so the action can
properly resume after an Activity re-creation.
2024-05-03 21:42:35 +02:00
..
AccountActionListener.kt Fix lint warnings (#4019) 2023-09-13 09:20:53 +02:00
AccountSelectionListener.kt Refactor notifications to Kotlin & paging (#4026) 2024-05-03 18:27:10 +02:00
ActionButtonActivity.java Upgrade to AndroidX, move to MaterialComponents theme (#953) 2018-12-17 15:25:35 +01:00
FabFragment.kt Add trending tags (#3149) 2023-02-14 19:52:11 +01:00
HashtagActionListener.kt Add view for browsing and unfollowing followed hashtags (#2794) 2022-12-01 19:24:27 +01:00
LinkListener.kt merge ModalTimelineActivity & ViewTagActivity into StatusListActivity (#2332) 2022-02-25 18:57:31 +01:00
RefreshableFragment.kt add ktlint plugin to project and apply default code style (#2209) 2021-06-28 21:13:24 +02:00
ReselectableFragment.kt add ktlint plugin to project and apply default code style (#2209) 2021-06-28 21:13:24 +02:00
StatusActionListener.java Machine translation of posts (#4307) 2024-03-09 16:12:18 +01:00