diff options
3 files changed, 21 insertions, 5 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ListItemDividerDecoration.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ListItemDividerDecoration.kt index 6f6e3f12d5..c34ec39877 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ListItemDividerDecoration.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ListItemDividerDecoration.kt @@ -6,12 +6,20 @@ import android.support.v7.widget.RecyclerView import android.support.v7.widget.RecyclerView.ItemDecoration import android.support.v7.widget.RecyclerView.State import android.view.View -import net.mullvad.mullvadvpn.R +import kotlin.properties.Delegates.observable class ListItemDividerDecoration(context: Context) : ItemDecoration() { - private val dividerHeight = context.resources.getDimensionPixelSize(R.dimen.list_item_divider) + private var bottomOffset = 0 + + var bottomOffsetId by observable<Int?>(null) { _, _, id -> + if (id != null) { + bottomOffset = context.resources.getDimensionPixelSize(id) + } else { + bottomOffset = 0 + } + } override fun getItemOffsets(offsets: Rect, view: View, parent: RecyclerView, state: State) { - offsets.bottom = dividerHeight + offsets.bottom = bottomOffset } } diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/SelectLocationFragment.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/SelectLocationFragment.kt index 5ea1c1bfc5..e35377c690 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/SelectLocationFragment.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/SelectLocationFragment.kt @@ -74,7 +74,11 @@ class SelectLocationFragment : ServiceDependentFragment(OnNoService.GoToLaunchSc } } - addItemDecoration(ListItemDividerDecoration(parentActivity)) + addItemDecoration( + ListItemDividerDecoration(parentActivity).apply { + bottomOffsetId = R.dimen.list_item_divider + } + ) } return view diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/SplitTunnelingFragment.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/SplitTunnelingFragment.kt index 3d915c9a6b..6294a2028a 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/SplitTunnelingFragment.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/SplitTunnelingFragment.kt @@ -75,7 +75,11 @@ class SplitTunnelingFragment : ServiceDependentFragment(OnNoService.GoToLaunchSc } } - addItemDecoration(ListItemDividerDecoration(parentActivity)) + addItemDecoration( + ListItemDividerDecoration(parentActivity).apply { + bottomOffsetId = R.dimen.list_item_divider + } + ) } return view |
