Skip to content

Commit e2e1d70

Browse files
committed
allow widget to be resized to a 3x1 grid
resolves #127
1 parent 6d2fdc6 commit e2e1d70

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

10-bitClockWidget/app/src/main/java/com/github/ashutoshgngwr/tenbitclockwidget/ClockWidgetRenderer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class ClockWidgetRenderer {
2222

2323
private final int width = getDimen(R.dimen.widget_width);
2424
private final int height = getDimen(R.dimen.widget_height);
25-
private final int padding = px(10);
2625
private final Paint mPaint;
2726
private final Bitmap clockBitmap;
2827
private final Canvas canvas;
@@ -79,10 +78,10 @@ private Bitmap render() {
7978
mPaint.setColor(ClockWidgetSettings.getClockBackgroundColor());
8079
canvas.drawRoundRect(new RectF(0, 0, width, height), px(5), px(5), mPaint);
8180

82-
RectF bounds = new RectF(padding, padding, sx - sp, height - padding);
81+
RectF bounds = new RectF(0, 0, sx - sp, height);
8382
renderBits(onBitColor, offBitColor, bounds, 2, is24Hour ? 3 : 2, nHourBits, hour);
8483

85-
bounds.set(sx + sp, padding, width - padding, height - padding);
84+
bounds.set(sx + sp, 0, width, height);
8685
renderBits(onBitColor, offBitColor, bounds, 2, 3, 6, minute);
8786

8887
if (ClockWidgetSettings.shouldDisplaySeparator()) {

10-bitClockWidget/app/src/main/res/values/dimen.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
-->
1717

1818
<resources>
19-
<dimen name="widget_height">105dp</dimen>
19+
<dimen name="widget_height">90dp</dimen>
2020
<dimen name="widget_width">315dp</dimen>
21+
<dimen name="widget_min_height">40dp</dimen>
22+
<dimen name="widget_min_width">180dp</dimen>
2123
</resources>

10-bitClockWidget/app/src/main/res/xml/widget_info.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
android:initialLayout="@layout/clock_widget_layout"
2020
android:minWidth="@dimen/widget_width"
2121
android:minHeight="@dimen/widget_height"
22-
android:minResizeWidth="@dimen/widget_width"
23-
android:minResizeHeight="@dimen/widget_height"
22+
android:minResizeWidth="@dimen/widget_min_width"
23+
android:minResizeHeight="@dimen/widget_min_height"
2424
android:previewImage="@drawable/preview"
2525
android:resizeMode="horizontal|vertical"
2626
android:updatePeriodMillis="1800000" />

0 commit comments

Comments
 (0)