Implement multiple selection and drag on press-and-hold
@@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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<Habit> habits;
|
||||||
|
|
||||||
|
public ArchiveHabitsCommand(Habit habit)
|
||||||
|
{
|
||||||
|
habits = new LinkedList<>();
|
||||||
|
habits.add(habit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArchiveHabitsCommand(List<Habit> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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<Habit> habits;
|
||||||
|
List<Integer> originalColors;
|
||||||
|
Integer newColor;
|
||||||
|
|
||||||
|
public ChangeHabitColorCommand(List<Habit> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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<Habit> habits;
|
||||||
|
|
||||||
|
public UnarchiveHabitsCommand(Habit habit)
|
||||||
|
{
|
||||||
|
habits = new LinkedList<>();
|
||||||
|
habits.add(habit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnarchiveHabitsCommand(List<Habit> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,10 +23,13 @@ import android.app.Fragment;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Point;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.ActionMode;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -47,28 +50,153 @@ import android.widget.LinearLayout.LayoutParams;
|
|||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
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.DragSortController;
|
||||||
import com.mobeta.android.dslv.DragSortListView;
|
import com.mobeta.android.dslv.DragSortListView;
|
||||||
import com.mobeta.android.dslv.DragSortListView.DropListener;
|
import com.mobeta.android.dslv.DragSortListView.DropListener;
|
||||||
|
|
||||||
|
import org.isoron.helpers.ColorHelper;
|
||||||
import org.isoron.helpers.Command;
|
import org.isoron.helpers.Command;
|
||||||
import org.isoron.helpers.DateHelper;
|
import org.isoron.helpers.DateHelper;
|
||||||
import org.isoron.helpers.DialogHelper;
|
import org.isoron.helpers.DialogHelper;
|
||||||
import org.isoron.helpers.DialogHelper.OnSavedListener;
|
import org.isoron.helpers.DialogHelper.OnSavedListener;
|
||||||
import org.isoron.helpers.ReplayableActivity;
|
import org.isoron.helpers.ReplayableActivity;
|
||||||
import org.isoron.uhabits.R;
|
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.helpers.ReminderHelper;
|
||||||
import org.isoron.uhabits.loaders.HabitListLoader;
|
import org.isoron.uhabits.loaders.HabitListLoader;
|
||||||
import org.isoron.uhabits.models.Habit;
|
import org.isoron.uhabits.models.Habit;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ListHabitsFragment extends Fragment
|
public class ListHabitsFragment extends Fragment
|
||||||
implements OnSavedListener, OnItemClickListener, OnLongClickListener, DropListener,
|
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<Habit> 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 = 5;
|
||||||
public static final int HINT_INTERVAL_OFFSET = 2;
|
public static final int HINT_INTERVAL_OFFSET = 2;
|
||||||
@@ -96,6 +224,10 @@ public class ListHabitsFragment extends Fragment
|
|||||||
private boolean showArchived;
|
private boolean showArchived;
|
||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
|
|
||||||
|
private ActionMode actionMode;
|
||||||
|
private List<Integer> selectedPositions;
|
||||||
|
private DragSortController dragSortController;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState)
|
Bundle savedInstanceState)
|
||||||
@@ -119,18 +251,39 @@ public class ListHabitsFragment extends Fragment
|
|||||||
listView = (DragSortListView) view.findViewById(R.id.listView);
|
listView = (DragSortListView) view.findViewById(R.id.listView);
|
||||||
listView.setAdapter(adapter);
|
listView.setAdapter(adapter);
|
||||||
listView.setOnItemClickListener(this);
|
listView.setOnItemClickListener(this);
|
||||||
registerForContextMenu(listView);
|
listView.setOnItemLongClickListener(this);
|
||||||
listView.setDropListener(this);
|
listView.setDropListener(this);
|
||||||
|
listView.setDragListener(new DragSortListView.DragListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void drag(int from, int to)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
DragSortController controller = new DragSortController(listView);
|
@Override
|
||||||
controller.setDragHandleId(R.id.tvStar);
|
public void startDrag(int position)
|
||||||
controller.setRemoveEnabled(false);
|
{
|
||||||
controller.setSortEnabled(true);
|
selectItem(position);
|
||||||
controller.setDragInitMode(1);
|
}
|
||||||
|
});
|
||||||
|
|
||||||
listView.setFloatViewManager(controller);
|
dragSortController = new DragSortController(listView) {
|
||||||
listView.setOnTouchListener(controller);
|
@Override
|
||||||
|
public View onCreateFloatView(int position)
|
||||||
|
{
|
||||||
|
return adapter.getView(position, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyFloatView(View floatView)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
dragSortController.setRemoveEnabled(false);
|
||||||
|
|
||||||
|
listView.setFloatViewManager(dragSortController);
|
||||||
listView.setDragEnabled(true);
|
listView.setDragEnabled(true);
|
||||||
|
listView.setLongClickable(true);
|
||||||
|
|
||||||
llHint = view.findViewById(R.id.llHint);
|
llHint = view.findViewById(R.id.llHint);
|
||||||
llHint.setOnClickListener(this);
|
llHint.setOnClickListener(this);
|
||||||
@@ -143,7 +296,7 @@ public class ListHabitsFragment extends Fragment
|
|||||||
loader.updateAllHabits(true);
|
loader.updateAllHabits(true);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
|
selectedPositions = new LinkedList<>();
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@@ -256,46 +409,52 @@ public class ListHabitsFragment extends Fragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onContextItemSelected(MenuItem menuItem)
|
|
||||||
{
|
|
||||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuItem.getMenuInfo();
|
|
||||||
final Habit habit = loader.habits.get(info.id);
|
|
||||||
|
|
||||||
switch(menuItem.getItemId())
|
|
||||||
{
|
|
||||||
case R.id.action_edit_habit:
|
|
||||||
{
|
|
||||||
EditHabitFragment frag = EditHabitFragment.editSingleHabitFragment(habit.getId());
|
|
||||||
frag.setOnSavedListener(this);
|
|
||||||
frag.show(getFragmentManager(), "dialog");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case R.id.action_archive_habit:
|
|
||||||
{
|
|
||||||
Command c = habit.new ArchiveCommand();
|
|
||||||
executeCommand(c, null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case R.id.action_unarchive_habit:
|
|
||||||
{
|
|
||||||
Command c = habit.new UnarchiveCommand();
|
|
||||||
executeCommand(c, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onContextItemSelected(menuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView parent, View view, int position, long id)
|
public void onItemClick(AdapterView parent, View view, int position, long id)
|
||||||
{
|
{
|
||||||
if (new Date().getTime() - lastLongClick < 1000) return;
|
if (new Date().getTime() - lastLongClick < 1000) return;
|
||||||
|
|
||||||
Habit habit = loader.habitsList.get(position);
|
if(actionMode == null)
|
||||||
habitClickListener.onHabitClicked(habit);
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
if(selectedPositions.isEmpty()) actionMode.finish();
|
||||||
|
else actionMode.invalidate();
|
||||||
|
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id)
|
||||||
|
{
|
||||||
|
selectItem(position);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectItem(int position)
|
||||||
|
{
|
||||||
|
if(!selectedPositions.contains(position))
|
||||||
|
selectedPositions.add(position);
|
||||||
|
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
|
||||||
|
if(actionMode == null)
|
||||||
|
{
|
||||||
|
actionMode = getActivity().startActionMode(new ListHabitsActionBarCallback());
|
||||||
|
// listView.setDragEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(actionMode != null) actionMode.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -308,6 +467,8 @@ public class ListHabitsFragment extends Fragment
|
|||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
|
|
||||||
ReminderHelper.createReminderAlarms(activity);
|
ReminderHelper.createReminderAlarms(activity);
|
||||||
|
|
||||||
|
if(actionMode != null) actionMode.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateEmptyMessage()
|
private void updateEmptyMessage()
|
||||||
@@ -400,6 +561,9 @@ public class ListHabitsFragment extends Fragment
|
|||||||
@Override
|
@Override
|
||||||
public void drop(int from, int to)
|
public void drop(int from, int to)
|
||||||
{
|
{
|
||||||
|
if(from == to) return;
|
||||||
|
if(actionMode != null) actionMode.finish();
|
||||||
|
|
||||||
loader.reorder(from, to);
|
loader.reorder(from, to);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
loader.updateAllHabits(false);
|
loader.updateAllHabits(false);
|
||||||
@@ -457,7 +621,7 @@ public class ListHabitsFragment extends Fragment
|
|||||||
final Habit habit = loader.habitsList.get(position);
|
final Habit habit = loader.habitsList.get(position);
|
||||||
|
|
||||||
if (view == null ||
|
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);
|
view = inflater.inflate(R.layout.list_habits_item, null);
|
||||||
((TextView) view.findViewById(R.id.tvStar)).setTypeface(fontawesome);
|
((TextView) view.findViewById(R.id.tvStar)).setTypeface(fontawesome);
|
||||||
@@ -468,7 +632,7 @@ public class ListHabitsFragment extends Fragment
|
|||||||
|
|
||||||
inflateCheckmarkButtons(view);
|
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));
|
TextView tvStar = ((TextView) view.findViewById(R.id.tvStar));
|
||||||
@@ -481,6 +645,17 @@ public class ListHabitsFragment extends Fragment
|
|||||||
updateNameAndIcon(habit, tvStar, tvName);
|
updateNameAndIcon(habit, tvStar, tvName);
|
||||||
updateCheckmarkButtons(habit, llButtons);
|
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;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,6 +729,7 @@ public class ListHabitsFragment extends Fragment
|
|||||||
{
|
{
|
||||||
int activeColor = habit.color;
|
int activeColor = habit.color;
|
||||||
if(habit.isArchived()) activeColor = INACTIVE_COLOR;
|
if(habit.isArchived()) activeColor = INACTIVE_COLOR;
|
||||||
|
|
||||||
return activeColor;
|
return activeColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,13 +745,13 @@ public class ListHabitsFragment extends Fragment
|
|||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
tvCheck.setText(R.string.fa_check);
|
tvCheck.setText(R.string.fa_check);
|
||||||
tvCheck.setTextColor(INACTIVE_COLOR);
|
tvCheck.setTextColor(INACTIVE_CHECKMARK_COLOR);
|
||||||
tvCheck.setTag(R.string.toggle_key, 1);
|
tvCheck.setTag(R.string.toggle_key, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
tvCheck.setText(R.string.fa_times);
|
tvCheck.setText(R.string.fa_times);
|
||||||
tvCheck.setTextColor(INACTIVE_COLOR);
|
tvCheck.setTextColor(INACTIVE_CHECKMARK_COLOR);
|
||||||
tvCheck.setTag(R.string.toggle_key, 0);
|
tvCheck.setTag(R.string.toggle_key, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,16 +164,22 @@ public class HabitListLoader
|
|||||||
@Override
|
@Override
|
||||||
protected void onPreExecute()
|
protected void onPreExecute()
|
||||||
{
|
{
|
||||||
progressBar.setIndeterminate(false);
|
if(progressBar != null)
|
||||||
progressBar.setProgress(0);
|
{
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setIndeterminate(false);
|
||||||
|
progressBar.setProgress(0);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onProgressUpdate(Integer... values)
|
protected void onProgressUpdate(Integer... values)
|
||||||
{
|
{
|
||||||
progressBar.setMax(values[1]);
|
if(progressBar != null)
|
||||||
progressBar.setProgress(values[0]);
|
{
|
||||||
|
progressBar.setMax(values[1]);
|
||||||
|
progressBar.setProgress(values[0]);
|
||||||
|
}
|
||||||
|
|
||||||
if(listener != null) listener.onLoadFinished();
|
if(listener != null) listener.onLoadFinished();
|
||||||
}
|
}
|
||||||
@@ -183,7 +189,7 @@ public class HabitListLoader
|
|||||||
{
|
{
|
||||||
if (isCancelled()) return;
|
if (isCancelled()) return;
|
||||||
|
|
||||||
progressBar.setVisibility(View.INVISIBLE);
|
if(progressBar != null) progressBar.setVisibility(View.INVISIBLE);
|
||||||
lastLoadTimestamp = DateHelper.getStartOfToday();
|
lastLoadTimestamp = DateHelper.getStartOfToday();
|
||||||
currentFetchTask = null;
|
currentFetchTask = null;
|
||||||
|
|
||||||
@@ -223,8 +229,11 @@ public class HabitListLoader
|
|||||||
{
|
{
|
||||||
if (getStatus() == Status.RUNNING)
|
if (getStatus() == Status.RUNNING)
|
||||||
{
|
{
|
||||||
progressBar.setIndeterminate(true);
|
if(progressBar != null)
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
{
|
||||||
|
progressBar.setIndeterminate(true);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
@@ -233,7 +242,7 @@ public class HabitListLoader
|
|||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void aVoid)
|
protected void onPostExecute(Void aVoid)
|
||||||
{
|
{
|
||||||
progressBar.setVisibility(View.GONE);
|
if(progressBar != null) progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
if(listener != null)
|
if(listener != null)
|
||||||
listener.onLoadFinished();
|
listener.onLoadFinished();
|
||||||
|
|||||||
@@ -696,54 +696,4 @@ public class Habit extends Model
|
|||||||
execute();
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
app/src/main/res/drawable-hdpi/ic_action_archive_dark.png
Normal file
|
After Width: | Height: | Size: 338 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_archive_light.png
Normal file
|
After Width: | Height: | Size: 393 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_color_dark.png
Normal file
|
After Width: | Height: | Size: 492 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_color_light.png
Normal file
|
After Width: | Height: | Size: 563 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_edit_light.png
Normal file
|
After Width: | Height: | Size: 822 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_unarchive_dark.png
Normal file
|
After Width: | Height: | Size: 337 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_unarchive_light.png
Normal file
|
After Width: | Height: | Size: 410 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_archive_dark.png
Normal file
|
After Width: | Height: | Size: 214 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_archive_light.png
Normal file
|
After Width: | Height: | Size: 244 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_color_dark.png
Normal file
|
After Width: | Height: | Size: 289 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_color_light.png
Normal file
|
After Width: | Height: | Size: 319 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_edit_light.png
Normal file
|
After Width: | Height: | Size: 554 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_unarchive_dark.png
Normal file
|
After Width: | Height: | Size: 207 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_unarchive_light.png
Normal file
|
After Width: | Height: | Size: 243 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_archive_dark.png
Normal file
|
After Width: | Height: | Size: 338 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_archive_light.png
Normal file
|
After Width: | Height: | Size: 390 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_color_dark.png
Normal file
|
After Width: | Height: | Size: 541 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_color_light.png
Normal file
|
After Width: | Height: | Size: 602 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_edit_light.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_action_unarchive_dark.png
Normal file
|
After Width: | Height: | Size: 337 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_unarchive_light.png
Normal file
|
After Width: | Height: | Size: 381 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_archive_dark.png
Normal file
|
After Width: | Height: | Size: 593 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_archive_light.png
Normal file
|
After Width: | Height: | Size: 674 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_color_dark.png
Normal file
|
After Width: | Height: | Size: 922 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_color_light.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_edit_light.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_unarchive_dark.png
Normal file
|
After Width: | Height: | Size: 575 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_unarchive_light.png
Normal file
|
After Width: | Height: | Size: 683 B |
@@ -1,6 +0,0 @@
|
|||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:color="@color/grey"> <!-- ripple color -->
|
|
||||||
|
|
||||||
<item android:drawable="@color/white"/> <!-- normal color -->
|
|
||||||
|
|
||||||
</ripple>
|
|
||||||
8
app/src/main/res/drawable/ripple_transparent.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:color="?android:colorControlHighlight">
|
||||||
|
|
||||||
|
<item android:id="@android:id/mask">
|
||||||
|
<color android:color="@android:color/white" />
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</ripple>
|
||||||
5
app/src/main/res/drawable/ripple_white.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:color="?android:colorControlHighlight">
|
||||||
|
|
||||||
|
<item android:drawable="@color/white" />
|
||||||
|
</ripple>
|
||||||
5
app/src/main/res/drawable/selected_box.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||||
|
<solid android:color="@color/grey_100" />
|
||||||
|
<stroke android:width="2dip" android:color="@color/grey_500"/>
|
||||||
|
</shape>
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/buttonPickColor"
|
android:id="@+id/buttonPickColor"
|
||||||
android:src="@drawable/ic_action_pick_color"
|
android:src="@drawable/ic_action_color_light"
|
||||||
style="@style/dialogFormInputColor" />
|
style="@style/dialogFormInputColor" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,9 @@
|
|||||||
android:id="@+id/listView"
|
android:id="@+id/listView"
|
||||||
style="@style/habitsListStyle"
|
style="@style/habitsListStyle"
|
||||||
dslv:drag_enabled="true"
|
dslv:drag_enabled="true"
|
||||||
dslv:drag_handle_id="@drawable/habits_header_check"
|
dslv:drag_start_mode="onLongPress"
|
||||||
dslv:drag_start_mode="onMove"
|
|
||||||
dslv:float_alpha="0.5"
|
|
||||||
dslv:sort_enabled="true"
|
dslv:sort_enabled="true"
|
||||||
dslv:track_drag_sort="false"
|
dslv:track_drag_sort="false"
|
||||||
dslv:use_default_controller="true"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|||||||
24
app/src/main/res/menu-v21/list_habits_context.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_edit_habit"
|
||||||
|
android:title="@string/edit"
|
||||||
|
android:icon="@drawable/ic_action_edit_dark"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_color"
|
||||||
|
android:title="@string/color_picker_default_title"
|
||||||
|
android:icon="@drawable/ic_action_color_dark"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_archive_habit"
|
||||||
|
android:title="@string/archive"
|
||||||
|
android:icon="@drawable/ic_action_archive_dark" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_unarchive_habit"
|
||||||
|
android:title="@string/unarchive"
|
||||||
|
android:icon="@drawable/ic_action_unarchive_dark"/>
|
||||||
|
|
||||||
|
</menu>
|
||||||
@@ -1,19 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_edit_habit"
|
android:id="@+id/action_edit_habit"
|
||||||
android:title="@string/edit">
|
android:title="@string/edit"
|
||||||
</item>
|
android:icon="@drawable/ic_action_edit_light"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_color"
|
||||||
|
android:title="@string/color_picker_default_title"
|
||||||
|
android:icon="@drawable/ic_action_color_light"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_archive_habit"
|
android:id="@+id/action_archive_habit"
|
||||||
android:title="@string/archive">
|
android:title="@string/archive"
|
||||||
</item>
|
android:icon="@drawable/ic_action_archive_light" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_unarchive_habit"
|
android:id="@+id/action_unarchive_habit"
|
||||||
android:title="@string/unarchive">
|
android:title="@string/unarchive"
|
||||||
</item>
|
android:icon="@drawable/ic_action_unarchive_light"/>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<string name="check">Marcar</string>
|
<string name="check">Marcar</string>
|
||||||
<string name="clear">Limpar</string>
|
<string name="clear">Limpar</string>
|
||||||
<string name="clear_label">Limpar</string>
|
<string name="clear_label">Limpar</string>
|
||||||
<string name="color_picker_default_title">Selecionar cor</string>
|
<string name="color_picker_default_title">Mudar cor</string>
|
||||||
<string name="create_habit">Criar hábito</string>
|
<string name="create_habit">Criar hábito</string>
|
||||||
<string name="days">dias</string>
|
<string name="days">dias</string>
|
||||||
<string name="delete">Deletar</string>
|
<string name="delete">Deletar</string>
|
||||||
@@ -59,12 +59,12 @@
|
|||||||
<string name="streaks">Correntes</string>
|
<string name="streaks">Correntes</string>
|
||||||
<string name="no_habits_found">Você não tem nenhum hábito ativo</string>
|
<string name="no_habits_found">Você não tem nenhum hábito ativo</string>
|
||||||
<string name="time_separator"></string>
|
<string name="time_separator"></string>
|
||||||
<string name="toast_habit_archived">Hábito arquivado.</string>
|
<string name="toast_habit_archived">Hábitos arquivados.</string>
|
||||||
<string name="toast_habit_changed">Hábito modificado.</string>
|
<string name="toast_habit_changed">Hábito modificado.</string>
|
||||||
<string name="toast_habit_changed_back">Hábito restaurado.</string>
|
<string name="toast_habit_changed_back">Hábito restaurado.</string>
|
||||||
<string name="toast_habit_created">Hábito criado.</string>
|
<string name="toast_habit_created">Hábito criado.</string>
|
||||||
<string name="toast_habit_deleted">Hábito deletado.</string>
|
<string name="toast_habit_deleted">Hábito deletado.</string>
|
||||||
<string name="toast_habit_unarchived">Hábito restaurado.</string>
|
<string name="toast_habit_unarchived">Hábitos restaurados.</string>
|
||||||
<string name="toast_nothing_to_redo">Nada para refazer.</string>
|
<string name="toast_nothing_to_redo">Nada para refazer.</string>
|
||||||
<string name="toast_nothing_to_undo">Nada para desfazer.</string>
|
<string name="toast_nothing_to_undo">Nada para desfazer.</string>
|
||||||
<string name="toast_repetition_toggled">Marcado.</string>
|
<string name="toast_repetition_toggled">Marcado.</string>
|
||||||
|
|||||||
@@ -7,6 +7,13 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="habitsListCheckStyle" parent="habitsListCheckBasicStyle">
|
<style name="habitsListCheckStyle" parent="habitsListCheckBasicStyle">
|
||||||
<item name="android:background">@drawable/ripple_background</item>
|
<item name="android:background">@drawable/ripple_transparent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="habitsListItemInnerPanelStyle" parent="cardStyle">
|
||||||
|
<item name="android:orientation">horizontal</item>
|
||||||
|
<item name="android:padding">3dp</item>
|
||||||
|
<item name="android:background">@drawable/ripple_white</item>
|
||||||
|
<item name="android:elevation">1dp</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
<string name="habit_key" translatable="false"></string>
|
<string name="habit_key" translatable="false" />
|
||||||
<string name="offset_key" translatable="false"></string>
|
<string name="offset_key" translatable="false" />
|
||||||
<string name="toggle_key" translatable="false"></string>
|
<string name="toggle_key" translatable="false" />
|
||||||
<item name="KEY_TIMESTAMP" type="id"/>
|
<item name="timestamp_key" type="id"/>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<string name="archive">Archive</string>
|
<string name="archive">Archive</string>
|
||||||
<string name="unarchive">Unarchive</string>
|
<string name="unarchive">Unarchive</string>
|
||||||
<string name="add_habit">Add habit</string>
|
<string name="add_habit">Add habit</string>
|
||||||
<string name="color_picker_default_title">Select a Color</string>
|
<string name="color_picker_default_title">Change color</string>
|
||||||
|
|
||||||
<string name="toast_habit_created">Habit created.</string>
|
<string name="toast_habit_created">Habit created.</string>
|
||||||
<string name="toast_habit_deleted">Habit deleted.</string>
|
<string name="toast_habit_deleted">Habit deleted.</string>
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
<string name="toast_habit_changed">Habit changed.</string>
|
<string name="toast_habit_changed">Habit changed.</string>
|
||||||
<string name="toast_habit_changed_back">Habit changed back.</string>
|
<string name="toast_habit_changed_back">Habit changed back.</string>
|
||||||
<string name="toast_repetition_toggled">Repetition toggled.</string>
|
<string name="toast_repetition_toggled">Repetition toggled.</string>
|
||||||
<string name="toast_habit_archived">Habit archived.</string>
|
<string name="toast_habit_archived">Habits archived.</string>
|
||||||
<string name="toast_habit_unarchived">Habit unarchived.</string>
|
<string name="toast_habit_unarchived">Habits unarchived.</string>
|
||||||
|
|
||||||
<string name="color_swatch_description">Color <xliff:g id="color_index" example="14">%1$d</xliff:g></string>
|
<string name="color_swatch_description">Color <xliff:g id="color_index" example="14">%1$d</xliff:g></string>
|
||||||
<string name="color_swatch_description_selected">Color <xliff:g id="color_index" example="14">%1$d</xliff:g> selected</string>
|
<string name="color_swatch_description_selected">Color <xliff:g id="color_index" example="14">%1$d</xliff:g> selected</string>
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
<string name="snooze_interval">Snooze interval</string>
|
<string name="snooze_interval">Snooze interval</string>
|
||||||
|
|
||||||
<string name="hint_title">Did you know?</string>
|
<string name="hint_title">Did you know?</string>
|
||||||
<string name="hint_drag">To rearrange the entries, you can drag them by the star.</string>
|
<string name="hint_drag">To rearrange the entries, press-and-hold on the name of the habit, then drag it.</string>
|
||||||
<string name="hint_landscape">You can see more days by putting your phone in landscape mode.</string>
|
<string name="hint_landscape">You can see more days by putting your phone in landscape mode.</string>
|
||||||
|
|
||||||
<string-array name="hints">
|
<string-array name="hints">
|
||||||
|
|||||||