wordpress-mobile / wordpress-mobile/WordPress-Android
Add support for the predictive back gesture
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 3.2k
- Forks
- 1.4k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 69
Description
The predictive back gesture feature was introduced in Android 13 but will be available on Android 14. We should prepare the app and enable the feature.
On the Android 13 migration, we updated super.onBackPressed() calls with the function below.
fun AppCompatActivity.onBackPressedCompat(onBackPressedCallback: OnBackPressedCallback) {
onBackPressedCallback.isEnabled = false
onBackPressedDispatcher.onBackPressed()
onBackPressedCallback.isEnabled = true
}
This function mimics the super.onBackPressed behavior but breaks the predictive back gesture behavior, as explained here. Therefore, before enabling predictive back gesture, all usages of onBackPressedCompat should be reviewed and updated.
- Here is a StackOverflow comment on how we can update our back pressed approach to the new ahead-of-time approach.
- Further discussion initiating this issue is on https://github.com/wordpress-mobile/WordPress-Android/pull/18019.
- Official document: https://developer.android.com/guide/navigation/predictive-back-gesture
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by searching for all usages of onBackPressedCompat and read the linked Android predictive back documentation and discussion. Review each usage against the ahead-of-time back approach, then enable predictive back once the affected usages have been updated and the gesture behavior works correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100