Skip to content

Commit 6a5b14a

Browse files
authored
Merge pull request #941 from mikepenz/fix/swipe_sample
Fix swipe sample item colors
2 parents e0c4502 + a1cbfe7 commit 6a5b14a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

app/src/main/java/com/mikepenz/fastadapter/app/items/SwipeableDrawerItem.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.mikepenz.fastadapter.app.items
22

3-
import android.graphics.Color
43
import android.view.View
54
import android.widget.TextView
65
import androidx.annotation.StringRes
@@ -135,11 +134,12 @@ class SwipeableDrawerItem : AbstractItem<SwipeableDrawerItem.ViewHolder>(), ISwi
135134
}
136135

137136
override fun onDropped() {
138-
itemContent.setBackgroundColor(Color.WHITE)
137+
// note this is only to showcase this callback, remember that changes to the item need to be remembered when a viewHolder is re-used
138+
// itemContent.setBackgroundColor(itemContent.context.getThemeColor(R.attr.colorPrimary))
139139
}
140140

141141
override fun onDragged() {
142-
itemContent.setBackgroundColor(Color.LTGRAY)
142+
// itemContent.setBackgroundColor(itemContent.context.getThemeColor(R.attr.colorPrimary))
143143
}
144144

145145
override val swipeableView: View

app/src/main/res/layout/swipeable_drawer_item.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@
7777
android:id="@+id/item_content"
7878
android:layout_width="match_parent"
7979
android:layout_height="@dimen/material_drawer_item_primary"
80-
android:background="@android:color/white"
80+
android:background="?android:colorBackground"
8181
android:clickable="true"
8282
android:elevation="4dp"
8383
android:focusable="true"
84+
android:foreground="?android:selectableItemBackground"
8485
android:gravity="center_vertical|start"
8586
android:orientation="vertical"
8687
android:paddingStart="@dimen/material_drawer_vertical_padding"

0 commit comments

Comments
 (0)