mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Show color button even for a single habit
This commit is contained in:
@@ -111,17 +111,13 @@ public class HabitSelectionCallback implements ActionMode.Callback
|
|||||||
private void updateActions(Menu menu)
|
private void updateActions(Menu menu)
|
||||||
{
|
{
|
||||||
boolean showEdit = (selectedPositions.size() == 1);
|
boolean showEdit = (selectedPositions.size() == 1);
|
||||||
boolean showColor = true;
|
|
||||||
boolean showArchive = true;
|
boolean showArchive = true;
|
||||||
boolean showUnarchive = true;
|
boolean showUnarchive = true;
|
||||||
|
|
||||||
if (showEdit) showColor = false;
|
|
||||||
for (int i : selectedPositions)
|
for (int i : selectedPositions)
|
||||||
{
|
{
|
||||||
Habit h = loader.habitsList.get(i);
|
Habit h = loader.habitsList.get(i);
|
||||||
if (h.isArchived())
|
if (h.isArchived())
|
||||||
{
|
{
|
||||||
showColor = false;
|
|
||||||
showArchive = false;
|
showArchive = false;
|
||||||
}
|
}
|
||||||
else showUnarchive = false;
|
else showUnarchive = false;
|
||||||
@@ -132,8 +128,8 @@ public class HabitSelectionCallback implements ActionMode.Callback
|
|||||||
MenuItem itemArchive = menu.findItem(R.id.action_archive_habit);
|
MenuItem itemArchive = menu.findItem(R.id.action_archive_habit);
|
||||||
MenuItem itemUnarchive = menu.findItem(R.id.action_unarchive_habit);
|
MenuItem itemUnarchive = menu.findItem(R.id.action_unarchive_habit);
|
||||||
|
|
||||||
|
itemColor.setVisible(true);
|
||||||
itemEdit.setVisible(showEdit);
|
itemEdit.setVisible(showEdit);
|
||||||
itemColor.setVisible(showColor);
|
|
||||||
itemArchive.setVisible(showArchive);
|
itemArchive.setVisible(showArchive);
|
||||||
itemUnarchive.setVisible(showUnarchive);
|
itemUnarchive.setVisible(showUnarchive);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user