|
|
@ -260,22 +260,23 @@ public class ListHabitsFragment extends Fragment
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onLongClick(View v)
|
|
|
|
public boolean onLongClick(View v)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int id = v.getId();
|
|
|
|
switch(v.getId())
|
|
|
|
|
|
|
|
|
|
|
|
if (id == R.id.tvCheck)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
lastLongClick = new Date().getTime();
|
|
|
|
case R.id.tvCheck:
|
|
|
|
Habit habit = Habit.get((Long) v.getTag(R.string.habit_key));
|
|
|
|
{
|
|
|
|
int offset = (Integer) v.getTag(R.string.offset_key);
|
|
|
|
lastLongClick = new Date().getTime();
|
|
|
|
long timestamp = DateHelper.getStartOfDay(
|
|
|
|
Habit habit = Habit.get((Long) v.getTag(R.string.habit_key));
|
|
|
|
DateHelper.getLocalTime() - offset * DateHelper.millisecondsInOneDay);
|
|
|
|
int offset = (Integer) v.getTag(R.string.offset_key);
|
|
|
|
|
|
|
|
long timestamp = DateHelper.getStartOfDay(
|
|
|
|
|
|
|
|
DateHelper.getLocalTime() - offset * DateHelper.millisecondsInOneDay);
|
|
|
|
|
|
|
|
|
|
|
|
executeCommand(habit.new ToggleRepetitionCommand(timestamp));
|
|
|
|
executeCommand(habit.new ToggleRepetitionCommand(timestamp));
|
|
|
|
|
|
|
|
|
|
|
|
Vibrator vb = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
|
|
|
Vibrator vb = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
|
|
|
vb.vibrate(100);
|
|
|
|
vb.vibrate(100);
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -296,6 +297,12 @@ public class ListHabitsFragment extends Fragment
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View v)
|
|
|
|
public void onClick(View v)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
switch(v.getId())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case R.id.tvCheck:
|
|
|
|
|
|
|
|
activity.showToast(R.string.long_press_to_toggle);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class ListHabitsAdapter extends BaseAdapter
|
|
|
|
class ListHabitsAdapter extends BaseAdapter
|
|
|
@ -356,6 +363,7 @@ public class ListHabitsFragment extends Fragment
|
|
|
|
TextView btCheck = (TextView) check.findViewById(R.id.tvCheck);
|
|
|
|
TextView btCheck = (TextView) check.findViewById(R.id.tvCheck);
|
|
|
|
btCheck.setTypeface(fontawesome);
|
|
|
|
btCheck.setTypeface(fontawesome);
|
|
|
|
btCheck.setOnLongClickListener(ListHabitsFragment.this);
|
|
|
|
btCheck.setOnLongClickListener(ListHabitsFragment.this);
|
|
|
|
|
|
|
|
btCheck.setOnClickListener(ListHabitsFragment.this);
|
|
|
|
((LinearLayout) view.findViewById(R.id.llButtons)).addView(check);
|
|
|
|
((LinearLayout) view.findViewById(R.id.llButtons)).addView(check);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|