mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Clean up
This commit is contained in:
parent
c0e1837ab4
commit
1c9b6caea1
@ -1,50 +0,0 @@
|
||||
package com.looker.droidify.ui.items
|
||||
|
||||
import android.content.res.ColorStateList
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import coil.load
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.database.entity.Repository
|
||||
import com.looker.droidify.databinding.ItemRepositoryXBinding
|
||||
import com.looker.droidify.utility.extension.resources.clear
|
||||
import com.looker.droidify.utility.extension.resources.getColorFromAttr
|
||||
import com.mikepenz.fastadapter.binding.AbstractBindingItem
|
||||
|
||||
class RepoItem(val item: Repository) :
|
||||
AbstractBindingItem<ItemRepositoryXBinding>() {
|
||||
override val type: Int
|
||||
get() = R.id.fastadapter_item
|
||||
|
||||
override fun createBinding(inflater: LayoutInflater, parent: ViewGroup?)
|
||||
: ItemRepositoryXBinding = ItemRepositoryXBinding.inflate(inflater, parent, false)
|
||||
|
||||
override fun bindView(binding: ItemRepositoryXBinding, payloads: List<Any>) {
|
||||
val isEnabled = item.enabled
|
||||
val context = binding.repoItem.context
|
||||
|
||||
val textColor: ColorStateList = if (isEnabled)
|
||||
context.getColorFromAttr(R.attr.colorOnPrimaryContainer)
|
||||
else
|
||||
context.getColorFromAttr(R.attr.colorOnBackground)
|
||||
|
||||
binding.repoName.text = item.name.ifEmpty { context.getString(R.string.new_repository) }
|
||||
binding.repoDescription.text = item.description.trim()
|
||||
|
||||
binding.repoItem.setCardBackgroundColor(
|
||||
if (item.enabled) context.getColorFromAttr(R.attr.colorPrimaryContainer)
|
||||
else context.getColorFromAttr(android.R.attr.colorBackground)
|
||||
)
|
||||
|
||||
binding.checkMark.apply {
|
||||
if (item.enabled) load(R.drawable.ic_check)
|
||||
else clear()
|
||||
}
|
||||
|
||||
textColor.let {
|
||||
binding.repoName.setTextColor(it)
|
||||
binding.repoDescription.setTextColor(it)
|
||||
binding.checkMark.imageTintList = it
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/repoItem"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/shape_margin_medium">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="48dp">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/repoName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?attr/textAppearanceTitleMedium" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/repoDescription"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/checkMark"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="24dp" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</layout>
|
@ -39,7 +39,8 @@
|
||||
android:layout_height="match_parent"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
tools:listitem="@layout/item_repository_x" />
|
||||
tools:itemCount="1"
|
||||
tools:listitem="@layout/item_app_info_x" />
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</com.google.android.material.circularreveal.CircularRevealFrameLayout>
|
||||
</layout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user