Add option to open list when clicking empty space

pull/996/head
Alex Baker 5 years ago
parent de86e87d6d
commit 63bff6b58e

@ -70,6 +70,7 @@ class ScrollableWidget : InjectingPreferenceFragment() {
val showDescription = setupCheckbox(R.string.p_widget_show_description, true) val showDescription = setupCheckbox(R.string.p_widget_show_description, true)
setupCheckbox(R.string.p_widget_show_full_description, false).dependency = showDescription.key setupCheckbox(R.string.p_widget_show_full_description, false).dependency = showDescription.key
setupList(R.string.p_widget_spacing) setupList(R.string.p_widget_spacing)
setupList(R.string.p_widget_empty_space_click)
val showHeader = setupCheckbox(R.string.p_widget_show_header) val showHeader = setupCheckbox(R.string.p_widget_show_header)
val showSettings = setupCheckbox(R.string.p_widget_show_settings) val showSettings = setupCheckbox(R.string.p_widget_show_settings)
showSettings.dependency = showHeader.key showSettings.dependency = showHeader.key

@ -110,6 +110,11 @@ public class TasksWidget extends InjectingAppWidgetProvider {
remoteViews.setOnClickPendingIntent(R.id.widget_change_list, getChooseListIntent(context, filter, id)); remoteViews.setOnClickPendingIntent(R.id.widget_change_list, getChooseListIntent(context, filter, id));
remoteViews.setOnClickPendingIntent( remoteViews.setOnClickPendingIntent(
R.id.widget_reconfigure, getWidgetConfigIntent(context, id)); R.id.widget_reconfigure, getWidgetConfigIntent(context, id));
if (widgetPreferences.openOnEmptySpaceClick()) {
remoteViews.setOnClickPendingIntent(R.id.empty_view, getOpenListIntent(context, filter, id));
} else {
remoteViews.setOnClickPendingIntent(R.id.empty_view, null);
}
remoteViews.setPendingIntentTemplate(R.id.list_view, getPendingIntentTemplate(context)); remoteViews.setPendingIntentTemplate(R.id.list_view, getPendingIntentTemplate(context));
return remoteViews; return remoteViews;
} }

@ -98,6 +98,10 @@ public class WidgetPreferences {
return getAlphaValue(R.string.p_widget_empty_space_opacity); return getAlphaValue(R.string.p_widget_empty_space_opacity);
} }
boolean openOnEmptySpaceClick() {
return preferences.getIntegerFromString(getKey(R.string.p_widget_empty_space_click), 0) == 1;
}
private int getAlphaValue(int resId) { private int getAlphaValue(int resId) {
return (int) ((preferences.getInt(getKey(resId), 100) / 100.0) * 255.0); return (int) ((preferences.getInt(getKey(resId), 100) / 100.0) * 255.0);
} }

@ -122,6 +122,16 @@
<item>2</item> <item>2</item>
</string-array> </string-array>
<string-array name="widget_empty_click_titles">
<item>@string/widget_empty_space_do_nothing</item>
<item>@string/widget_empty_space_open_list</item>
</string-array>
<string-array name="widget_empty_click_values">
<item>0</item>
<item>1</item>
</string-array>
<string-array name="EPr_default_urgency_values"> <string-array name="EPr_default_urgency_values">
<!-- urgency: labels that map EPr_default_urgency items to index in TEA_urgency. --> <!-- urgency: labels that map EPr_default_urgency items to index in TEA_urgency. -->
<item>0</item> <item>0</item>
@ -279,6 +289,7 @@
<string name="p_widget_due_date_underneath">widget-due-date-underneath-</string> <string name="p_widget_due_date_underneath">widget-due-date-underneath-</string>
<string name="p_widget_header_opacity">widget-header-opacity-</string> <string name="p_widget_header_opacity">widget-header-opacity-</string>
<string name="p_widget_empty_space_opacity">widget-empty-space-opacity-</string> <string name="p_widget_empty_space_opacity">widget-empty-space-opacity-</string>
<string name="p_widget_empty_space_click">widget-empty-space-click-</string>
<string name="p_widget_spacing">widget-spacing-</string> <string name="p_widget_spacing">widget-spacing-</string>
<string name="p_dashclock_filter">dashclock_filter</string> <string name="p_dashclock_filter">dashclock_filter</string>
<string name="p_default_remote_list">default_remote_list</string> <string name="p_default_remote_list">default_remote_list</string>

@ -413,6 +413,9 @@ File %1$s contained %2$s.\n\n
<string name="widget_header_settings">Header settings</string> <string name="widget_header_settings">Header settings</string>
<string name="widget_row_settings">Row settings</string> <string name="widget_row_settings">Row settings</string>
<string name="widget_empty_space">Empty space</string> <string name="widget_empty_space">Empty space</string>
<string name="widget_empty_space_on_click">On click</string>
<string name="widget_empty_space_do_nothing">Do nothing</string>
<string name="widget_empty_space_open_list">Open list</string>
<string name="clear_completed_tasks_confirmation">Clear completed tasks?</string> <string name="clear_completed_tasks_confirmation">Clear completed tasks?</string>
<string name="copy_multiple_tasks_confirmation">%s copied</string> <string name="copy_multiple_tasks_confirmation">%s copied</string>
<string name="delete_multiple_tasks_confirmation">%s deleted</string> <string name="delete_multiple_tasks_confirmation">%s deleted</string>

@ -107,6 +107,14 @@
app:seekBarIncrement="5" app:seekBarIncrement="5"
app:showSeekBarValue="true" /> app:showSeekBarValue="true" />
<ListPreference
android:defaultValue="0"
android:key="@string/p_widget_empty_space_click"
android:entryValues="@array/widget_empty_click_values"
android:entries="@array/widget_empty_click_titles"
android:title="@string/widget_empty_space_on_click"
android:summary="%s"/>
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>
Loading…
Cancel
Save