diff --git a/app/src/main/java/com/alexandr7035/gitstat/view/RepositoriesAdapter.kt b/app/src/main/java/com/alexandr7035/gitstat/view/RepositoriesAdapter.kt index a3cc98a8..aa52e855 100644 --- a/app/src/main/java/com/alexandr7035/gitstat/view/RepositoriesAdapter.kt +++ b/app/src/main/java/com/alexandr7035/gitstat/view/RepositoriesAdapter.kt @@ -5,7 +5,9 @@ import android.graphics.drawable.GradientDrawable import android.text.format.DateFormat import android.view.LayoutInflater import android.view.ViewGroup +import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView +import com.alexandr7035.gitstat.R import com.alexandr7035.gitstat.data.local.model.RepositoryEntity import com.alexandr7035.gitstat.databinding.ViewRepositoryBinding @@ -34,11 +36,31 @@ class RepositoriesAdapter(private val languagesColors: Map "Private" - else -> "Public" + when (items[position].isPrivate) { + true -> { + holder.binding.repoVisibility.text = "Private" + holder.binding.repoVisibility.setTextColor(ContextCompat.getColor( + holder.itemView.context, + R.color.white + )) + + holder.binding.repoVisibility.background = ContextCompat.getDrawable( + holder.itemView.context, + R.drawable.background_repo_visibilily_private) + } + else -> { + holder.binding.repoVisibility.text = "Public" + holder.binding.repoVisibility.setTextColor(ContextCompat.getColor( + holder.itemView.context, + R.color.black + )) + holder.binding.repoVisibility.background = ContextCompat.getDrawable( + holder.itemView.context, + R.drawable.background_repo_visibilily) + } } + val stringColor = when(languagesColors[holder.binding.language.text]) { null -> colorUnknownLanguage else -> languagesColors[holder.binding.language.text]!!["color"] diff --git a/app/src/main/res/drawable/background_repo_visibilily_private.xml b/app/src/main/res/drawable/background_repo_visibilily_private.xml new file mode 100644 index 00000000..cbc44c80 --- /dev/null +++ b/app/src/main/res/drawable/background_repo_visibilily_private.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ 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 f7b035c5..451291f7 100644 --- a/app/src/main/res/layout/view_repository.xml +++ b/app/src/main/res/layout/view_repository.xml @@ -17,8 +17,10 @@ android:textColor="@color/black" android:textSize="22sp" android:textStyle="bold" + android:layout_marginBottom="10dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toTopOf="@id/languageView" tools:text="GitStat" /> @@ -28,9 +30,12 @@ android:layout_height="wrap_content" android:layout_marginStart="10dp" android:background="@drawable/background_repo_visibilily" - android:paddingStart="5dp" - android:paddingEnd="5dp" + android:paddingStart="7dp" + android:paddingTop="3dp" + android:paddingEnd="7dp" + android:paddingBottom="3dp" android:textSize="14sp" + android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/languageView" tools:text="Private" /> @@ -41,9 +46,9 @@ android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" - android:layout_marginTop="10dp" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/repoName"> + app:layout_constraintTop_toTopOf="@id/repoVisibility" + app:layout_constraintBottom_toBottomOf="@id/repoVisibility"> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index b645ab98..1c55081e 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -15,5 +15,6 @@ #444444 #595959 #898989 + #B1B1B1 \ No newline at end of file