mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Display toast when user does not long press
This commit is contained in:
@@ -260,9 +260,9 @@ public class ListHabitsFragment extends Fragment
|
||||
@Override
|
||||
public boolean onLongClick(View v)
|
||||
{
|
||||
int id = v.getId();
|
||||
|
||||
if (id == R.id.tvCheck)
|
||||
switch(v.getId())
|
||||
{
|
||||
case R.id.tvCheck:
|
||||
{
|
||||
lastLongClick = new Date().getTime();
|
||||
Habit habit = Habit.get((Long) v.getTag(R.string.habit_key));
|
||||
@@ -277,6 +277,7 @@ public class ListHabitsFragment extends Fragment
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -296,6 +297,12 @@ public class ListHabitsFragment extends Fragment
|
||||
@Override
|
||||
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
|
||||
@@ -356,6 +363,7 @@ public class ListHabitsFragment extends Fragment
|
||||
TextView btCheck = (TextView) check.findViewById(R.id.tvCheck);
|
||||
btCheck.setTypeface(fontawesome);
|
||||
btCheck.setOnLongClickListener(ListHabitsFragment.this);
|
||||
btCheck.setOnClickListener(ListHabitsFragment.this);
|
||||
((LinearLayout) view.findViewById(R.id.llButtons)).addView(check);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,5 +62,6 @@
|
||||
<string name="save">Save</string>
|
||||
<string name="streaks">Streaks</string>
|
||||
<string name="no_habits_found">You have no active habits</string>
|
||||
<string name="long_press_to_toggle">Long press to check or uncheck</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user