From ee05a35fe9bcf4abbdc6434bc5d0008f95bad582 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Wed, 15 Apr 2020 14:34:15 -0500 Subject: [PATCH] Simplify row padding --- .../tasks/widget/ScrollableViewsFactory.java | 18 ++++++------- app/src/main/res/layout/widget_row.xml | 27 ++++++++++++++++--- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/org/tasks/widget/ScrollableViewsFactory.java b/app/src/main/java/org/tasks/widget/ScrollableViewsFactory.java index 2cac3e100..a12af6e67 100644 --- a/app/src/main/java/org/tasks/widget/ScrollableViewsFactory.java +++ b/app/src/main/java/org/tasks/widget/ScrollableViewsFactory.java @@ -199,24 +199,22 @@ class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFactory { "setBackgroundResource", theme == 0 ? R.drawable.widget_ripple_light : R.drawable.widget_ripple_dark); } - int horizontalPadding = (int) context.getResources().getDimension(R.dimen.widget_padding); - int verticalPadding = widgetPreferences.getWidgetSpacing(); - int textBottomPadding = bottomDueDate && task.hasDueDate() ? 0 : verticalPadding; - row.setViewPadding(R.id.widget_complete_box, horizontalPadding, verticalPadding, horizontalPadding, verticalPadding); + + int hPad = (int) context.getResources().getDimension(R.dimen.widget_padding); + int vPad = widgetPreferences.getWidgetSpacing(); + row.setViewPadding(R.id.widget_complete_box, hPad, vPad, hPad, vPad); 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, verticalPadding, horizontalPadding, showDescription ? 0 : textBottomPadding); - row.setViewPadding(R.id.widget_due_bottom, 0, 0, horizontalPadding, verticalPadding); - row.setViewPadding(R.id.widget_description, 0, 0, horizontalPadding, textBottomPadding); + row.setViewPadding(R.id.start_padding, 0, 0, 0, 0); } else { row.setViewVisibility(R.id.widget_complete_box, View.GONE); - row.setViewPadding(R.id.widget_text, horizontalPadding, verticalPadding, horizontalPadding, showDescription ? 0 : textBottomPadding); - row.setViewPadding(R.id.widget_due_bottom, horizontalPadding, 0, horizontalPadding, verticalPadding); - row.setViewPadding(R.id.widget_description, horizontalPadding, 0, horizontalPadding, textBottomPadding); + row.setViewPadding(R.id.start_padding, hPad, 0, 0, 0); } + row.setViewPadding(R.id.top_padding, 0, vPad, 0, 0); + row.setViewPadding(R.id.bottom_padding, 0, vPad, 0, 0); if (widgetPreferences.showDividers()) { int dividerColor = diff --git a/app/src/main/res/layout/widget_row.xml b/app/src/main/res/layout/widget_row.xml index 53b5826ba..c9b7f5cf5 100644 --- a/app/src/main/res/layout/widget_row.xml +++ b/app/src/main/res/layout/widget_row.xml @@ -9,15 +9,29 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> + + + + + +