mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Widgets: Increase corner radius to match Android 12
This commit is contained in:
@@ -66,23 +66,21 @@ class CheckmarkWidgetView : HabitWidgetView {
|
|||||||
val res = StyledResources(context)
|
val res = StyledResources(context)
|
||||||
val bgColor: Int
|
val bgColor: Int
|
||||||
val fgColor: Int
|
val fgColor: Int
|
||||||
|
setShadowAlpha(0x4f)
|
||||||
when (entryState) {
|
when (entryState) {
|
||||||
YES_MANUAL, SKIP -> {
|
YES_MANUAL, SKIP -> {
|
||||||
bgColor = activeColor
|
bgColor = activeColor
|
||||||
fgColor = res.getColor(R.attr.contrast0)
|
fgColor = res.getColor(R.attr.contrast0)
|
||||||
setShadowAlpha(0x4f)
|
|
||||||
backgroundPaint!!.color = bgColor
|
backgroundPaint!!.color = bgColor
|
||||||
frame!!.setBackgroundDrawable(background)
|
frame!!.setBackgroundDrawable(background)
|
||||||
}
|
}
|
||||||
YES_AUTO, NO, UNKNOWN -> {
|
YES_AUTO, NO, UNKNOWN -> {
|
||||||
bgColor = res.getColor(R.attr.cardBgColor)
|
bgColor = res.getColor(R.attr.cardBgColor)
|
||||||
fgColor = res.getColor(R.attr.contrast60)
|
fgColor = res.getColor(R.attr.contrast60)
|
||||||
setShadowAlpha(0x00)
|
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
bgColor = res.getColor(R.attr.cardBgColor)
|
bgColor = res.getColor(R.attr.cardBgColor)
|
||||||
fgColor = res.getColor(R.attr.contrast60)
|
fgColor = res.getColor(R.attr.contrast60)
|
||||||
setShadowAlpha(0x00)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ring.setPercentage(percentage)
|
ring.setPercentage(percentage)
|
||||||
@@ -126,7 +124,7 @@ class CheckmarkWidgetView : HabitWidgetView {
|
|||||||
} else {
|
} else {
|
||||||
width = min(width, height)
|
width = min(width, height)
|
||||||
}
|
}
|
||||||
val textSize = min(0.2f * width, getDimension(context, R.dimen.smallerTextSize))
|
val textSize = min(0.175f * width, getDimension(context, R.dimen.smallTextSize))
|
||||||
label.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
label.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
||||||
if (isNumerical) {
|
if (isNumerical) {
|
||||||
ring.setTextSize(textSize * 0.9f)
|
ring.setTextSize(textSize * 0.9f)
|
||||||
@@ -141,7 +139,8 @@ class CheckmarkWidgetView : HabitWidgetView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun init() {
|
private fun init() {
|
||||||
val appComponent: HabitsApplicationComponent = (context.applicationContext as HabitsApplication).component
|
val appComponent: HabitsApplicationComponent =
|
||||||
|
(context.applicationContext as HabitsApplication).component
|
||||||
preferences = appComponent.preferences
|
preferences = appComponent.preferences
|
||||||
ring = findViewById<View>(R.id.scoreRing) as RingView
|
ring = findViewById<View>(R.id.scoreRing) as RingView
|
||||||
label = findViewById<View>(R.id.label) as TextView
|
label = findViewById<View>(R.id.label) as TextView
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ abstract class HabitWidgetView : FrameLayout {
|
|||||||
val shadowRadius = dpToPixels(context, 2f).toInt()
|
val shadowRadius = dpToPixels(context, 2f).toInt()
|
||||||
val shadowOffset = dpToPixels(context, 1f).toInt()
|
val shadowOffset = dpToPixels(context, 1f).toInt()
|
||||||
val shadowColor = Color.argb(shadowAlpha, 0, 0, 0)
|
val shadowColor = Color.argb(shadowAlpha, 0, 0, 0)
|
||||||
val cornerRadius = dpToPixels(context, 5f)
|
val cornerRadius = dpToPixels(context, 12f)
|
||||||
val radii = FloatArray(8)
|
val radii = FloatArray(8)
|
||||||
Arrays.fill(radii, cornerRadius)
|
Arrays.fill(radii, cornerRadius)
|
||||||
val shape = RoundRectShape(radii, null, null)
|
val shape = RoundRectShape(radii, null, null)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<item android:id="@android:id/mask">
|
<item android:id="@android:id/mask">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<corners android:radius="5dp"/>
|
<corners android:radius="12dp"/>
|
||||||
<solid android:color="?android:colorPrimary"/>
|
<solid android:color="?android:colorPrimary"/>
|
||||||
</shape>
|
</shape>
|
||||||
<color android:color="@color/white"/>
|
<color android:color="@color/white"/>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:paddingRight="8dp"
|
android:paddingRight="8dp"
|
||||||
android:paddingBottom="4dp"
|
android:paddingBottom="8dp"
|
||||||
tools:ignore="UselessParent">
|
tools:ignore="UselessParent">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
Reference in New Issue
Block a user