Simplify row padding

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

@ -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 =

@ -9,15 +9,29 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/start_padding"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"/>
<ImageView
android:id="@+id/widget_complete_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_toEndOf="@id/start_padding"
android:layout_alignParentTop="true"
android:padding="@dimen/widget_padding"
tools:src="@drawable/ic_outline_check_box_outline_blank_24px" />
<ImageView
android:id="@+id/top_padding"
android:layout_alignParentTop="true"
android:layout_alignStart="@id/widget_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/widget_padding"/>
<TextView
android:id="@+id/widget_due_end"
android:layout_width="wrap_content"
@ -37,10 +51,9 @@
android:id="@+id/widget_text"
android:layout_toEndOf="@id/widget_complete_box"
android:layout_toStartOf="@id/widget_due_end"
android:layout_below="@id/top_padding"
android:layout_width="match_parent"
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"
@ -77,6 +90,14 @@
android:textSize="14sp"
tools:text="Tomorrow" />
<ImageView
android:id="@+id/bottom_padding"
android:layout_below="@id/subtask_button"
android:layout_alignStart="@id/widget_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/widget_padding" />
<ImageView
android:id="@+id/divider"
android:layout_alignParentBottom="true"

Loading…
Cancel
Save