Add option to disable widget row dividers

pull/996/head
Alex Baker 5 years ago
parent 352910a3bc
commit 927b905f62

@ -75,6 +75,7 @@ class ScrollableWidget : InjectingPreferenceFragment() {
setupSlider(R.string.p_widget_font_size, 16)
setupCheckbox(R.string.p_widget_show_checkboxes)
setupCheckbox(R.string.p_widget_show_dividers)
setupCheckbox(R.string.p_widget_show_full_task_title, false)
val showDescription = setupCheckbox(R.string.p_widget_show_description, true)
setupCheckbox(R.string.p_widget_show_full_description, false).dependency = showDescription.key

@ -218,8 +218,14 @@ class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFactory {
row.setViewPadding(R.id.widget_description, horizontalPadding, 0, horizontalPadding, textBottomPadding);
}
int dividerColor = ContextCompat.getColor(context, theme == 0 ? R.color.black_12 : R.color.white_12);
row.setImageViewBitmap(R.id.divider, getSolidBackground(dividerColor));
if (widgetPreferences.showDividers()) {
int dividerColor =
ContextCompat.getColor(context, theme == 0 ? R.color.black_12 : R.color.white_12);
row.setViewVisibility(R.id.divider, View.VISIBLE);
row.setImageViewBitmap(R.id.divider, getSolidBackground(dividerColor));
} else {
row.setViewVisibility(R.id.divider, View.GONE);
}
row.setInt(
R.id.widget_row, "setLayoutDirection", Locale.getInstance(context).getDirectionality());

@ -46,6 +46,10 @@ public class WidgetPreferences {
return preferences.getBoolean(getKey(R.string.p_widget_show_full_description), false);
}
boolean showDividers() {
return preferences.getBoolean(getKey(R.string.p_widget_show_dividers), true);
}
public int getDueDatePosition() {
int defaultValue =
preferences.getBoolean(getKey(R.string.p_widget_show_due_date), true) ? 0 : 2;

@ -292,6 +292,7 @@
<string name="p_widget_font_size">widget-font-size-</string>
<string name="p_widget_show_due_date">widget-show-due-date-</string>
<string name="p_widget_show_full_task_title">widget-show-full-task-title-</string>
<string name="p_widget_show_dividers">widget-show-dividers-</string>
<string name="p_widget_show_description">widget-show-description-</string>
<string name="p_widget_show_full_description">widget-show-full-description-</string>
<string name="p_widget_show_checkboxes">widget-show-checkboxes-</string>

@ -307,6 +307,7 @@ File %1$s contained %2$s.\n\n
<string name="widget_show_header">Show header</string>
<string name="widget_show_settings">Show settings</string>
<string name="widget_show_menu">Show menu</string>
<string name="widget_show_dividers">Show dividers</string>
<string name="notifications">Notifications</string>
<string name="silent">Silent</string>
<string name="sound">Sound</string>

@ -117,6 +117,11 @@
android:key="@string/p_widget_show_full_task_title"
android:title="@string/EPr_fullTask_title" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/p_widget_show_dividers"
android:title="@string/widget_show_dividers" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/widget_footer_settings">

Loading…
Cancel
Save