Skip to content

Commit 28b6bd6

Browse files
committed
widget layout
fixes cropped label in moon day widget (#845)
1 parent 2c02773 commit 28b6bd6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/src/main/java/com/forrestguice/suntimeswidget/widgets/layouts/MoonLayout_1x1_9.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
*/
4242
public class MoonLayout_1x1_9 extends MoonLayout
4343
{
44+
public static final int MAX_SP = 144;
45+
4446
public MoonLayout_1x1_9()
4547
{
4648
super();
@@ -89,7 +91,9 @@ public void updateViews(Context context, int appWidgetId, RemoteViews views, Sun
8991
{
9092
int showTitle = (WidgetSettings.loadShowTitlePref(context, appWidgetId) ? 1 : 0);
9193
int[] maxDp = new int[] {maxDimensionsDp[0] - (paddingDp[0] + paddingDp[2]), ((maxDimensionsDp[1] - (paddingDp[1] + paddingDp[3]) - ((int)titleSizeSp * showTitle)) / (showLabels ? 2 : 1))};
92-
float[] adjustedSizeSp = adjustTextSize(context, maxDp, paddingDp, "sans-serif", boldTime, "0:00", timeSizeSp, SuntimesLayout.MAX_SP, "", suffixSizeSp);
94+
String labelText = context.getString(R.string.widgetMode1x1_moonday);
95+
String scaleToText = (showLabels ? "_" + labelText + "_" : "_00_");
96+
float[] adjustedSizeSp = adjustTextSize(context, maxDp, paddingDp, "sans-serif", boldTime, scaleToText, timeSizeSp, MAX_SP, "", suffixSizeSp);
9397
if (adjustedSizeSp[0] > timeSizeSp)
9498
{
9599
float textScale = Math.max(adjustedSizeSp[0] / timeSizeSp, 1);

app/src/main/res/layout/layout_widget_moon_1x1_9_content.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<TextView style="@style/WidgetTimeTextView" android:visibility="visible"
1919
android:id="@+id/info_moon_day_label" android:layout_gravity="center"
20-
android:layout_marginRight="8dp" android:layout_marginEnd="8dp"
20+
android:layout_marginRight="0dp" android:layout_marginEnd="0dp"
2121
android:layout_marginTop="0dp" android:layout_marginBottom="0dp"
2222
android:maxLines="1" android:singleLine="true" android:ellipsize="end"
2323
android:text="@string/widgetMode1x1_moonday" android:labelFor="@+id/info_moon_day"

0 commit comments

Comments
 (0)