diff --git a/src/main/kotlin/com/looker/droidify/screen/ProductAdapter.kt b/src/main/kotlin/com/looker/droidify/screen/ProductAdapter.kt index ba5f09bf..481ba5fc 100644 --- a/src/main/kotlin/com/looker/droidify/screen/ProductAdapter.kt +++ b/src/main/kotlin/com/looker/droidify/screen/ProductAdapter.kt @@ -22,13 +22,10 @@ import android.view.MotionEvent import android.view.View import android.view.ViewGroup import android.widget.* -import androidx.appcompat.widget.AppCompatImageView import androidx.core.content.res.ResourcesCompat -import androidx.core.graphics.ColorUtils import androidx.core.text.HtmlCompat import androidx.core.text.util.LinkifyCompat import androidx.recyclerview.widget.RecyclerView -import coil.transform.RoundedCornersTransformation import com.google.android.material.imageview.ShapeableImageView import com.google.android.material.switchmaterial.SwitchMaterial import com.looker.droidify.R @@ -455,7 +452,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) private class ScreenshotViewHolder(context: Context) : RecyclerView.ViewHolder(FrameLayout(context)) { - val image: AppCompatImageView + val image: ShapeableImageView val placeholder: Drawable @@ -466,20 +463,25 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) itemView as FrameLayout itemView.foreground = itemView.context.getDrawableFromAttr(android.R.attr.selectableItemBackground) - val backgroundColor = - itemView.context.getColorFromAttr(android.R.attr.colorBackground).defaultColor - val accentColor = - itemView.context.getColorFromAttr(android.R.attr.colorAccent).defaultColor - val primaryColor = - itemView.context.getColorFromAttr(android.R.attr.textColor).defaultColor + val surfaceColor = + itemView.context.getColorFromAttr(R.attr.colorSurface).defaultColor - image = object : AppCompatImageView(context) { + + + image = object : ShapeableImageView(context) { override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { super.onMeasure(widthMeasureSpec, heightMeasureSpec) setMeasuredDimension(measuredWidth, measuredWidth) } } - image.setBackgroundColor(ColorUtils.blendARGB(backgroundColor, accentColor, 0.1f)) + + val radius = image.context.resources.getDimension(R.dimen.shape_medium_corner) + + val shapeAppearanceModel = image.shapeAppearanceModel.toBuilder() + .setAllCornerSizes(radius) + .build() + image.shapeAppearanceModel = shapeAppearanceModel + image.setBackgroundColor(surfaceColor) itemView.addView( image, FrameLayout.LayoutParams.MATCH_PARENT, @@ -491,8 +493,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) ) val placeholder = image.context.getDrawableCompat(R.drawable.ic_photo_camera).mutate() - placeholder.setTint(ColorUtils.blendARGB(primaryColor, accentColor, 0.5f) - .let { ColorUtils.blendARGB(0x00ffffff and it, it, 0.2f) }) + placeholder.setTint(surfaceColor) this.placeholder = PaddingDrawable(placeholder, 2f) } } @@ -529,6 +530,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) itemView.context.theme ) backgroundTintList = itemView.context.getColorFromAttr(R.attr.colorSurface) + typeface = TypefaceExtra.bold setPadding(15, 5, 15, 5) setTextColor(itemView.context.getColorFromAttr(R.attr.colorPrimary)) } @@ -1166,7 +1168,8 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) } if (updateAll || updateStatus) { val status = status - holder.statusLayout.visibility = if (status != null) View.VISIBLE else View.GONE + holder.statusLayout.visibility = + if (status != null) View.VISIBLE else View.INVISIBLE if (status != null) { when (status) { is Status.Pending -> { @@ -1341,7 +1344,6 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) item.screenshot ) ) { - transformations(RoundedCornersTransformation(4.toPx)) placeholder(holder.placeholder) error(holder.placeholder) size(cellSize) diff --git a/src/main/kotlin/com/looker/droidify/screen/ScreenshotsFragment.kt b/src/main/kotlin/com/looker/droidify/screen/ScreenshotsFragment.kt index 464027b6..9447e62d 100644 --- a/src/main/kotlin/com/looker/droidify/screen/ScreenshotsFragment.kt +++ b/src/main/kotlin/com/looker/droidify/screen/ScreenshotsFragment.kt @@ -8,7 +8,6 @@ import android.os.Bundle import android.view.ViewGroup import android.view.WindowManager import android.widget.ImageView -import androidx.core.graphics.ColorUtils import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsControllerCompat @@ -69,15 +68,8 @@ class ScreenshotsFragment() : DialogFragment() { WindowCompat.setDecorFitsSystemWindows(window, false) } - val background = - dialog.context.getColorFromAttr(R.attr.colorSurface).defaultColor - decorView?.setBackgroundColor(background.let { - ColorUtils.blendARGB( - 0x00ffffff and it, - it, - 1f - ) - }) + val background = dialog.context.getColorFromAttr(R.attr.colorSurface).defaultColor + decorView?.setBackgroundColor(background) decorView?.setPadding(0, 0, 0, 0) if (window != null) { window.attributes = window.attributes.apply { @@ -85,10 +77,8 @@ class ScreenshotsFragment() : DialogFragment() { format = PixelFormat.TRANSLUCENT windowAnimations = run { val typedArray = dialog.context.obtainStyledAttributes( - null, - intArrayOf(android.R.attr.windowAnimationStyle), - android.R.attr.dialogTheme, - 0 + null, intArrayOf(android.R.attr.windowAnimationStyle), + android.R.attr.dialogTheme, 0 ) try { typedArray.getResourceId(0, 0) @@ -198,8 +188,7 @@ class ScreenshotsFragment() : DialogFragment() { val placeholder = itemView.context.getDrawableCompat(R.drawable.ic_photo_camera).mutate() - placeholder.setTint(itemView.context.getColorFromAttr(R.attr.colorSurface).defaultColor - .let { ColorUtils.blendARGB(0x00ffffff and it, it, 0.25f) }) + placeholder.setTint(itemView.context.getColorFromAttr(R.attr.colorSurface).defaultColor) this.placeholder = PaddingDrawable(placeholder, 4f) } } diff --git a/src/main/kotlin/com/looker/droidify/utility/extension/Resources.kt b/src/main/kotlin/com/looker/droidify/utility/extension/Resources.kt index b39e4615..e6c057f7 100644 --- a/src/main/kotlin/com/looker/droidify/utility/extension/Resources.kt +++ b/src/main/kotlin/com/looker/droidify/utility/extension/Resources.kt @@ -25,6 +25,7 @@ import org.xmlpull.v1.XmlPullParser import kotlin.math.roundToInt object TypefaceExtra { + val bold = Typeface.create("sans-serif-medium", Typeface.BOLD)!! val medium = Typeface.create("sans-serif-medium", Typeface.NORMAL)!! val light = Typeface.create("sans-serif-light", Typeface.NORMAL)!! } diff --git a/src/main/res/anim/slide_down.xml b/src/main/res/anim/slide_down.xml index 8e7e395f..93f9dff1 100644 --- a/src/main/res/anim/slide_down.xml +++ b/src/main/res/anim/slide_down.xml @@ -4,7 +4,7 @@ \ No newline at end of file diff --git a/src/main/res/anim/slide_up.xml b/src/main/res/anim/slide_up.xml index e91ebf22..eceb1f6a 100644 --- a/src/main/res/anim/slide_up.xml +++ b/src/main/res/anim/slide_up.xml @@ -4,7 +4,7 @@ \ No newline at end of file diff --git a/src/main/res/drawable/background_border.xml b/src/main/res/drawable/background_border.xml index 0900e48a..9baf328e 100644 --- a/src/main/res/drawable/background_border.xml +++ b/src/main/res/drawable/background_border.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/src/main/res/layout/product_header_item.xml b/src/main/res/layout/product_header_item.xml index edd3ea42..eea469c3 100644 --- a/src/main/res/layout/product_header_item.xml +++ b/src/main/res/layout/product_header_item.xml @@ -21,14 +21,13 @@ android:id="@+id/icon" android:layout_width="64dp" android:layout_height="64dp" - android:layout_marginStart="1.667dp" - android:layout_marginEnd="1.667dp" + app:shapeAppearanceOverlay="@style/Shape.Medium" tools:ignore="ContentDescription" /> @@ -82,19 +81,17 @@ + android:layout_gravity="center_vertical" /> + android:layout_height="56dp" + app:shapeAppearanceOverlay="@style/Shape.Medium" /> diff --git a/src/main/res/layout/product_item.xml b/src/main/res/layout/product_item.xml index 6b75f3f6..c79bdfce 100644 --- a/src/main/res/layout/product_item.xml +++ b/src/main/res/layout/product_item.xml @@ -5,10 +5,11 @@ android:layout_width="match_parent" android:layout_height="72dp" android:layout_marginHorizontal="10dp" - app:cardBackgroundColor="@null" - app:cardCornerRadius="12dp" + android:orientation="horizontal" + app:cardBackgroundColor="?android:attr/colorBackground" app:cardElevation="0dp" app:strokeColor="@null" + app:cardCornerRadius="@dimen/shape_medium_corner" app:strokeWidth="0dp"> #E8F5E9 #A3EBB7 #6EC898 - #58C189 - #3EDA86 + #51DF93 #EF9A9A - #E57373 + #EF8A8A #000000 #1E1E1E diff --git a/src/main/res/values/dimen.xml b/src/main/res/values/dimen.xml new file mode 100644 index 00000000..8f1139d4 --- /dev/null +++ b/src/main/res/values/dimen.xml @@ -0,0 +1,8 @@ + + + 16dp + 8dp + 4dp + 12dp + 16dp + \ No newline at end of file diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml index 983cdee6..786e117f 100644 --- a/src/main/res/values/styles.xml +++ b/src/main/res/values/styles.xml @@ -6,7 +6,7 @@ + + + + + + + +