From e8eea0d8bfc9d78a68a3fbfc68eb65dc86d500e6 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Mon, 13 Apr 2020 14:09:23 -0500 Subject: [PATCH] Increase widget checkbox click target --- .../tasks/widget/ScrollableViewsFactory.java | 12 ++-- app/src/main/res/layout/widget_row.xml | 68 ++++++++----------- 2 files changed, 38 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/org/tasks/widget/ScrollableViewsFactory.java b/app/src/main/java/org/tasks/widget/ScrollableViewsFactory.java index 1d760599d..b35662726 100644 --- a/app/src/main/java/org/tasks/widget/ScrollableViewsFactory.java +++ b/app/src/main/java/org/tasks/widget/ScrollableViewsFactory.java @@ -41,7 +41,6 @@ class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFactory { private final Preferences preferences; private final WidgetPreferences widgetPreferences; private final Context context; - private final int widgetPadding; private final int indentPadding; private boolean showDueDates; @@ -73,7 +72,6 @@ class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFactory { this.locale = locale; widgetPreferences = new WidgetPreferences(context, preferences, widgetId); DisplayMetrics metrics = context.getResources().getDisplayMetrics(); - widgetPadding = (int)(10 * metrics.density); indentPadding = (int)(20 * metrics.density); updateSettings(); } @@ -169,22 +167,28 @@ class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFactory { editIntent.putExtra(WidgetClickActivity.EXTRA_TASK, task); row.setOnClickFillInIntent(R.id.widget_row, editIntent); + int widgetPadding = (int) context.getResources().getDimension(R.dimen.widget_padding); if (showCheckboxes) { row.setViewVisibility(R.id.widget_complete_box, View.VISIBLE); Intent completeIntent = new Intent(WidgetClickActivity.COMPLETE_TASK); completeIntent.putExtra(WidgetClickActivity.EXTRA_TASK, task); row.setOnClickFillInIntent(R.id.widget_complete_box, completeIntent); + row.setViewPadding(R.id.widget_text, 0, widgetPadding, widgetPadding, 0); + row.setViewPadding(R.id.widget_due_date, 0, 0, 0, 0); } else { row.setViewVisibility(R.id.widget_complete_box, View.GONE); + row.setViewPadding(R.id.widget_text, widgetPadding, widgetPadding, widgetPadding, 0); + row.setViewPadding(R.id.widget_due_date, widgetPadding, 0, widgetPadding, 0); } row.setInt( R.id.widget_row, "setLayoutDirection", Locale.getInstance(context).getDirectionality()); + row.setViewPadding( R.id.widget_row, - widgetPadding + taskContainer.getIndent() * indentPadding, + taskContainer.getIndent() * indentPadding, + 0, 0, - widgetPadding, 0); return row; diff --git a/app/src/main/res/layout/widget_row.xml b/app/src/main/res/layout/widget_row.xml index 03dcbbdf0..7baefc8b4 100644 --- a/app/src/main/res/layout/widget_row.xml +++ b/app/src/main/res/layout/widget_row.xml @@ -4,54 +4,46 @@ ** See the file "LICENSE" for the full license governing this code. --> + android:layout_height="wrap_content"> + android:layout_alignParentTop="true" + android:padding="@dimen/widget_padding" + tools:src="@drawable/ic_outline_check_box_outline_blank_24px"/> - - - - - + android:id="@+id/widget_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBaseline="@id/widget_complete_box" + android:paddingTop="@dimen/widget_padding" + android:paddingEnd="@dimen/widget_padding" + android:paddingStart="0dp" + android:gravity="start|center_vertical" + android:singleLine="true" + android:textAlignment="viewStart" + android:textSize="16sp" + tools:text="Task title"/> - + \ No newline at end of file