Fix / Epoxy divider not showing

This commit is contained in:
Valere 2020-03-19 11:23:15 +01:00
parent 08cfe79625
commit 0c1f30208d
9 changed files with 32 additions and 10 deletions

View File

@ -16,10 +16,13 @@
package im.vector.riotx.core.extensions
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.airbnb.epoxy.EpoxyController
import im.vector.riotx.R
import im.vector.riotx.features.themes.ThemeUtils
/**
* Apply a Vertical LinearLayout Manager to the recyclerView and set the adapter from the epoxy controller
@ -40,7 +43,13 @@ fun RecyclerView.configureWith(epoxyController: EpoxyController,
itemAnimator?.let { this.itemAnimator = it }
}
if (showDivider) {
addItemDecoration(DividerItemDecoration(context, DividerItemDecoration.VERTICAL))
addItemDecoration(
DividerItemDecoration(context, DividerItemDecoration.VERTICAL).apply {
ContextCompat.getDrawable(context, ThemeUtils.getResourceId(context, R.drawable.divider_horizontal_light))?.let {
setDrawable(it)
}
}
)
}
setHasFixedSize(hasFixedSize)
adapter = epoxyController.adapter

View File

@ -58,7 +58,7 @@ class ViewReactionsBottomSheet : VectorBaseBottomSheetDialogFragment(), ViewReac
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
sharedActionViewModel = activityViewModelProvider.get(MessageSharedActionViewModel::class.java)
recyclerView.configureWith(epoxyController, hasFixedSize = false)
recyclerView.configureWith(epoxyController, hasFixedSize = false, showDivider = true)
bottomSheetTitle.text = context?.getString(R.string.reactions)
epoxyController.listener = this
}

View File

@ -62,7 +62,7 @@ class DeviceVerificationInfoBottomSheet : VectorBaseBottomSheetDialogFragment(),
super.onActivityCreated(savedInstanceState)
recyclerView.configureWith(
epoxyController,
showDivider = true,
showDivider = false,
hasFixedSize = false)
epoxyController.callback = this
bottomSheetTitle.isVisible = false

View File

@ -170,6 +170,7 @@ object ThemeUtils {
R.drawable.bg_search_edit_text_light -> R.drawable.bg_search_edit_text_dark
R.drawable.bg_unread_notification_light -> R.drawable.bg_unread_notification_dark
R.drawable.vector_label_background_light -> R.drawable.vector_label_background_dark
R.drawable.divider_horizontal_light -> R.drawable.divider_horizontal_dark
else -> {
Timber.w("Warning, missing case for wanted drawable in dark theme")
resourceId
@ -181,6 +182,7 @@ object ThemeUtils {
R.drawable.bg_search_edit_text_light -> R.drawable.bg_search_edit_text_black
R.drawable.bg_unread_notification_light -> R.drawable.bg_unread_notification_black
R.drawable.vector_label_background_light -> R.drawable.vector_label_background_black
R.drawable.divider_horizontal_light -> R.drawable.divider_horizontal_black
else -> {
Timber.w("Warning, missing case for wanted drawable in black theme")
resourceId

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="1dp" />
<solid android:color="@color/riotx_header_panel_border_mobile_black" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="1dp" />
<solid android:color="@color/riotx_header_panel_border_mobile_dark" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="1dp" />
<solid android:color="@color/riotx_header_panel_border_mobile_light" />
</shape>

View File

@ -36,8 +36,6 @@
<!-- Drawables -->
<item name="riotx_highlighted_message_background">@drawable/highlighted_message_background_dark</item>
<item name="android:listDivider">@color/riotx_header_panel_border_mobile_dark</item>
<!-- Material color: Note: this block should be the same in all theme because it references only common colors and ?riotx attributes -->
<item name="colorPrimary">@color/riotx_accent</item>
<item name="colorPrimaryVariant">@color/primary_color_dark_light</item>

View File

@ -35,8 +35,6 @@
<!-- Drawables -->
<item name="riotx_highlighted_message_background">@drawable/highlighted_message_background_light</item>
<item name="android:listDivider">@color/riotx_header_panel_border_mobile_light</item>
<!-- Material color: Note: this block should be the same in all theme because it references only common colors and ?riotx attributes -->
<item name="colorPrimary">@color/riotx_accent</item>
<!--item name="colorPrimaryVariant">@color/primary_color_dark_light</item-->