From 693e0143b55120612f467b05ac2ce650cfec0a1f Mon Sep 17 00:00:00 2001 From: Alinson Xavier Date: Tue, 23 Feb 2016 19:15:29 -0500 Subject: [PATCH] Implement multiple selection and drag on press-and-hold --- .../commands/ArchiveHabitsCommand.java | 65 +++++ .../commands/ChangeHabitColorCommand.java | 97 +++++++ .../commands/UnarchiveHabitsCommand.java | 65 +++++ .../uhabits/fragments/ListHabitsFragment.java | 262 +++++++++++++++--- .../uhabits/loaders/HabitListLoader.java | 27 +- .../java/org/isoron/uhabits/models/Habit.java | 50 ---- .../drawable-hdpi/ic_action_archive_dark.png | Bin 0 -> 338 bytes .../drawable-hdpi/ic_action_archive_light.png | Bin 0 -> 393 bytes .../drawable-hdpi/ic_action_color_dark.png | Bin 0 -> 492 bytes .../drawable-hdpi/ic_action_color_light.png | Bin 0 -> 563 bytes .../drawable-hdpi/ic_action_edit_light.png | Bin 0 -> 822 bytes .../ic_action_unarchive_dark.png | Bin 0 -> 337 bytes .../ic_action_unarchive_light.png | Bin 0 -> 410 bytes .../drawable-mdpi/ic_action_archive_dark.png | Bin 0 -> 214 bytes .../drawable-mdpi/ic_action_archive_light.png | Bin 0 -> 244 bytes .../drawable-mdpi/ic_action_color_dark.png | Bin 0 -> 289 bytes .../drawable-mdpi/ic_action_color_light.png | Bin 0 -> 319 bytes .../drawable-mdpi/ic_action_edit_light.png | Bin 0 -> 554 bytes .../ic_action_unarchive_dark.png | Bin 0 -> 207 bytes .../ic_action_unarchive_light.png | Bin 0 -> 243 bytes .../drawable-xhdpi/ic_action_archive_dark.png | Bin 0 -> 338 bytes .../ic_action_archive_light.png | Bin 0 -> 390 bytes .../drawable-xhdpi/ic_action_color_dark.png | Bin 0 -> 541 bytes .../drawable-xhdpi/ic_action_color_light.png | Bin 0 -> 602 bytes .../drawable-xhdpi/ic_action_edit_light.png | Bin 0 -> 1039 bytes .../ic_action_unarchive_dark.png | Bin 0 -> 337 bytes .../ic_action_unarchive_light.png | Bin 0 -> 381 bytes .../ic_action_archive_dark.png | Bin 0 -> 593 bytes .../ic_action_archive_light.png | Bin 0 -> 674 bytes .../drawable-xxhdpi/ic_action_color_dark.png | Bin 0 -> 922 bytes .../drawable-xxhdpi/ic_action_color_light.png | Bin 0 -> 1034 bytes .../drawable-xxhdpi/ic_action_edit_light.png | Bin 0 -> 1647 bytes .../ic_action_unarchive_dark.png | Bin 0 -> 575 bytes .../ic_action_unarchive_light.png | Bin 0 -> 683 bytes .../main/res/drawable/ripple_background.xml | 6 - .../main/res/drawable/ripple_transparent.xml | 8 + app/src/main/res/drawable/ripple_white.xml | 5 + app/src/main/res/drawable/selected_box.xml | 5 + app/src/main/res/layout/edit_habit.xml | 2 +- .../main/res/layout/list_habits_fragment.xml | 5 +- .../main/res/menu-v21/list_habits_context.xml | 24 ++ app/src/main/res/menu/list_habits_context.xml | 19 +- app/src/main/res/values-pt/strings.xml | 6 +- .../res/values-v21/styles_list_habits.xml | 9 +- app/src/main/res/values/keys.xml | 8 +- app/src/main/res/values/strings.xml | 8 +- libs/drag-sort-listview | 2 +- 47 files changed, 540 insertions(+), 133 deletions(-) create mode 100644 app/src/main/java/org/isoron/uhabits/commands/ArchiveHabitsCommand.java create mode 100644 app/src/main/java/org/isoron/uhabits/commands/ChangeHabitColorCommand.java create mode 100644 app/src/main/java/org/isoron/uhabits/commands/UnarchiveHabitsCommand.java create mode 100644 app/src/main/res/drawable-hdpi/ic_action_archive_dark.png create mode 100644 app/src/main/res/drawable-hdpi/ic_action_archive_light.png create mode 100644 app/src/main/res/drawable-hdpi/ic_action_color_dark.png create mode 100644 app/src/main/res/drawable-hdpi/ic_action_color_light.png create mode 100644 app/src/main/res/drawable-hdpi/ic_action_edit_light.png create mode 100644 app/src/main/res/drawable-hdpi/ic_action_unarchive_dark.png create mode 100644 app/src/main/res/drawable-hdpi/ic_action_unarchive_light.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_archive_dark.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_archive_light.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_color_dark.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_color_light.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_edit_light.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_unarchive_dark.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_unarchive_light.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_archive_dark.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_archive_light.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_color_dark.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_color_light.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_edit_light.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_unarchive_dark.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_unarchive_light.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_archive_dark.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_archive_light.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_color_dark.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_color_light.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_edit_light.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_unarchive_dark.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_unarchive_light.png delete mode 100644 app/src/main/res/drawable/ripple_background.xml create mode 100644 app/src/main/res/drawable/ripple_transparent.xml create mode 100644 app/src/main/res/drawable/ripple_white.xml create mode 100644 app/src/main/res/drawable/selected_box.xml create mode 100644 app/src/main/res/menu-v21/list_habits_context.xml diff --git a/app/src/main/java/org/isoron/uhabits/commands/ArchiveHabitsCommand.java b/app/src/main/java/org/isoron/uhabits/commands/ArchiveHabitsCommand.java new file mode 100644 index 000000000..0d1ae561f --- /dev/null +++ b/app/src/main/java/org/isoron/uhabits/commands/ArchiveHabitsCommand.java @@ -0,0 +1,65 @@ +/* Copyright (C) 2016 Alinson Santos Xavier + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.isoron.uhabits.commands; + +import org.isoron.helpers.Command; +import org.isoron.uhabits.R; +import org.isoron.uhabits.models.Habit; + +import java.util.LinkedList; +import java.util.List; + +public class ArchiveHabitsCommand extends Command +{ + + private List habits; + + public ArchiveHabitsCommand(Habit habit) + { + habits = new LinkedList<>(); + habits.add(habit); + } + + public ArchiveHabitsCommand(List habits) + { + this.habits = habits; + } + + @Override + public void execute() + { + for(Habit h : habits) + h.archive(); + } + + @Override + public void undo() + { + for(Habit h : habits) + h.unarchive(); + } + + public Integer getExecuteStringId() + { + return R.string.toast_habit_archived; + } + + public Integer getUndoStringId() + { + return R.string.toast_habit_unarchived; + } +} \ No newline at end of file diff --git a/app/src/main/java/org/isoron/uhabits/commands/ChangeHabitColorCommand.java b/app/src/main/java/org/isoron/uhabits/commands/ChangeHabitColorCommand.java new file mode 100644 index 000000000..f522f0bf5 --- /dev/null +++ b/app/src/main/java/org/isoron/uhabits/commands/ChangeHabitColorCommand.java @@ -0,0 +1,97 @@ +/* Copyright (C) 2016 Alinson Santos Xavier + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.isoron.uhabits.commands; + +import com.activeandroid.ActiveAndroid; + +import org.isoron.helpers.Command; +import org.isoron.uhabits.R; +import org.isoron.uhabits.models.Habit; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +public class ChangeHabitColorCommand extends Command +{ + List habits; + List originalColors; + Integer newColor; + + public ChangeHabitColorCommand(List habits, Integer newColor) + { + this.habits = habits; + this.newColor = newColor; + this.originalColors = new ArrayList<>(habits.size()); + + for(Habit h : habits) + originalColors.add(h.color); + } + + @Override + public void execute() + { + ActiveAndroid.beginTransaction(); + + try + { + for(Habit h : habits) + { + h.color = newColor; + h.save(); + } + + ActiveAndroid.setTransactionSuccessful(); + } + finally + { + ActiveAndroid.endTransaction(); + } + } + + @Override + public void undo() + { + ActiveAndroid.beginTransaction(); + + try + { + int k = 0; + for(Habit h : habits) + { + h.color = originalColors.get(k++); + h.save(); + } + + ActiveAndroid.setTransactionSuccessful(); + } + finally + { + ActiveAndroid.endTransaction(); + } + } + + public Integer getExecuteStringId() + { + return R.string.toast_habit_changed; + } + + public Integer getUndoStringId() + { + return R.string.toast_habit_changed; + } +} diff --git a/app/src/main/java/org/isoron/uhabits/commands/UnarchiveHabitsCommand.java b/app/src/main/java/org/isoron/uhabits/commands/UnarchiveHabitsCommand.java new file mode 100644 index 000000000..258627321 --- /dev/null +++ b/app/src/main/java/org/isoron/uhabits/commands/UnarchiveHabitsCommand.java @@ -0,0 +1,65 @@ +/* Copyright (C) 2016 Alinson Santos Xavier + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.isoron.uhabits.commands; + +import org.isoron.helpers.Command; +import org.isoron.uhabits.R; +import org.isoron.uhabits.models.Habit; + +import java.util.LinkedList; +import java.util.List; + +public class UnarchiveHabitsCommand extends Command +{ + + private List habits; + + public UnarchiveHabitsCommand(Habit habit) + { + habits = new LinkedList<>(); + habits.add(habit); + } + + public UnarchiveHabitsCommand(List habits) + { + this.habits = habits; + } + + @Override + public void execute() + { + for(Habit h : habits) + h.unarchive(); + } + + @Override + public void undo() + { + for(Habit h : habits) + h.archive(); + } + + public Integer getExecuteStringId() + { + return R.string.toast_habit_unarchived; + } + + public Integer getUndoStringId() + { + return R.string.toast_habit_archived; + } +} \ No newline at end of file diff --git a/app/src/main/java/org/isoron/uhabits/fragments/ListHabitsFragment.java b/app/src/main/java/org/isoron/uhabits/fragments/ListHabitsFragment.java index 5086e8a5f..060c47f08 100644 --- a/app/src/main/java/org/isoron/uhabits/fragments/ListHabitsFragment.java +++ b/app/src/main/java/org/isoron/uhabits/fragments/ListHabitsFragment.java @@ -23,10 +23,13 @@ import android.app.Fragment; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Color; +import android.graphics.Point; import android.graphics.Typeface; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.DisplayMetrics; +import android.util.Log; +import android.view.ActionMode; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.LayoutInflater; @@ -47,28 +50,153 @@ import android.widget.LinearLayout.LayoutParams; import android.widget.ProgressBar; import android.widget.TextView; +import com.android.colorpicker.ColorPickerDialog; +import com.android.colorpicker.ColorPickerSwatch; import com.mobeta.android.dslv.DragSortController; import com.mobeta.android.dslv.DragSortListView; import com.mobeta.android.dslv.DragSortListView.DropListener; +import org.isoron.helpers.ColorHelper; import org.isoron.helpers.Command; import org.isoron.helpers.DateHelper; import org.isoron.helpers.DialogHelper; import org.isoron.helpers.DialogHelper.OnSavedListener; import org.isoron.helpers.ReplayableActivity; import org.isoron.uhabits.R; +import org.isoron.uhabits.commands.ArchiveHabitsCommand; +import org.isoron.uhabits.commands.ChangeHabitColorCommand; +import org.isoron.uhabits.commands.UnarchiveHabitsCommand; import org.isoron.uhabits.helpers.ReminderHelper; import org.isoron.uhabits.loaders.HabitListLoader; import org.isoron.uhabits.models.Habit; import java.util.Date; import java.util.GregorianCalendar; +import java.util.LinkedList; +import java.util.List; public class ListHabitsFragment extends Fragment implements OnSavedListener, OnItemClickListener, OnLongClickListener, DropListener, - OnClickListener, HabitListLoader.Listener + OnClickListener, HabitListLoader.Listener, AdapterView.OnItemLongClickListener { - public static final int INACTIVE_COLOR = Color.rgb(230, 230, 230); + private class ListHabitsActionBarCallback implements ActionMode.Callback + { + @Override + public boolean onCreateActionMode(ActionMode mode, Menu menu) + { + getActivity().getMenuInflater().inflate(R.menu.list_habits_context, menu); + updateTitle(mode); + updateActions(menu); + return true; + } + + @Override + public boolean onPrepareActionMode(ActionMode mode, Menu menu) + { + updateTitle(mode); + updateActions(menu); + return true; + } + + private void updateActions(Menu menu) + { + boolean showEdit = (selectedPositions.size() == 1); + boolean showColor = true; + boolean showArchive = true; + boolean showUnarchive = true; + + if(showEdit) showColor = false; + for(int i : selectedPositions) + { + Habit h = loader.habitsList.get(i); + if(h.isArchived()) + { + showColor = false; + showArchive = false; + } + else showUnarchive = false; + } + + MenuItem itemEdit = menu.findItem(R.id.action_edit_habit); + MenuItem itemColor = menu.findItem(R.id.action_color); + MenuItem itemArchive = menu.findItem(R.id.action_archive_habit); + MenuItem itemUnarchive = menu.findItem(R.id.action_unarchive_habit); + + itemEdit.setVisible(showEdit); + itemColor.setVisible(showColor); + itemArchive.setVisible(showArchive); + itemUnarchive.setVisible(showUnarchive); + } + + private void updateTitle(ActionMode mode) + { + mode.setTitle("" + selectedPositions.size()); + } + + @Override + public boolean onActionItemClicked(final ActionMode mode, MenuItem item) + { + final LinkedList selectedHabits = new LinkedList<>(); + for(int i : selectedPositions) + selectedHabits.add(loader.habitsList.get(i)); + + Habit firstHabit = selectedHabits.getFirst(); + + switch(item.getItemId()) + { + case R.id.action_archive_habit: + executeCommand(new ArchiveHabitsCommand(selectedHabits), null); + mode.finish(); + return true; + + case R.id.action_unarchive_habit: + executeCommand(new UnarchiveHabitsCommand(selectedHabits), null); + mode.finish(); + return true; + + case R.id.action_edit_habit: + { + EditHabitFragment frag = EditHabitFragment.editSingleHabitFragment(firstHabit.getId()); + frag.setOnSavedListener(ListHabitsFragment.this); + frag.show(getFragmentManager(), "dialog"); + return true; + } + + case R.id.action_color: + { + ColorPickerDialog picker = ColorPickerDialog.newInstance( + R.string.color_picker_default_title, ColorHelper.palette, + firstHabit.color, 4, ColorPickerDialog.SIZE_SMALL); + + picker.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() + { + public void onColorSelected(int color) + { + executeCommand(new ChangeHabitColorCommand(selectedHabits, color), null); + mode.finish(); + } + }); + picker.show(getFragmentManager(), "picker"); + } + } + + return false; + } + + @Override + public void onDestroyActionMode(ActionMode mode) + { + actionMode = null; + + selectedPositions.clear(); + adapter.notifyDataSetChanged(); + + listView.setDragEnabled(true); + } + } + + public static final int INACTIVE_COLOR = Color.rgb(200, 200, 200); + public static final int INACTIVE_CHECKMARK_COLOR = Color.rgb(230, 230, 230); public static final int HINT_INTERVAL = 5; public static final int HINT_INTERVAL_OFFSET = 2; @@ -96,6 +224,10 @@ public class ListHabitsFragment extends Fragment private boolean showArchived; private SharedPreferences prefs; + private ActionMode actionMode; + private List selectedPositions; + private DragSortController dragSortController; + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) @@ -119,18 +251,39 @@ public class ListHabitsFragment extends Fragment listView = (DragSortListView) view.findViewById(R.id.listView); listView.setAdapter(adapter); listView.setOnItemClickListener(this); - registerForContextMenu(listView); + listView.setOnItemLongClickListener(this); listView.setDropListener(this); + listView.setDragListener(new DragSortListView.DragListener() + { + @Override + public void drag(int from, int to) + { + } + + @Override + public void startDrag(int position) + { + selectItem(position); + } + }); - DragSortController controller = new DragSortController(listView); - controller.setDragHandleId(R.id.tvStar); - controller.setRemoveEnabled(false); - controller.setSortEnabled(true); - controller.setDragInitMode(1); + dragSortController = new DragSortController(listView) { + @Override + public View onCreateFloatView(int position) + { + return adapter.getView(position, null, null); + } - listView.setFloatViewManager(controller); - listView.setOnTouchListener(controller); + @Override + public void onDestroyFloatView(View floatView) + { + } + }; + dragSortController.setRemoveEnabled(false); + + listView.setFloatViewManager(dragSortController); listView.setDragEnabled(true); + listView.setLongClickable(true); llHint = view.findViewById(R.id.llHint); llHint.setOnClickListener(this); @@ -143,7 +296,7 @@ public class ListHabitsFragment extends Fragment loader.updateAllHabits(true); setHasOptionsMenu(true); - + selectedPositions = new LinkedList<>(); return view; } @@ -257,45 +410,51 @@ public class ListHabitsFragment extends Fragment } @Override - public boolean onContextItemSelected(MenuItem menuItem) + public void onItemClick(AdapterView parent, View view, int position, long id) { - AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuItem.getMenuInfo(); - final Habit habit = loader.habits.get(info.id); + if (new Date().getTime() - lastLongClick < 1000) return; - switch(menuItem.getItemId()) + if(actionMode == null) { - case R.id.action_edit_habit: - { - EditHabitFragment frag = EditHabitFragment.editSingleHabitFragment(habit.getId()); - frag.setOnSavedListener(this); - frag.show(getFragmentManager(), "dialog"); - return true; - } + Habit habit = loader.habitsList.get(position); + habitClickListener.onHabitClicked(habit); + } + else + { + int k = selectedPositions.indexOf(position); + if(k < 0) + selectedPositions.add(position); + else + selectedPositions.remove(k); - case R.id.action_archive_habit: - { - Command c = habit.new ArchiveCommand(); - executeCommand(c, null); - return true; - } + if(selectedPositions.isEmpty()) actionMode.finish(); + else actionMode.invalidate(); - case R.id.action_unarchive_habit: - { - Command c = habit.new UnarchiveCommand(); - executeCommand(c, null); - } + adapter.notifyDataSetChanged(); } - - return super.onContextItemSelected(menuItem); } @Override - public void onItemClick(AdapterView parent, View view, int position, long id) + public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { - if (new Date().getTime() - lastLongClick < 1000) return; + selectItem(position); + return true; + } + + private void selectItem(int position) + { + if(!selectedPositions.contains(position)) + selectedPositions.add(position); + + adapter.notifyDataSetChanged(); - Habit habit = loader.habitsList.get(position); - habitClickListener.onHabitClicked(habit); + if(actionMode == null) + { + actionMode = getActivity().startActionMode(new ListHabitsActionBarCallback()); +// listView.setDragEnabled(false); + } + + if(actionMode != null) actionMode.invalidate(); } @Override @@ -308,6 +467,8 @@ public class ListHabitsFragment extends Fragment adapter.notifyDataSetChanged(); ReminderHelper.createReminderAlarms(activity); + + if(actionMode != null) actionMode.finish(); } private void updateEmptyMessage() @@ -400,6 +561,9 @@ public class ListHabitsFragment extends Fragment @Override public void drop(int from, int to) { + if(from == to) return; + if(actionMode != null) actionMode.finish(); + loader.reorder(from, to); adapter.notifyDataSetChanged(); loader.updateAllHabits(false); @@ -457,7 +621,7 @@ public class ListHabitsFragment extends Fragment final Habit habit = loader.habitsList.get(position); if (view == null || - (Long) view.getTag(R.id.KEY_TIMESTAMP) != DateHelper.getStartOfToday()) + (Long) view.getTag(R.id.timestamp_key) != DateHelper.getStartOfToday()) { view = inflater.inflate(R.layout.list_habits_item, null); ((TextView) view.findViewById(R.id.tvStar)).setTypeface(fontawesome); @@ -468,7 +632,7 @@ public class ListHabitsFragment extends Fragment inflateCheckmarkButtons(view); - view.setTag(R.id.KEY_TIMESTAMP, DateHelper.getStartOfToday()); + view.setTag(R.id.timestamp_key, DateHelper.getStartOfToday()); } TextView tvStar = ((TextView) view.findViewById(R.id.tvStar)); @@ -481,6 +645,17 @@ public class ListHabitsFragment extends Fragment updateNameAndIcon(habit, tvStar, tvName); updateCheckmarkButtons(habit, llButtons); + boolean selected = selectedPositions.contains(position); + if(selected) + llInner.setBackgroundResource(R.drawable.selected_box); + else + { + if (android.os.Build.VERSION.SDK_INT >= 21) + llInner.setBackgroundResource(R.drawable.ripple_white); + else + llInner.setBackgroundColor(Color.WHITE); + } + return view; } @@ -554,6 +729,7 @@ public class ListHabitsFragment extends Fragment { int activeColor = habit.color; if(habit.isArchived()) activeColor = INACTIVE_COLOR; + return activeColor; } @@ -569,13 +745,13 @@ public class ListHabitsFragment extends Fragment case 1: tvCheck.setText(R.string.fa_check); - tvCheck.setTextColor(INACTIVE_COLOR); + tvCheck.setTextColor(INACTIVE_CHECKMARK_COLOR); tvCheck.setTag(R.string.toggle_key, 1); break; case 0: tvCheck.setText(R.string.fa_times); - tvCheck.setTextColor(INACTIVE_COLOR); + tvCheck.setTextColor(INACTIVE_CHECKMARK_COLOR); tvCheck.setTag(R.string.toggle_key, 0); break; } diff --git a/app/src/main/java/org/isoron/uhabits/loaders/HabitListLoader.java b/app/src/main/java/org/isoron/uhabits/loaders/HabitListLoader.java index 88598d59c..bd7443626 100644 --- a/app/src/main/java/org/isoron/uhabits/loaders/HabitListLoader.java +++ b/app/src/main/java/org/isoron/uhabits/loaders/HabitListLoader.java @@ -164,16 +164,22 @@ public class HabitListLoader @Override protected void onPreExecute() { - progressBar.setIndeterminate(false); - progressBar.setProgress(0); - progressBar.setVisibility(View.VISIBLE); + if(progressBar != null) + { + progressBar.setIndeterminate(false); + progressBar.setProgress(0); + progressBar.setVisibility(View.VISIBLE); + } } @Override protected void onProgressUpdate(Integer... values) { - progressBar.setMax(values[1]); - progressBar.setProgress(values[0]); + if(progressBar != null) + { + progressBar.setMax(values[1]); + progressBar.setProgress(values[0]); + } if(listener != null) listener.onLoadFinished(); } @@ -183,7 +189,7 @@ public class HabitListLoader { if (isCancelled()) return; - progressBar.setVisibility(View.INVISIBLE); + if(progressBar != null) progressBar.setVisibility(View.INVISIBLE); lastLoadTimestamp = DateHelper.getStartOfToday(); currentFetchTask = null; @@ -223,8 +229,11 @@ public class HabitListLoader { if (getStatus() == Status.RUNNING) { - progressBar.setIndeterminate(true); - progressBar.setVisibility(View.VISIBLE); + if(progressBar != null) + { + progressBar.setIndeterminate(true); + progressBar.setVisibility(View.VISIBLE); + } } } }, 500); @@ -233,7 +242,7 @@ public class HabitListLoader @Override protected void onPostExecute(Void aVoid) { - progressBar.setVisibility(View.GONE); + if(progressBar != null) progressBar.setVisibility(View.GONE); if(listener != null) listener.onLoadFinished(); diff --git a/app/src/main/java/org/isoron/uhabits/models/Habit.java b/app/src/main/java/org/isoron/uhabits/models/Habit.java index 31692b507..d2a40674b 100644 --- a/app/src/main/java/org/isoron/uhabits/models/Habit.java +++ b/app/src/main/java/org/isoron/uhabits/models/Habit.java @@ -696,54 +696,4 @@ public class Habit extends Model execute(); } } - - public class ArchiveCommand extends Command - { - @Override - public void execute() - { - archive(); - } - - @Override - public void undo() - { - unarchive(); - } - - public Integer getExecuteStringId() - { - return R.string.toast_habit_archived; - } - - public Integer getUndoStringId() - { - return R.string.toast_habit_unarchived; - } - } - - public class UnarchiveCommand extends Command - { - @Override - public void execute() - { - unarchive(); - } - - @Override - public void undo() - { - archive(); - } - - public Integer getExecuteStringId() - { - return R.string.toast_habit_unarchived; - } - - public Integer getUndoStringId() - { - return R.string.toast_habit_archived; - } - } } diff --git a/app/src/main/res/drawable-hdpi/ic_action_archive_dark.png b/app/src/main/res/drawable-hdpi/ic_action_archive_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..4d25429bc060d78826110b2346cca7661f57dea7 GIT binary patch literal 338 zcmV-Y0j>UtP)4qH5Y=i=#Xr#=awz0GIp-=`u!USb=(T^KxBLQyf}sD_c_o6V(X^f2tnePpB_wa= z&AefiuZm0DM^wqNxIVvaDv-t@nu;KB-v*i z$6JZ15^Y~N=imf4au_MTs;UR+(hS{_WGjhxEei?Phw!fJNz9N-U4Rh3NNlvNbHPd* z5%sJtAc~@~>Ee%KtS+ElEvyJYE()Lk3g}Qk69)xQ!1-76Tds%y;0(dh^#s;`5rJn8 z`=8D&gf0d_@YpJ2lzHm6!Ocovzu&nN_ICPPc61)G~T%r#7~6aVzm- zr?$3naxa9g|EBZY%-#4Wp4bwATqY(E+7giGd0=7!k3zn*AYf4x#n8yv5Jc2V;za9A n=n&vU=ZzIl5ClOGgaPaU^vnc0GT^Z@00000NkvXXu0mjf|3Ifllb|9k|qxMo%asUXt9!QH{yV!u;- z4o(P1?z{xw^epcKKPY(&iXnnOa||)pMSI1uIpJ`EibcE#-@u|=0!pCofZuCOD^RI$O7 zTKg0Y_ytqtH%zH@MA1OEM5>rDrPe8R_7_Q&X^GSdt6ID$_yTR}Aw81fW7E&z0&G@!bR3j0D~xW7bA$^=$c|<^ZDQB8Lwr;) z*Ed{iKpZKr3N&%%;-{3F{3mRNlh`7!x%y40V>z+go~x4SbRgG>yv6PjEd9q%i;>)E iHa!-L#bU8obEt3dzPR_xMOJVC0000$)3Di+YeA6D7Ky<2X-fhcSeQ z!I(#LmGAG(W^->DaL znj4c=->p__JFA?ZLeNG4ZCRMQ@8mn69k6CJgHlA>kGO5a(rd2J->Q(9vP;OePifIM3 zs)ahaP2GXuY-6P=NoG*32UhL3QI&)h(5jZ2UaXrJhar__sDTsK6k?XqFW>jqIV7}{ zkpm9fMJ4I1pHlktSkDpaMwYUTs?}S1*cvb;JD79dPSkJ%$U z50Iy)amQ(co#*NXZ?h+mt|PzqbN31XV$T*U@R-Y|6!lVXD%eh^vzyBYp`a#=h0St2 z$nat7W0~(iwtEF#PD;wtqN`qh1OkCTAP}q){sA!3QK&=iw{HLd002ovPDHLkV1nM^ B{>A_R literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_action_edit_light.png b/app/src/main/res/drawable-hdpi/ic_action_edit_light.png new file mode 100644 index 0000000000000000000000000000000000000000..5c8bcf8811c71b18f870ddd33dee186a8be0c6f0 GIT binary patch literal 822 zcmV-61Ihe}P)!wKaFA|D@!VRtONy7P@7~_*n=Qw#gc+_duZx^+xNja zFfF^+s|!1`aSsgl4ZrWqnKNhRdR}Oug%(=77Kudqvf1plTrT$}old{aWHJ?;k8}lm zGMU^9;ExcnZZ_OorI2#Dyu(@eVzGDx9{<(|-_YJc$S&vLqtWPYz*hnHYXbpnuklHb zE9^ZC8wFzgr&6hl5VPbb0zwN;zytQ4Kz#x91O@N`0QaEH`UseICEJt%{>cDaK#v^f za}HQsKWip{8Okbrp->nql}ZEJ6M#C4Ru>U}AY#lAG22AIlr{K#K7W+31jTU%FvsNn zK24$Ml{JJ{NmHwe6M;YZt~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W*wma4eIXi~_an$^CH*@3lt=FFJ}ina=-3R_J$8J+qL zq*-2F%rITKAkuHLNy9sinrWAH1P{qLo+z3%jai|aGtzDgx6*?5RVxA{ODDf&2o4Tr rp1?RIg3m|!*W$Cg0u8v>Oc@w%hIy{-i|E}3^ag{ctDnm{r-UW|?NC+U literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_action_color_dark.png b/app/src/main/res/drawable-mdpi/ic_action_color_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..6f814532b04a4d26872e0b2939c7e933cca0e55c GIT binary patch literal 289 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJ7oIMTAr-fh6C_v{Cy4NoNpU8j4NoqbD+fpo~6-UbN{_WP}L}G5EU%+<9HtUs3Fa! zu!no`>R8uKW;4N#gQJ-Z z6IWSRjo$(VtLCK}3>T#GcEpJ+eth%GiZu6{1-oD!MWq#*6Gx~g;@mGgwn#0j(G;7=ThG7_!ZG}6IGZTx&t^t3iz>qiSLOPx9 zQ4XiK0A5z%UV%}2_{6UaZdsNM??d@~z8k=07;;l<1fJ=t;1lrhSa@1VCX*x3LC9H+ z0XY=~Hy4k`4dxgC7tlM%71Kc@ypfO|0TJ#3qoP`;QL}Hj=z(vb>VYl4rL?lvPxRT=)Z8R!wG2aRd&(^rH z@EzgO+szaHtp>S%5UJQ#250d#x>AWF)l_=7qi6N{8%FKAt~;&#Qdv{!ykKOc9;H7O sAAm3Lwk%r9?`!7}7t3JhZ`HpVANR2l;ncPwyZ`_I07*qoM6N<$g7{JVy8r+H literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_action_unarchive_dark.png b/app/src/main/res/drawable-mdpi/ic_action_unarchive_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..95e085c1c0323ccf0efca5a0f8558b1e0d3905e6 GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJX`U{QAr-fh6C_v{Cy4Nrefa;s zURB{9&yjSGBMP>srbOv69FcCcn9j3zYQSEmDHaRn^UPoTxXw$apo@#o!nKq6TmUnF zHhWIfBgR686G@sH_gwPX8+6@++OG>k>7TR|Br>Du|$|;U3!n~Kbjhb`V8F)`9UVZ*T z;>CoVO|lGEY?_1E85Sp5sVW*wma6z+#W3ZPV}*kZ!=@W&&iF{Qa9TFK;%kWH3wA#t z7*fix>**1TrYyb#sg{cF0Y@2IbdEpgn5E+6b%l?gy{BiAz>FDHD*_}-C%?~LfL#b(H=*C7W1*3cu_ zKP)@lC+hrSt70mB`rIR_Wa&N4Zw@UJmZmJ*y^!nPwRhpiS_~Hp0!;vd1Mw!l#+Toi zl%G{EzSNUD>*dlv5yd(Id*(aOdh6(LH8N{*-2|K!#sAf>dF)T9XpMfOrDrh`L+h=)H5b0+y6;E4+6h9jfa4yU8QKdy5B!rcqu^rmB k_(?51000000021V7hypTWWL=dfB*mh07*qoM6N<$f-QNdga7~l literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_action_color_dark.png b/app/src/main/res/drawable-xhdpi/ic_action_color_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..08981ad0f590ef853da4cbfdf459067c7705d3d7 GIT binary patch literal 541 zcmV+&0^7@V;!tpK5_IzeI0%A*QwQk>Xa+YC92^9p;-X{0#nDkJ7VO|3Ea*@{>Qc1! zJJny{3L(Vya!vYP(%%EmQjU=KZQgq?cTtKELI@#*5JCt^jlp2B20d7VP523W+75h# z*YFT-!1+7`y#UMb4)$Z(h9__(tHJNUXN$nYe#3LPl$F32;bj7Why8%Nt_Qyi8=)KT z!U`;EEBd#-#kgO11m|20KI)OLM2z(&80TAc@v(3GbF;;W@x=+o4Lxuv0i$X@tpxb( zbJK<3x5rFgX_UawS6Gnl^W$1wR|hhj+`JK!pvkzf`;rMLr_k==`X;t&v|Qn(;g;0e z-lpHj)#SRT5()4Un8Zvpx$dn*0%{YsF;h*h+m=W`)1d_XNF?CXp%UmyB%qg2AMYoy zj%c}%07_LT$lu45ih-iaSmZX-!o&&+3NpEvY245B5I>!yvg=)T}TwqGC z!+y_i`K`{M?L{|0EH^|J_%Ko2Xr}HSR~*};3<&D4x67`uWff31A4SXW=5coun#`FXfguE9KonZ82lGU_?<6&Uf8z1RY>D;^M^3vEw14Kj`)GD5J4M-FkIL5 zHQexZTEhbz@r`IOls4XRoK4*9v+u^ol>3cFW1ZyHfpLI=q3e)Nzt9=})RL0M2ZcNt z;$KVOC0*yqRW9uPJ3kferhh$smvr4!rfHri@ePqwKs$%L1Oun`9=vwapJ9ASq;uZuLefHsr7@Yq0bPY0FyZL`165LhY63?DOjId?__@#S0A}5= zrvS5T_9DnR2{xO}74|mBI0afXw zr&dSRo~7WWIS`4VJHs$`l|1oHb0ijVm)}{Bw$g%X+)n9$^FluZq+@Z^gQtacz`O?| z3y}h|PDl|6u2u%Tr$p@pQ83cV1X`LNCne}539W2+bAl6bVsy1KgI2jc^NP&N%qucO oGG3_(PY?t_5ClOG1VJb{|AfpAF4@wNt^fc407*qoM6N<$g8PaPNdN!< literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_action_edit_light.png b/app/src/main/res/drawable-xhdpi/ic_action_edit_light.png new file mode 100644 index 0000000000000000000000000000000000000000..955a22d5187e24ce190cc9e120ea1fe3064246dc GIT binary patch literal 1039 zcmV+q1n~QbP)9?jq$7)Q|)~w1q&K9ph8TFBp9nP>MtDq!2=bgqEhR{t@z*ieaVb@ znRH>7BiWhGOD1ghAoF?i=3TpifE6oNtXQ$4r6iNdouN=@ce8N^)9G|)DwV2Y{G|a! z)Dnrref(`Te#HU$OoFQe*Oz0lSbwot++iGiHk&;N_*YKwiXvXq{l>t@gu~$jfa=4T_h1PfT6%hz{SZJWFiIGw z6=&E2xDl5Mc&i;fCOxczKp~?5Kf#rR`|h~d27k2M29Zc)KVtngOnzDobAawvl+|sV z0;JHyNf7{;kgHU35MgjfS;@R}?YEtpUIHaV6mQds*(n3Gzhfk`AG+&t(xa&HV#e0(Xu$ z?vcuoo?i#E@AX*8)esquFo$^#=YET8Kcp4l_Y+vcQ(uQWukbvS(JD6zb8@d^yPWbh zJSKf}J@9OdNXJNVU8cqKe|6aNJsX6Vm0%}RC^bKqSzcf^yjbmDaw`xxj<5Q?hj)Fm z;8oABgV}ds#a6aJ0TWFNFB2fY$NAz`!BeR$3m(6Qx{j@c=LwO8_gOvP-n8&is76OF zK1l5+s@f=KZ-T?CHENdlO@a=QAiGg`-@oRjtPCqXCHiyJ$IHs*rD$2bF&5tGWdv_d z5(Mt48woEIFx4Pmuk+GX^!X=U=K6J%wa0ZybuX;4isSt24C>{Ja(H$%c-iOEW%VDe zVans&5@d(h2zcTA7G3OTYIR3gPp_@Pec!Z#m&K09M#d29)nDn#8^zwF@Le$uNdqrcFm&sJ3DN9}2x%dzs; zT#?R?lz{mCkUm-tG?UP$Xz&3y)Z(UDBxs~lvtq@H6)RT$%Rj}{-DLT|9uWWl002ov JPDHLkV1h#_^^*Vq literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_action_unarchive_dark.png b/app/src/main/res/drawable-xhdpi/ic_action_unarchive_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..bc6c288ada13d2509d3f34f77620f49c61014ec2 GIT binary patch literal 337 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7T#lEV3hE5aSW-r^>*e#-@^_9uFfqh z4lfjN(Nt`|&$v?IiP-j*M+IGXCeNH|HYrt6q-pNW*!}8%U;mk#F0b=Gi4kZF5EKZ< zUbl_hHf{0JxfTl_+mRJGDX^{ux9s<-EZAIkb!6?_%ej+!r`(PlYzPy$Q-= zGI5;W^@H!jtZtwg4gVQA92l6~L<_t;9E`v3KG@veaO%^{1D_u9Oua5zIia9nms)<( f_Vb@0UYcNd|3n^BL`!VRPLP17tDnm{r-UW|jrNJ< literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_action_unarchive_light.png b/app/src/main/res/drawable-xhdpi/ic_action_unarchive_light.png new file mode 100644 index 0000000000000000000000000000000000000000..a258a9ff0c44481036dfac1141af6591d13aea2a GIT binary patch literal 381 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7T#lEV07_xaSW-r^>*g@ye0>McGIor zFZ>ewq#t9ss?&Yaw>9Fg4@D~I0a@kafw(+&0g`)Yem>#4P=MT}>IHv}j>aCbhi zUXgL?vE%O(R|+&RuqZGvF65jLeCOa*9o8KW{M}z2Uc+M3{#{j3f-(1Dtp|tGf%=E- zUIzLPrhaf%nIU#TwI-f3jr9xXefK6$M(0E2Qxp6e`ai^~%n*8D{AaaLlO=n`U2#SZ z2ZsO5Amc0M@`i1m$Fs9?jv`}v@5LX>P4-I(6rBD1$2ryIoyrb#$7Jg($sadIRY1JY ZF~dG1k1xegR4@}H;OXk;vd$@?2>_)4o!I~Y literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_archive_dark.png b/app/src/main/res/drawable-xxhdpi/ic_action_archive_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..95396077449d21a0cbd0bc6062d598857009b5f7 GIT binary patch literal 593 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>V3P23aSW-r^>&V-_u&8$H|4d? zvMjPXJ9dbcXq9Z7ZL!Px6@P)K%+Wv=*^-TVUC!*{;i7>n!>)X@zxw-uXp=(jr6ni# zTC(r^yRZ6^K4%LXBhX}I@FLAX;*6J>s`#Y7CG$7$n0ZcBdeWw?Pp7LyPr5Fn_b)&0 z&l**4rdgA!Sx?I!J9}%(ra!x$=#}g+KUsDzO~<=Wb^b!jyJt$@o{paq)5>>s>KpH8 z#TKtOJ#qOYI_vt`eG5u|ik@s-B5pNd_sP&=tM@%Au0@iwwm&}~aBU!=R| zRX(PqD}j@?HaB#XPAPe-px`9CG|-wuVsqc6RkAESf$o{t_?XV9NA#aSW-r^>)r_Z>B(z_N`3{ z8G_p~JTk5~-%I_U`@D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)8(aOZ%a2)4^+6{TX4H+f2rdoWhTapO4D%X6? zoATzV2fT;YQkU&$%!bg_L}Sgoyw^d6tE$KfSr05G8H^#Wj8C)K>{Y%I`PT`JB${*h z3_O87#~1HB?}Dua9PpfK`#a%s+|T{UXB4TlKX@Ir9@kQY^NL-k%;Sr*PK>odfeMdr zQ7pvODP;@@QJ{@_O?8rGNX7~k4tOVEIkFuSOo4Td3I~q~HQU*dsRc;T>Q71rk8)jGNymNv`?J!1{)`0 zUrhy!FYkM$@=ZoU2qA07*qoM6N<$ Eg7kCgfdBvi literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_edit_light.png b/app/src/main/res/drawable-xxhdpi/ic_action_edit_light.png new file mode 100644 index 0000000000000000000000000000000000000000..e2a84d81f797bd42f36a04e68bee51c5686031e2 GIT binary patch literal 1647 zcmV-#29WuQP)r;Ai1c=@Pk}sFb?Zvn?The{pGP=@H+3d>^CYVwe8lmW~1oBpk%dk{m`m zAm=6{AI^3Y!qN|L-)dGPz{k9+%s=e;vl2-(279~Daq@arM~&xxqU@X00?7D=VPb-0 zJYaf3l8up(k>@iy>C?)-1(5g@QwK(Ve5C!3d-^@|h3g$k&@p9QHbfug!8aoC-aiOW z-;zc`hjR2@v?LD<3_K1Z$2i&YMI*Sr3-?^|kawSR1R+_sH%+pR8B_j-D9Ilj9DK|s z7G&IkA!cX{Pjobmd)7UEVMy>Phjbp`!PL~$6CmyS@tS zLBxKLw2&YZi;QmEbcDwUSKQe%u6^g+vx@erQolLJGYDdqJw~{})Ppb*?h0Y$VfVSV zyx}v|=z2M%-~|5gIS_C#X^oZ<3GVw+k|kXG%bf``0um%<#U3$~u%@B7a35nlf6^h8 z+J0VgvQ~a)Ldx$LBkXpcFWh&+zK1e~b~U!dTTvp%(&BXxbq?X^Gt!5R#M}}-w+tgZ zZADZ&aP3!j>CyHD9D%Nbj)MF&>$mLH3@@dJfVh{Wlmtf4yiKr~$h9ogD_gQql(n!GbKXShFtEBg1>iNgB=H{6Vm3ph`;j8ZAx-Bd84UR+pJUa53 zS?scGgv98hUC5O`Eez*00L&?v-wM07%Kg~?~>!jKtB|o4PIXNIMwtO00%|D3vaI49; z+Sx+PV2tfqUD~Qqa3|U_Lj2*Ay(GWcxOx^P`8|{!*8uOU?DS58=Aud~bH=${$Y)`0 zROFi_!R^xXzmJN1Rt;p?2AUW7QAIwc=dY>k^Z?_4%1&<$u#fec+aTn;81ufZqS^e$ zm8COy{g%soXn$-G`HQTYE+{sIqd_GhMlJqdgW1Jv>XT-rba6}1pjcU;>_OgVAo(;{-6@#m;j!3 z74814X562GsF{LLF39abU7lcamD`kJ4s2LLcsYecY`{*3qz9N<{zj*xfpd-6$!}I2 zucs}XwTquzm}004Y00-M*`fuv`*+xD*UgUdqVzm_8<5IQ8<-6Zw=+7<1#X-cqN$R~ zPWoAGrOW7ry9^t4X*kbqNZOC9veVjI7X!uc_B?@=%PYb?ze%BNv@p9(LgjR3ozQg7 z?fFW6m(I7{K^JyepzVm2d^zdX$K8V=^Ef2E`Ft7!2L4%PCnx9Y@dFo}@90E<1IW!XV}Ey{M$z5?&Qm4AL&i8>iC#@Ro0j0fy tId4tR##AU23WY+UP$(1%g+kE<{sUm4ZWBi@>}vo3002ovPDHLkV1jq+FrWYc literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_unarchive_dark.png b/app/src/main/res/drawable-xxhdpi/ic_action_unarchive_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..8179a8bd06ee9d3fe39a6c106eca5469bfcf9aa4 GIT binary patch literal 575 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>U}E!haSW-r^>)riFJ?y(SK%ve z8#nYn5O-Pqr&&H>@|H*X5nUPS>SAG&mc-3)n;p{R=`g8Y>i#K~LrQ^@=bqhX{`>%| z=i}MsAM|!OOYs7YMFto8zwcA7oYbTGc~+`S+Utmzn&2Y6nb!(F9`!lA#@Cz4PxU?5 zwEZ4-uV+qux?N?xcl+-tF;{Yq$)0p}JT&`B#P3hvRsSw^KC5#5XJfX->xEA?DkM&r z@A&#txvF_9v+ebt4o0^pK3Qt;d2NdSW9RQdfzSU>(+=fNmE5NL(?CVR-aC47L$&ki z_$Pjo8zwq3D*G~}v9X>p;hYi8!z9qaz@osw$l<^MWHv-`6ex1sXlkhWsIJJzc$MqK zwEJOC?c2`_1T->yzr6a8!a+rabq()tMSiSad@b-5)297woJVqn8h?l|6x+d%+e{78n$Msm&qUuk``dl;+5{?_aVudhsWWt@7&FS2yXm;X&B=aAfbV6Ot) z-4i+*Ryr~Y`!cn$vGSO5zK|5Ta8>1jLe16gsZYOOtt#JYD@<);T3K0RX#PU@G!-aSW-r^>)tLY~e(K_Q_!a zT(%-C{zttH0{BnnZR%{7DY}$g-C41DIhSZvfFm~}^WK|Ye?4-4-7jO?wPDJ#th?pA zjo*JhFkyms+Ox{<+n2~^ngC5l1_#U@fBfON|Gt0K-g}K#_$%uImtUHeWz<5SX-Ri4VGgMAyOJ)U1yht#S%DuAX>9Ych8Xenx`Z28Ba~;zSx7SFfxcl#! zdT0OAXLs|;Z%=7iJ^S6p=BLlUhOTST^)|m3>wfzDW{GnJ?r zGwso}*Jn{+VB~OMU=nCx05QMoJJ`+j+bU4N&s6fU`QU?cF8+IS_dtuS#bm0FnzY`Wk`U}?F;1qRV$2vvUTJh0|wG9Cq zgUe)giU?Sho$668XIj-Yche({SMymT-!LK^+OVJ73GQY?4v))UrXQ{k{+sF6U{d`e z;DEY!_yO;Brnnh`3+{I)`R<>*?7XbbznHB3$L@bBQa-EVId26EJJYvPvAHV~dzQ_U z>Q$C}wE5lfGFfh2BS5;_BGhfpb^c5uG>FVdQ&MBb@0Bb@b A)Bpeg literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/ripple_background.xml b/app/src/main/res/drawable/ripple_background.xml deleted file mode 100644 index 8ed1d1cd1..000000000 --- a/app/src/main/res/drawable/ripple_background.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ripple_transparent.xml b/app/src/main/res/drawable/ripple_transparent.xml new file mode 100644 index 000000000..856240bf1 --- /dev/null +++ b/app/src/main/res/drawable/ripple_transparent.xml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ripple_white.xml b/app/src/main/res/drawable/ripple_white.xml new file mode 100644 index 000000000..cdf2f4fa4 --- /dev/null +++ b/app/src/main/res/drawable/ripple_white.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selected_box.xml b/app/src/main/res/drawable/selected_box.xml new file mode 100644 index 000000000..f311ac13d --- /dev/null +++ b/app/src/main/res/drawable/selected_box.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/edit_habit.xml b/app/src/main/res/layout/edit_habit.xml index ea2e98cf0..ce9baded0 100644 --- a/app/src/main/res/layout/edit_habit.xml +++ b/app/src/main/res/layout/edit_habit.xml @@ -23,7 +23,7 @@ diff --git a/app/src/main/res/layout/list_habits_fragment.xml b/app/src/main/res/layout/list_habits_fragment.xml index d845cccf2..3b4c14306 100644 --- a/app/src/main/res/layout/list_habits_fragment.xml +++ b/app/src/main/res/layout/list_habits_fragment.xml @@ -9,12 +9,9 @@ android:id="@+id/listView" style="@style/habitsListStyle" dslv:drag_enabled="true" - dslv:drag_handle_id="@drawable/habits_header_check" - dslv:drag_start_mode="onMove" - dslv:float_alpha="0.5" + dslv:drag_start_mode="onLongPress" dslv:sort_enabled="true" dslv:track_drag_sort="false" - dslv:use_default_controller="true" /> + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/list_habits_context.xml b/app/src/main/res/menu/list_habits_context.xml index a20bbf2d2..734bd1faf 100644 --- a/app/src/main/res/menu/list_habits_context.xml +++ b/app/src/main/res/menu/list_habits_context.xml @@ -1,19 +1,24 @@ - + - + android:title="@string/edit" + android:icon="@drawable/ic_action_edit_light"/> + + - + android:title="@string/archive" + android:icon="@drawable/ic_action_archive_light" /> - + android:title="@string/unarchive" + android:icon="@drawable/ic_action_unarchive_light"/> \ No newline at end of file diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 8d6354ec2..95a08842c 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -26,7 +26,7 @@ Marcar Limpar Limpar - Selecionar cor + Mudar cor Criar hábito dias Deletar @@ -59,12 +59,12 @@ Correntes Você não tem nenhum hábito ativo - Hábito arquivado. + Hábitos arquivados. Hábito modificado. Hábito restaurado. Hábito criado. Hábito deletado. - Hábito restaurado. + Hábitos restaurados. Nada para refazer. Nada para desfazer. Marcado. diff --git a/app/src/main/res/values-v21/styles_list_habits.xml b/app/src/main/res/values-v21/styles_list_habits.xml index 5714551e1..6ddc019f9 100644 --- a/app/src/main/res/values-v21/styles_list_habits.xml +++ b/app/src/main/res/values-v21/styles_list_habits.xml @@ -7,6 +7,13 @@ + + \ No newline at end of file diff --git a/app/src/main/res/values/keys.xml b/app/src/main/res/values/keys.xml index ffd9e1279..e5568d430 100644 --- a/app/src/main/res/values/keys.xml +++ b/app/src/main/res/values/keys.xml @@ -19,8 +19,8 @@ --> - - - - + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 40b1d2df3..d0d6a5399 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -9,7 +9,7 @@ Archive Unarchive Add habit - Select a Color + Change color Habit created. Habit deleted. @@ -18,8 +18,8 @@ Habit changed. Habit changed back. Repetition toggled. - Habit archived. - Habit unarchived. + Habits archived. + Habits unarchived. Color %1$d Color %1$d selected @@ -102,7 +102,7 @@ Snooze interval Did you know? - To rearrange the entries, you can drag them by the star. + To rearrange the entries, press-and-hold on the name of the habit, then drag it. You can see more days by putting your phone in landscape mode. diff --git a/libs/drag-sort-listview b/libs/drag-sort-listview index 8c9ca51f3..e8905e2c7 160000 --- a/libs/drag-sort-listview +++ b/libs/drag-sort-listview @@ -1 +1 @@ -Subproject commit 8c9ca51f3eb8bee58d91a8d9b763a1bbefa214ef +Subproject commit e8905e2c78d27bc064d03496abea3a0956e49b18