fix(rings): make widget rings fill available space + higher render res
Build APK / build (pull_request) Successful in 1m42s
Build APK / build (pull_request) Successful in 1m42s
Rings were capped at a fixed 86dp; now each gauge fills its half of the widget (weighted ImageView) so they grow with the placed widget size. Bumped RingRenderer default bitmap to 360px/36 stroke to stay crisp at the larger display size.
This commit is contained in:
@@ -40,8 +40,8 @@ object RingRenderer {
|
|||||||
markerColor: Int?,
|
markerColor: Int?,
|
||||||
centerText: String,
|
centerText: String,
|
||||||
labelText: String? = null,
|
labelText: String? = null,
|
||||||
sizePx: Int = 240,
|
sizePx: Int = 360,
|
||||||
strokePx: Float = 24f
|
strokePx: Float = 36f
|
||||||
): Bitmap {
|
): Bitmap {
|
||||||
val bmp = Bitmap.createBitmap(sizePx, sizePx, Bitmap.Config.ARGB_8888)
|
val bmp = Bitmap.createBitmap(sizePx, sizePx, Bitmap.Config.ARGB_8888)
|
||||||
val canvas = Canvas(bmp)
|
val canvas = Canvas(bmp)
|
||||||
|
|||||||
@@ -65,7 +65,8 @@
|
|||||||
android:layout_marginBottom="6dp"
|
android:layout_marginBottom="6dp"
|
||||||
android:background="#2A2A2A" />
|
android:background="#2A2A2A" />
|
||||||
|
|
||||||
<!-- Two ring gauges side by side -->
|
<!-- Two ring gauges side by side — each fills its half so the ring grows as large as the
|
||||||
|
placed widget allows (limited by the available height), instead of a fixed 86dp. -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
@@ -76,24 +77,25 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center_horizontal">
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/ring_session"
|
android:id="@+id/ring_session"
|
||||||
android:layout_width="86dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="86dp"
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:adjustViewBounds="false"
|
android:adjustViewBounds="false"
|
||||||
android:contentDescription="Session usage ring" />
|
android:contentDescription="Session usage ring" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_session_label"
|
android:id="@+id/tv_session_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="2dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textColor="#999999"
|
android:textColor="#999999"
|
||||||
@@ -104,24 +106,25 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center_horizontal">
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/ring_weekly"
|
android:id="@+id/ring_weekly"
|
||||||
android:layout_width="86dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="86dp"
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:adjustViewBounds="false"
|
android:adjustViewBounds="false"
|
||||||
android:contentDescription="Weekly usage ring" />
|
android:contentDescription="Weekly usage ring" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_weekly_label"
|
android:id="@+id/tv_weekly_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="2dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textColor="#999999"
|
android:textColor="#999999"
|
||||||
|
|||||||
Reference in New Issue
Block a user