Skip to content

Commit

Permalink
fix(browse): fix regression showing borders
Browse files Browse the repository at this point in the history
`cardBrowserDivider` was defined as a color
but we sometimes provided a reference

Fixes 17751
  • Loading branch information
david-allison authored and mikehardy committed Jan 8, 2025
1 parent 16a4de8 commit 17da2ec
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
7 changes: 7 additions & 0 deletions AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ import androidx.annotation.MainThread
import androidx.annotation.VisibleForTesting
import androidx.appcompat.widget.SearchView
import androidx.appcompat.widget.ThemeUtils
import androidx.core.content.ContextCompat
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import anki.collection.OpChanges
Expand Down Expand Up @@ -379,6 +381,11 @@ open class CardBrowser :
// Load reference to action bar title
actionBarTitle = findViewById(R.id.toolbar_title)
cardsListView = findViewById(R.id.card_browser_list)
DividerItemDecoration(this, DividerItemDecoration.VERTICAL).apply {
setDrawable(ContextCompat.getDrawable(this@CardBrowser, R.drawable.browser_divider)!!)
cardsListView.addItemDecoration(this)
}

// get the font and font size from the preferences
// make a new list adapter mapping the data in mCards to column1 and column2 of R.layout.card_item_browser
cardsAdapter =
Expand Down
7 changes: 7 additions & 0 deletions AnkiDroid/src/main/res/drawable/browser_divider.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 0.5 appears badly aliased on Emulators -->
<size android:height="0.6dp" android:width="2dp"/>
<solid android:color="?attr/cardBrowserDivider" />
</shape>
2 changes: 0 additions & 2 deletions AnkiDroid/src/main/res/layout/card_browser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
android:id="@+id/card_browser_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/colorBackground"
android:divider="?attr/cardBrowserDivider"
android:overScrollFooter="@color/transparent"
android:dividerHeight="0.5dp"
android:clipToPadding="false"
Expand Down
2 changes: 1 addition & 1 deletion AnkiDroid/src/main/res/values/theme_light.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<item name="goodButtonRippleRef">@drawable/footer_button_ripple</item>
<item name="easyButtonRippleRef">@drawable/footer_button_ripple</item>
<!-- Card Browser Colors -->
<item name="cardBrowserDivider">?attr/dividerHorizontal</item>
<item name="cardBrowserDivider">#CCCCCC</item>
<!-- Browser colors -->
<item name="suspendedColor">#FFFFB2</item>
<item name="buriedColor">#FFCE7C</item>
Expand Down
2 changes: 1 addition & 1 deletion AnkiDroid/src/main/res/values/theme_plain.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<item name="goodButtonRippleRef">@drawable/footer_button_all_plain_ripple</item>
<item name="easyButtonRippleRef">@drawable/footer_button_all_plain_ripple</item>
<!-- Card Browser Colors -->
<item name="cardBrowserDivider">?attr/dividerHorizontal</item>
<item name="cardBrowserDivider">#CCCCCC</item>
<!-- Note editor colors -->
<item name="editTextBackgroundColor">#EBCCCCCC</item>
<item name="toolbarBackgroundColor">#D6D7D7</item>
Expand Down

0 comments on commit 17da2ec

Please sign in to comment.