diff --git a/app/src/main/java/by/alexandr7035/gitstat/view/repositories/ActiveRepositoriesFragment.kt b/app/src/main/java/by/alexandr7035/gitstat/view/repositories/ActiveRepositoriesFragment.kt
index e2722100..f8815b68 100644
--- a/app/src/main/java/by/alexandr7035/gitstat/view/repositories/ActiveRepositoriesFragment.kt
+++ b/app/src/main/java/by/alexandr7035/gitstat/view/repositories/ActiveRepositoriesFragment.kt
@@ -4,9 +4,11 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import androidx.navigation.navGraphViewModels
+import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import by.alexandr7035.gitstat.R
import by.alexandr7035.gitstat.RepositoriesListGraphDirections
@@ -34,15 +36,28 @@ class ActiveRepositoriesFragment : Fragment(), RepoClickListener {
// Setup adapter
adapter = RepositoriesAdapter(this)
- binding!!.recycler.adapter = adapter
- binding!!.recycler.layoutManager = LinearLayoutManager(context)
+ binding?.recycler?.adapter = adapter
+ val layoutManager = LinearLayoutManager(context)
+
+ val decoration = DividerItemDecoration(
+ binding?.recycler?.context,
+ layoutManager.orientation
+ )
+
+ ContextCompat.getDrawable(requireContext(), R.drawable.decoration_repository_item)?.let {
+ decoration.setDrawable(it)
+ }
+
+ binding?.recycler?.addItemDecoration(decoration)
+ binding?.recycler?.layoutManager = layoutManager
+
viewModel.getTabRefreshedLiveData().observeNullSafe(viewLifecycleOwner, {
// If current fragment
// FIXME find better solution
if (it == 0) {
//binding!!.root.smoothScrollToPosition(0)
- binding!!.recycler.layoutManager!!.scrollToPosition(0)
+ binding?.recycler?.layoutManager?.scrollToPosition(0)
}
})
}
diff --git a/app/src/main/java/by/alexandr7035/gitstat/view/repositories/ArchivedRepositoriesFragment.kt b/app/src/main/java/by/alexandr7035/gitstat/view/repositories/ArchivedRepositoriesFragment.kt
index 762b614f..4bcff58d 100644
--- a/app/src/main/java/by/alexandr7035/gitstat/view/repositories/ArchivedRepositoriesFragment.kt
+++ b/app/src/main/java/by/alexandr7035/gitstat/view/repositories/ArchivedRepositoriesFragment.kt
@@ -4,9 +4,11 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import androidx.navigation.navGraphViewModels
+import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import by.alexandr7035.gitstat.R
import by.alexandr7035.gitstat.RepositoriesListGraphDirections
@@ -35,8 +37,21 @@ class ArchivedRepositoriesFragment : Fragment(), RepoClickListener {
// Setup adapter
adapter = RepositoriesAdapter(this)
- binding!!.recycler.adapter = adapter
- binding!!.recycler.layoutManager = LinearLayoutManager(context)
+ binding?.recycler?.adapter = adapter
+ val layoutManager = LinearLayoutManager(context)
+
+ val decoration = DividerItemDecoration(
+ binding?.recycler?.context,
+ layoutManager.orientation
+ )
+
+ ContextCompat.getDrawable(requireContext(), R.drawable.decoration_repository_item)?.let {
+ decoration.setDrawable(it)
+ }
+
+ binding?.recycler?.addItemDecoration(decoration)
+ binding?.recycler?.layoutManager = layoutManager
+
viewModel.getTabRefreshedLiveData().observeNullSafe(viewLifecycleOwner, {
// If current fragment
diff --git a/app/src/main/res/drawable/decoration_repository_item.xml b/app/src/main/res/drawable/decoration_repository_item.xml
new file mode 100644
index 00000000..595818d3
--- /dev/null
+++ b/app/src/main/res/drawable/decoration_repository_item.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/view_repository.xml b/app/src/main/res/layout/view_repository.xml
index 287d3506..707e7428 100644
--- a/app/src/main/res/layout/view_repository.xml
+++ b/app/src/main/res/layout/view_repository.xml
@@ -7,7 +7,6 @@
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:elevation="5dp"
- android:layout_marginBottom="16dp"
android:background="@drawable/background_repository_item"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 541d1a3f..04712e67 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -4,4 +4,5 @@
16dp
8dp
4dp
+ 16dp
\ No newline at end of file