Update: Theme Touch Up

Update: Increased Text Size in App Page
This commit is contained in:
LooKeR 2021-10-17 11:40:13 +05:30
parent 0fafcfe3cd
commit a35646c2e5
8 changed files with 44 additions and 40 deletions

View File

@ -11,7 +11,6 @@ import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Rect
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.net.Uri
import android.os.Parcel
import android.text.SpannableStringBuilder
@ -54,7 +53,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
StableRecyclerAdapter<ProductAdapter.ViewType, RecyclerView.ViewHolder>() {
companion object {
private const val GRID_SPACING_OUTER_DP = 16
private const val GRID_SPACING_INNER_DP = 4
private const val GRID_SPACING_INNER_DP = 8
}
interface Callbacks {
@ -326,8 +325,10 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
val actionTintCancel = action.context.getColorFromAttr(R.attr.colorError)
init {
if (Android.sdk(22)) {
action.setTextColor(action.context.getColorFromAttr(android.R.attr.textColor))
action.apply {
setTextSizeScaled(15)
setTextColor(action.context.getColorFromAttr(R.attr.colorOnPrimary))
height = itemView.resources.sizeScaled(48)
}
val (progressIcon, defaultIcon) = Utils.getDefaultApplicationIcons(icon.context)
this.progressIcon = progressIcon
@ -355,7 +356,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
init {
itemView as TextView
itemView.typeface = TypefaceExtra.medium
itemView.setTextSizeScaled(14)
itemView.setTextSizeScaled(15)
itemView.setTextColor(itemView.context.getColorFromAttr(android.R.attr.textColor))
itemView.background =
ResourcesCompat.getDrawable(
@ -363,6 +364,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
R.drawable.background_border,
context.theme
)
itemView.backgroundTintList = itemView.context.getColorFromAttr(R.attr.colorSurface)
itemView.gravity = Gravity.CENTER
itemView.isAllCaps = true
itemView.layoutParams = RecyclerView.LayoutParams(
@ -382,7 +384,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
init {
itemView as TextView
itemView.setTextSizeScaled(14)
itemView.setTextSizeScaled(15)
itemView.setTextColor(itemView.context.getColorFromAttr(android.R.attr.textColor))
itemView.resources.sizeScaled(16).let { itemView.setPadding(it, it, it, it) }
itemView.movementMethod = ClickableMovementMethod
@ -518,18 +520,17 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
compatibility
)
val setStatusActive: (Boolean) -> Unit
init {
status.background =
GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, null).apply {
setStatusActive = { active ->
color = itemView.context.getColorFromAttr(
if (active)
android.R.attr.colorAccent else android.R.attr.textColorSecondary
status.apply {
background =
ResourcesCompat.getDrawable(
itemView.resources,
R.drawable.background_border,
itemView.context.theme
)
}
cornerRadius = itemView.resources.sizeScaled(2).toFloat()
backgroundTintList = itemView.context.getColorFromAttr(R.attr.colorSurface)
setPadding(15, 5, 15, 5)
setTextColor(itemView.context.getColorFromAttr(R.attr.colorPrimary))
}
}
}
@ -546,8 +547,8 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
val title = TextView(itemView.context)
title.gravity = Gravity.CENTER
title.typeface = TypefaceExtra.light
title.setTextColor(context.getColorFromAttr(android.R.attr.textColorPrimary))
title.setTextSizeScaled(20)
title.setTextColor(context.getColorFromAttr(R.attr.colorPrimary))
title.setTextSizeScaled(24)
title.setText(R.string.application_not_found)
itemView.addView(
title,
@ -556,8 +557,8 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
)
val packageName = TextView(itemView.context)
packageName.gravity = Gravity.CENTER
packageName.setTextColor(context.getColorFromAttr(android.R.attr.textColorPrimary))
packageName.setTextSizeScaled(16)
packageName.setTextColor(context.getColorFromAttr(R.attr.colorPrimary))
packageName.setTextSizeScaled(18)
itemView.addView(
packageName,
LinearLayout.LayoutParams.MATCH_PARENT,
@ -1133,7 +1134,6 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
item.product.icon, item.product.metadataIcon, item.repository
)
) {
transformations(RoundedCornersTransformation(4.toPx))
placeholder(holder.progressIcon)
error(holder.defaultIcon)
}
@ -1150,7 +1150,10 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
holder.version.text =
version?.let { context.getString(R.string.version_FORMAT, it) }
?: context.getString(R.string.unknown)
holder.packageName.text = item.product.packageName
holder.packageName.apply {
text = item.product.packageName
setTextSizeScaled(15)
}
val action = action
holder.action.visibility = if (action == null) View.GONE else View.VISIBLE
if (action != null) {
@ -1366,7 +1369,6 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
holder.version.text =
context.getString(R.string.version_FORMAT, item.release.version)
holder.version.setTextColor(primarySecondaryColor)
holder.setStatusActive(!grayOut)
holder.status.visibility = if (installed || suggested) View.VISIBLE else View.GONE
holder.status.setText(
when {

View File

@ -70,7 +70,7 @@ class ProductsAdapter(private val onClick: (ProductItem) -> Unit) :
itemView.gravity = Gravity.CENTER
itemView.resources.sizeScaled(20).let { itemView.setPadding(it, it, it, it) }
itemView.typeface = TypefaceExtra.light
itemView.setTextColor(context.getColorFromAttr(android.R.attr.textColorPrimary))
itemView.setTextColor(context.getColorFromAttr(android.R.attr.colorPrimary))
itemView.setTextSizeScaled(20)
itemView.layoutParams = RecyclerView.LayoutParams(
RecyclerView.LayoutParams.MATCH_PARENT,
@ -179,7 +179,7 @@ class ProductsAdapter(private val onClick: (ProductItem) -> Unit) :
text = productItem.installedVersion.nullIfEmpty() ?: productItem.version
if (background != null) {
setPadding(0, 0, 0, 0)
setTextColor(holder.status.context.getColorFromAttr(android.R.attr.textColorPrimary))
setTextColor(holder.status.context.getColorFromAttr(android.R.attr.colorPrimary))
background = null
}
}

View File

@ -202,7 +202,7 @@ class ScreenshotsFragment() : DialogFragment() {
val placeholder =
itemView.context.getDrawableCompat(R.drawable.ic_photo_camera).mutate()
placeholder.setTint(itemView.context.getColorFromAttr(android.R.attr.textColorPrimary).defaultColor
placeholder.setTint(itemView.context.getColorFromAttr(R.attr.colorSurface).defaultColor
.let { ColorUtils.blendARGB(0x00ffffff and it, it, 0.25f) })
this.placeholder = PaddingDrawable(placeholder, 4f)
}

View File

@ -300,11 +300,11 @@ class TabsFragment : ScreenFragment() {
this.adapter = adapter
addItemDecoration(DividerItemDecoration(context, adapter::configureDivider))
setBackgroundResource(R.drawable.background_border)
setBackgroundColor(context.getColorFromAttr(R.attr.colorSurface).defaultColor)
elevation = resources.sizeScaled(4).toFloat()
content.addView(this, FrameLayout.LayoutParams.MATCH_PARENT, 0)
visibility = View.GONE
}
sectionsList.backgroundTintList = context?.getColorFromAttr(R.attr.colorSurface)
this.sectionsList = sectionsList
var lastContentHeight = -1

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.3" android:color="@color/green200" android:state_enabled="false" />
<item android:alpha="0.3" android:color="@color/green100" android:state_enabled="false" />
<item android:color="@color/green200" />
<item android:color="@color/green100" />
</selector>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -79,22 +80,21 @@
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp" />
<ProgressBar
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress"
style="@android:style/Widget.Material.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp"
android:indeterminateTint="?attr/colorPrimary" />
app:trackCornerRadius="2dp" />
</LinearLayout>
<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/action"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/background_border" />
app:cornerRadius="8dp" />
</LinearLayout>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="green50">#E8F5E9</color>
<color name="green100">#A3EBB7</color>
<color name="green200">#6EC898</color>
<color name="green300">#58C189</color>
<color name="green400">#3EDA86</color>
@ -13,5 +14,5 @@
<color name="white">#FFFFFF</color>
<color name="grey_light">#333333</color>
<color name="grey_dark">#595959</color>
<color name="grey_dark">#2C2C2C</color>
</resources>

View File

@ -34,7 +34,7 @@
<item name="colorOnBackground">@color/green200</item>
<item name="android:colorAccent">@color/accent_dark</item>
<item name="colorError">@color/error_dark</item>
<item name="android:textColorPrimary">@color/green400</item>
<item name="android:textColorPrimary">@color/green200</item>
<item name="android:textColor">@color/white</item>
<item name="android:fastScrollThumbDrawable">@drawable/scrollbar_thumb</item>
<item name="android:fastScrollTrackDrawable">@drawable/scrollbar_track</item>
@ -45,7 +45,7 @@
</style>
<style name="Theme.Main.Amoled" parent="Theme.Material3.Dark.NoActionBar">
<item name="colorPrimary">@color/green200</item>
<item name="colorPrimary">@color/green100</item>
<item name="colorOnPrimary">@color/black</item>
<item name="colorSurface">@color/black</item>
<item name="colorOnSurface">@color/green50</item>
@ -54,7 +54,7 @@
<item name="colorOnBackground">@color/green50</item>
<item name="android:colorAccent">@color/accent_dark</item>
<item name="colorError">@color/error_dark</item>
<item name="android:textColorPrimary">@color/green400</item>
<item name="android:textColorPrimary">@color/green100</item>
<item name="android:textColor">@color/white</item>
<item name="android:fastScrollThumbDrawable">@drawable/scrollbar_thumb</item>
<item name="android:fastScrollTrackDrawable">@drawable/scrollbar_track</item>
@ -76,6 +76,7 @@
<style name="Theme.Alert" parent="ThemeOverlay.Material3.MaterialAlertDialog.Centered">
<item name="colorPrimary">?attr/colorOnSurface</item>
<item name="android:backgroundTint">?attr/colorSurface</item>
<item name="colorOnSurfaceVariant">?attr/colorOnSurface</item>
</style>
<style name="Theme.Switch" parent="Widget.Material3.CompoundButton.Switch">