Improve some task edit touch targets

pull/996/head
Alex Baker 4 years ago
parent 7ce286d0c1
commit 556b5908d2

@ -28,7 +28,6 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import butterknife.BindView;
import butterknife.OnClick;
import butterknife.OnItemSelected;
import com.google.common.base.Strings;
import com.google.ical.values.RRule;
@ -191,10 +190,15 @@ public class RepeatControlSet extends TaskEditControlFragment {
component.inject(this);
}
@OnClick(R.id.display_row_edit)
void openPopup(View view) {
@Override
protected void onRowClick() {
newBasicRecurrenceDialog(this, rrule, dueDate)
.show(getFragmentManager(), FRAG_TAG_BASIC_RECURRENCE);
.show(getParentFragmentManager(), FRAG_TAG_BASIC_RECURRENCE);
}
@Override
protected boolean isClickable() {
return true;
}
@Override

@ -19,7 +19,6 @@ import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import com.google.android.material.chip.Chip;
import com.google.android.material.chip.ChipGroup;
import com.google.common.base.Predicates;
@ -111,13 +110,18 @@ public final class TagsControlSet extends TaskEditControlFragment {
}
}
@OnClick(R.id.tag_row)
void onClickRow() {
@Override
protected void onRowClick() {
Intent intent = new Intent(getContext(), TagPickerActivity.class);
intent.putParcelableArrayListExtra(TagPickerActivity.EXTRA_SELECTED, selectedTags);
startActivityForResult(intent, REQUEST_TAG_PICKER_ACTIVITY);
}
@Override
protected boolean isClickable() {
return true;
}
@Override
public int getIcon() {
return R.drawable.ic_outline_label_24px;
@ -149,7 +153,7 @@ public final class TagsControlSet extends TaskEditControlFragment {
}
Chip chip = chipProvider.newClosableChip(tagData);
chipProvider.apply(chip, tagData);
chip.setOnClickListener(view -> onClickRow());
chip.setOnClickListener(view -> onRowClick());
chip.setOnCloseIconClickListener(
view -> {
selectedTags.remove(tagData);

@ -112,14 +112,19 @@ public class TimerControlSet extends TaskEditControlFragment {
outState.putLong(EXTRA_STARTED, timerStarted);
}
@OnClick(R.id.display_row_edit)
void openPopup(View view) {
@Override
protected void onRowClick() {
if (dialog == null) {
dialog = buildDialog();
}
dialog.show();
}
@Override
protected boolean isClickable() {
return true;
}
private AlertDialog buildDialog() {
return dialogBuilder
.newDialog()

@ -89,6 +89,16 @@ public class HideUntilControlSet extends TaskEditControlFragment implements OnIt
refreshDisplayView();
}
@Override
protected void onRowClick() {
spinner.performClick();
}
@Override
protected boolean isClickable() {
return true;
}
@Nullable
@Override
public View onCreateView(

@ -27,10 +27,10 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.gcal.GCalHelper;
import javax.inject.Inject;
import org.tasks.R;
import org.tasks.calendars.CalendarPicker;
import org.tasks.analytics.Tracker;
import org.tasks.calendars.AndroidCalendar;
import org.tasks.calendars.CalendarEventProvider;
import org.tasks.calendars.CalendarPicker;
import org.tasks.calendars.CalendarProvider;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ForActivity;
@ -226,8 +226,8 @@ public class CalendarControlSet extends TaskEditControlFragment {
refreshDisplayView();
}
@OnClick(R.id.calendar_display_which)
void clickCalendar(View view) {
@Override
protected void onRowClick() {
if (Strings.isNullOrEmpty(eventUri)) {
newCalendarPicker(this, REQUEST_CODE_PICK_CALENDAR, getCalendarName())
.show(getParentFragmentManager(), FRAG_TAG_CALENDAR_PICKER);
@ -238,6 +238,11 @@ public class CalendarControlSet extends TaskEditControlFragment {
}
}
@Override
protected boolean isClickable() {
return true;
}
private void openCalendarEvent() {
ContentResolver cr = getActivity().getContentResolver();
Uri uri = Uri.parse(eventUri);

@ -13,7 +13,6 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import butterknife.BindView;
import butterknife.OnClick;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.data.Task;
import javax.inject.Inject;
@ -70,12 +69,17 @@ public class DeadlineControlSet extends TaskEditControlFragment {
return view;
}
@OnClick(R.id.due_date)
void showDateTimePicker() {
@Override
protected void onRowClick() {
DateTimePicker.Companion.newDateTimePicker(this, REQUEST_DATE, 0, getDueDateTime())
.show(getParentFragmentManager(), FRAG_TAG_DATE_PICKER);
}
@Override
protected boolean isClickable() {
return true;
}
@Override
protected int getLayout() {
return R.layout.control_set_deadline;

@ -149,8 +149,8 @@ public class LocationControlSet extends TaskEditControlFragment {
}
}
@OnClick({R.id.location_name, R.id.location_address})
void locationClick(View view) {
@Override
protected void onRowClick() {
if (location == null) {
chooseLocation();
} else {
@ -173,6 +173,11 @@ public class LocationControlSet extends TaskEditControlFragment {
}
}
@Override
protected boolean isClickable() {
return true;
}
private void chooseLocation() {
Intent intent = new Intent(getActivity(), LocationPickerActivity.class);
if (location != null) {

@ -12,7 +12,6 @@ import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import com.google.android.material.chip.Chip;
import com.google.android.material.chip.ChipGroup;
import com.google.common.base.Objects;
@ -151,11 +150,16 @@ public class RemoteListFragment extends TaskEditControlFragment {
return TAG;
}
@OnClick({R.id.remote_list_row, R.id.chip_group})
void clickGoogleTaskList(View view) {
@Override
protected void onRowClick() {
openPicker();
}
@Override
protected boolean isClickable() {
return true;
}
private void openPicker() {
newRemoteListSupportPicker(selectedList, this, REQUEST_CODE_SELECT_LIST)
.show(getFragmentManager(), FRAG_TAG_GOOGLE_TASK_LIST_SELECTION);

@ -33,6 +33,9 @@ public abstract class TaskEditControlFragment extends InjectingFragment {
inflater.inflate(getLayout(), content);
ImageView icon = view.findViewById(R.id.icon);
icon.setImageResource(getIcon());
if (isClickable()) {
content.setOnClickListener(v -> onRowClick());
}
ButterKnife.bind(this, view);
return view;
}
@ -49,6 +52,12 @@ public abstract class TaskEditControlFragment extends InjectingFragment {
}
}
protected void onRowClick() {}
protected boolean isClickable() {
return false;
}
protected abstract int getLayout();
protected abstract int getIcon();

@ -8,6 +8,5 @@
android:layout_gravity="top|center"
android:alpha="@dimen/alpha_secondary"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:src="@drawable/ic_outline_clear_24px"
android:tint="@color/icon_tint"/>

@ -2,7 +2,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/remote_list_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

@ -5,7 +5,6 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tag_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

@ -8,6 +8,7 @@
android:paddingBottom="@dimen/keyline_first"
android:paddingStart="0dp"
android:paddingEnd="@dimen/keyline_first"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal">
<ImageView

@ -12,8 +12,6 @@
android:layout_gravity="top|center"
android:alpha="@dimen/alpha_secondary"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_outline_notifications_off_24px"
android:tint="@color/icon_tint"
android:visibility="gone"/>
@ -25,8 +23,6 @@
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_toStartOf="@id/geofence_options"
android:clickable="true"
android:focusable="true"
android:gravity="start"
android:hint="@string/add_location"
android:textAlignment="viewStart"/>
@ -39,9 +35,7 @@
android:layout_alignParentStart="true"
android:layout_below="@id/location_name"
android:layout_toStartOf="@id/geofence_options"
android:clickable="true"
android:ellipsize="end"
android:focusable="true"
android:gravity="start"
android:maxLines="1"
android:singleLine="true"

Loading…
Cancel
Save