Added tiny font size and padding for messages widget

pull/201/head
M66B 3 years ago
parent 6a0803cdd1
commit 25326c35e3

@ -45,6 +45,7 @@ import com.flask.colorpicker.builder.ColorPickerClickListener;
import com.flask.colorpicker.builder.ColorPickerDialogBuilder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -147,6 +148,19 @@ public class ActivityWidgetUnified extends ActivityBase {
else
editor.remove("widget." + appWidgetId + ".name");
int font = spFontSize.getSelectedItemPosition();
int padding = spPadding.getSelectedItemPosition();
if (font == 1) // tiny
font = 4;
else if (font > 1)
font--;
if (padding == 1) // tiny
padding = 4;
else if (padding > 1)
padding--;
editor.putLong("widget." + appWidgetId + ".account", account == null ? -1L : account.id);
editor.putLong("widget." + appWidgetId + ".folder", folder == null ? -1L : folder.id);
editor.putString("widget." + appWidgetId + ".type", folder == null ? null : folder.type);
@ -154,8 +168,8 @@ public class ActivityWidgetUnified extends ActivityBase {
editor.putBoolean("widget." + appWidgetId + ".flagged", cbFlagged.isChecked());
editor.putBoolean("widget." + appWidgetId + ".semi", cbSemiTransparent.isChecked());
editor.putInt("widget." + appWidgetId + ".background", btnColor.getColor());
editor.putInt("widget." + appWidgetId + ".font", spFontSize.getSelectedItemPosition());
editor.putInt("widget." + appWidgetId + ".padding", spPadding.getSelectedItemPosition());
editor.putInt("widget." + appWidgetId + ".font", font);
editor.putInt("widget." + appWidgetId + ".padding", padding);
editor.putInt("widget." + appWidgetId + ".version", BuildConfig.VERSION_CODE);
editor.apply();
@ -247,7 +261,9 @@ public class ActivityWidgetUnified extends ActivityBase {
}
});
String[] sizes = getResources().getStringArray(R.array.fontSizeNames);
List<String> sizes = new ArrayList<>();
sizes.addAll(Arrays.asList(getResources().getStringArray(R.array.fontSizeNames)));
sizes.add(1, getString(R.string.title_size_tiny));
adapterFontSize = new ArrayAdapter<>(this, R.layout.spinner_item1, android.R.id.text1, sizes);
adapterFontSize.setDropDownViewResource(R.layout.spinner_item1_dropdown);

@ -137,6 +137,8 @@ public class WidgetUnified extends AppWidgetProvider {
return 14;
case 3: // large
return 22;
case 4: // tiny
return 10;
default: // medium
return 18;
}
@ -148,6 +150,8 @@ public class WidgetUnified extends AppWidgetProvider {
return Helper.dp2pixels(context, 3);
case 3: // large
return Helper.dp2pixels(context, 9);
case 4: // tiny
return Helper.dp2pixels(context, 1);
default: // medium
return Helper.dp2pixels(context, 6);
}

@ -1886,6 +1886,8 @@
<item>Large</item>
</string-array>
<string name="title_size_tiny">Tiny</string>
<string-array name="receiptNames">
<item>Read receipt only</item>
<item>Delivery receipt only</item>

Loading…
Cancel
Save