mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-14 21:18:51 -06:00
Implement option to remove sub habits from groups
This commit is contained in:
@@ -300,7 +300,7 @@ class EditHabitActivity : AppCompatActivity() {
|
||||
habit.unit = binding.unitInput.text.trim().toString()
|
||||
}
|
||||
habit.type = habitType
|
||||
habit.parent = parentGroup
|
||||
habit.group = parentGroup
|
||||
habit.groupId = parentGroup?.id
|
||||
habit.groupUUID = parentGroup?.uuid
|
||||
|
||||
|
||||
@@ -75,12 +75,14 @@ class ListHabitsSelectionMenu @Inject constructor(
|
||||
val itemColor = menu.findItem(R.id.action_color)
|
||||
val itemArchive = menu.findItem(R.id.action_archive_habit)
|
||||
val itemUnarchive = menu.findItem(R.id.action_unarchive_habit)
|
||||
val itemRemoveFromGroup = menu.findItem(R.id.action_remove_from_group)
|
||||
val itemNotify = menu.findItem(R.id.action_notify)
|
||||
|
||||
itemColor.isVisible = true
|
||||
itemEdit.isVisible = behavior.canEdit()
|
||||
itemArchive.isVisible = behavior.canArchive()
|
||||
itemUnarchive.isVisible = behavior.canUnarchive()
|
||||
itemRemoveFromGroup.isVisible = behavior.areSubHabits()
|
||||
itemNotify.isVisible = prefs.isDeveloper
|
||||
activeActionMode?.title = (listAdapter.selectedHabits.size + listAdapter.selectedHabitGroups.size).toString()
|
||||
return true
|
||||
@@ -106,6 +108,11 @@ class ListHabitsSelectionMenu @Inject constructor(
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.action_remove_from_group -> {
|
||||
behavior.onRemoveFromGroup()
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.action_delete -> {
|
||||
behavior.onDeleteHabits()
|
||||
return true
|
||||
|
||||
@@ -97,7 +97,6 @@ class HabitCardView(
|
||||
set(value) {
|
||||
scoreRing.setPercentage(value.toFloat())
|
||||
scoreRing.setPrecision(1.0f / 16)
|
||||
// behavior.onChangeScore(habit!!)
|
||||
}
|
||||
|
||||
var unit
|
||||
|
||||
@@ -41,6 +41,11 @@
|
||||
android:title="@string/unarchive"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_remove_from_group"
|
||||
android:title="@string/remove_from_group"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_delete"
|
||||
android:title="@string/delete"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<string name="delete">Delete</string>
|
||||
<string name="archive">Archive</string>
|
||||
<string name="unarchive">Unarchive</string>
|
||||
<string name="remove_from_group">Remove from group</string>
|
||||
<string name="add_habit">Add habit</string>
|
||||
<string name="color_picker_default_title">Change color</string>
|
||||
<string name="toast_habit_created">Habit created</string>
|
||||
|
||||
Reference in New Issue
Block a user