mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-24 03:42:15 +00:00
Update: Refine app sheet
This commit is contained in:
parent
ad349831e5
commit
96686738fa
@ -337,7 +337,6 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
|
||||
val status = itemView.findViewById<MaterialTextView>(R.id.status)!!
|
||||
val progress = itemView.findViewById<LinearProgressIndicator>(R.id.progress)!!
|
||||
|
||||
val progressIcon: Drawable
|
||||
val defaultIcon: Drawable
|
||||
|
||||
val actionTintNormal = action.context.getColorFromAttr(R.attr.colorPrimary)
|
||||
@ -347,9 +346,7 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
|
||||
|
||||
init {
|
||||
action.height = itemView.resources.sizeScaled(48)
|
||||
val (progressIcon, defaultIcon) = Utils.getDefaultApplicationIcons(icon.context)
|
||||
this.progressIcon = progressIcon
|
||||
this.defaultIcon = defaultIcon
|
||||
this.defaultIcon = Utils.getDefaultApplicationIcon(icon.context)
|
||||
}
|
||||
|
||||
val targetBlock = itemView.findViewById<LinearLayoutCompat>(R.id.sdk_block)!!
|
||||
@ -1078,7 +1075,7 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
|
||||
item.product.icon, item.product.metadataIcon, item.repository
|
||||
)
|
||||
) {
|
||||
placeholder(holder.progressIcon)
|
||||
placeholder(holder.defaultIcon)
|
||||
error(holder.defaultIcon)
|
||||
}
|
||||
holder.name.text = item.product.name
|
||||
|
@ -25,7 +25,6 @@ import com.looker.droidify.utility.extension.android.versionCodeCompat
|
||||
import com.looker.droidify.utility.extension.json.Json
|
||||
import com.looker.droidify.utility.extension.json.parseDictionary
|
||||
import com.looker.droidify.utility.extension.json.writeDictionary
|
||||
import com.looker.droidify.utility.extension.resources.getColorFromAttr
|
||||
import com.looker.droidify.utility.extension.resources.getDrawableCompat
|
||||
import com.looker.droidify.utility.extension.text.hex
|
||||
import com.topjohnwu.superuser.Shell
|
||||
@ -37,23 +36,13 @@ import java.security.cert.CertificateEncodingException
|
||||
import java.util.*
|
||||
|
||||
object Utils {
|
||||
private fun createDefaultApplicationIcon(context: Context, tintAttrResId: Int): Drawable {
|
||||
return context.getDrawableCompat(R.drawable.ic_application_default).mutate()
|
||||
.apply { setTintList(context.getColorFromAttr(tintAttrResId)) }
|
||||
}
|
||||
|
||||
fun PackageInfo.toInstalledItem(): Installed {
|
||||
val signatureString = singleSignature?.let(Utils::calculateHash).orEmpty()
|
||||
return Installed(packageName, versionName.orEmpty(), versionCodeCompat, signatureString)
|
||||
}
|
||||
|
||||
fun getDefaultApplicationIcons(context: Context): Pair<Drawable, Drawable> {
|
||||
val progressIcon: Drawable =
|
||||
createDefaultApplicationIcon(context, android.R.attr.textColorSecondary)
|
||||
val defaultIcon: Drawable =
|
||||
createDefaultApplicationIcon(context, R.attr.colorAccent)
|
||||
return Pair(progressIcon, defaultIcon)
|
||||
}
|
||||
fun getDefaultApplicationIcon(context: Context): Drawable =
|
||||
context.getDrawableCompat(R.drawable.ic_placeholder)
|
||||
|
||||
fun getToolbarIcon(context: Context, resId: Int): Drawable {
|
||||
return context.getDrawableCompat(resId).mutate()
|
||||
|
@ -18,7 +18,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="12dp"
|
||||
android:layout_marginVertical="4dp"
|
||||
android:background="@drawable/background_border"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@id/status_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@ -28,14 +27,14 @@
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
app:shapeAppearanceOverlay="@style/Shape.Medium"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
@ -68,6 +67,7 @@
|
||||
android:id="@+id/release_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/background_border"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
Loading…
x
Reference in New Issue
Block a user