Add option to disable widget subtask chip

pull/996/head
Alex Baker 5 years ago
parent 5d51c221a8
commit fa55facca4

@ -76,6 +76,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_subtasks)
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

@ -55,6 +55,7 @@ class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFactory {
private int hPad;
private boolean handleDueDateClick;
private boolean showDividers;
private boolean showSubtasks;
private boolean isRtl;
private List<TaskContainer> tasks = new ArrayList<>();
@ -186,7 +187,6 @@ class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFactory {
row.setViewVisibility(R.id.widget_description, View.GONE);
}
row.setOnClickFillInIntent(
R.id.widget_row,
new Intent(WidgetClickActivity.EDIT_TASK)
@ -211,7 +211,7 @@ class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFactory {
row.setViewVisibility(R.id.divider, View.GONE);
}
if (taskContainer.hasChildren()) {
if (showSubtasks && taskContainer.hasChildren()) {
row.setOnClickFillInIntent(
R.id.subtask_button,
new Intent(WidgetClickActivity.TOGGLE_SUBTASKS)
@ -309,6 +309,7 @@ class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFactory {
dueDateTextSize = Math.max(10, textSize - 2);
filter = defaultFilterProvider.getFilterFromPreference(widgetPreferences.getFilterId());
showDividers = widgetPreferences.showDividers();
showSubtasks = widgetPreferences.showSubtasks();
isRtl = locale.getDirectionality() == View.LAYOUT_DIRECTION_RTL;
}
}

@ -49,6 +49,10 @@ public class WidgetPreferences {
return getBoolean(R.string.p_widget_show_dividers, true);
}
boolean showSubtasks() {
return getBoolean(R.string.p_widget_show_subtasks, true);
}
public int getDueDatePosition() {
return getIntegerFromString(R.string.p_widget_due_date_position, 0);
}

@ -302,6 +302,7 @@
<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_subtasks">widget-show-subtasks-</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>

@ -124,6 +124,17 @@
</PreferenceCategory>
<PreferenceCategory
android:key="@string/chips"
android:title="@string/chips">
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/p_widget_show_subtasks"
android:title="@string/subtasks" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/widget_on_click">
<ListPreference

Loading…
Cancel
Save