Skip to content

Comments

chore: convert DeckPicker to ViewBinding#19420

Merged
BrayanDSO merged 2 commits intoankidroid:mainfrom
david-allison:deck-picker-view-binding
Nov 6, 2025
Merged

chore: convert DeckPicker to ViewBinding#19420
BrayanDSO merged 2 commits intoankidroid:mainfrom
david-allison:deck-picker-view-binding

Conversation

@david-allison
Copy link
Member

Approach

  • Cherry picked david-allison@6e52b61
  • Fixed conflicts, fixed bad transition of Snackbar/FAB anchorView
  • Tried and failed to use the by viewBinding syntax
  • Did some cleanup of AnkiActivity - this was useful anyway

How Has This Been Tested?

Brief test using

  • Android 34 Tablet Emulator
  • Pixel 6 Pro API 32

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

'0' is acceptable to use as 'no layout'

Improves support for View Bindings

* `activityName` was unused

Issue 11116
We do not use `by viewBinding` here due to how 'NavigationDrawerActivity'
updates the view hierarchy

```
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ichi2.anki.debug/com.ichi2.anki.DeckPicker}: java.lang.ClassCastException: androidx.drawerlayout.widget.ClosableDrawerLayout cannot be cast to androidx.coordinatorlayout.widget.CoordinatorLayout
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3782)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922)
	...
Caused by: java.lang.ClassCastException: androidx.drawerlayout.widget.ClosableDrawerLayout cannot be cast to androidx.coordinatorlayout.widget.CoordinatorLayout
	at com.ichi2.anki.databinding.HomescreenBinding.bind(HomescreenBinding.java:130)
	at com.ichi2.anki.DeckPicker$special$$inlined$viewBindingActivityWithCallbacks$default$1.invoke(ActivityViewBindings.kt:162)
	at com.ichi2.anki.DeckPicker$special$$inlined$viewBindingActivityWithCallbacks$default$1.invoke(ActivityViewBindings.kt:141)
	at dev.androidbroadcast.vbpd.LazyViewBindingProperty.getValue(ViewBindingProperty.kt:78)
	at dev.androidbroadcast.vbpd.ActivityViewBindingProperty.getValue(ActivityViewBindings.kt:62)
	at dev.androidbroadcast.vbpd.ActivityViewBindingProperty.getValue(ActivityViewBindings.kt:50)
	at com.ichi2.anki.DeckPicker.getBinding(DeckPicker.kt:254)
	at com.ichi2.anki.DeckPicker.onCreate(DeckPicker.kt:534)
	...
```

Issue 11116
@david-allison david-allison marked this pull request as ready for review November 4, 2025 14:38
Copy link
Member

@lukstbit lukstbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit complicated with all the bindings but looks good.

@lukstbit lukstbit added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Nov 4, 2025
@BrayanDSO BrayanDSO added Needs Author Reply Waiting for a reply from the original author Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Nov 5, 2025
@david-allison david-allison added Needs reviewer reply Waiting for a reply from another reviewer and removed Needs Author Reply Waiting for a reply from the original author labels Nov 5, 2025
@BrayanDSO BrayanDSO removed the Needs reviewer reply Waiting for a reply from another reviewer label Nov 6, 2025
@BrayanDSO BrayanDSO added this pull request to the merge queue Nov 6, 2025
Merged via the queue into ankidroid:main with commit 1563f51 Nov 6, 2025
18 checks passed
@github-actions github-actions bot added this to the 2.23 release milestone Nov 6, 2025
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Nov 6, 2025
@david-allison david-allison mentioned this pull request Nov 6, 2025
92 tasks
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.

3 participants