Increase widget checkbox click target

pull/996/head
Alex Baker 5 years ago
parent daa618b536
commit e8eea0d8bf

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

@ -4,54 +4,46 @@
** See the file "LICENSE" for the full license governing this code.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/widget_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/widget_padding"
android:paddingEnd="@dimen/widget_padding"
android:clickable="false">
android:layout_height="wrap_content">
<ImageView
android:id="@+id/widget_complete_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:paddingStart="0dp"
android:paddingEnd="@dimen/widget_padding"/>
android:layout_alignParentTop="true"
android:padding="@dimen/widget_padding"
tools:src="@drawable/ic_outline_check_box_outline_blank_24px"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
<TextView
android:layout_toEndOf="@id/widget_complete_box"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:orientation="vertical">
<TextView
android:id="@+id/widget_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:singleLine="true"
android:textAlignment="viewStart"
android:textSize="16sp"/>
<TextView
android:id="@+id/widget_due_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="start|center_vertical"
android:singleLine="true"
android:textAlignment="viewStart"
android:textSize="12sp"
android:visibility="gone"/>
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"/>
</LinearLayout>
<TextView
android:id="@+id/widget_due_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/widget_text"
android:layout_alignStart="@id/widget_text"
android:ellipsize="end"
android:gravity="start|center_vertical"
android:singleLine="true"
android:textAlignment="viewStart"
android:textSize="14sp"
tools:text="Tomorrow"/>
</RelativeLayout>
Loading…
Cancel
Save