mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Merge branch 'archiveFromStatisticsPage' into dev
This commit is contained in:
@@ -203,7 +203,8 @@ class ShowHabitActivity : AppCompatActivity(), CommandRunner.Listener {
|
||||
}
|
||||
|
||||
private fun getPopupAnchor(): View? {
|
||||
val dialog = supportFragmentManager.findFragmentByTag("historyEditor") as HistoryEditorDialog?
|
||||
val dialog =
|
||||
supportFragmentManager.findFragmentByTag("historyEditor") as HistoryEditorDialog?
|
||||
return dialog?.dataView
|
||||
}
|
||||
|
||||
@@ -216,6 +217,25 @@ class ShowHabitActivity : AppCompatActivity(), CommandRunner.Listener {
|
||||
ShowHabitMenuPresenter.Message.COULD_NOT_EXPORT -> {
|
||||
showMessage(resources.getString(R.string.could_not_export))
|
||||
}
|
||||
|
||||
ShowHabitMenuPresenter.Message.HABIT_ARCHIVED -> {
|
||||
showMessage(
|
||||
resources.getQuantityString(
|
||||
R.plurals.toast_habits_archived,
|
||||
1
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
ShowHabitMenuPresenter.Message.HABIT_UNARCHIVED -> {
|
||||
showMessage(
|
||||
resources.getQuantityString(
|
||||
R.plurals.toast_habits_unarchived,
|
||||
1
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ class ShowHabitMenu(
|
||||
if (preferences.isDeveloper) {
|
||||
menu.findItem(R.id.action_randomize).isVisible = true
|
||||
}
|
||||
menu.findItem(R.id.action_archive_habit).isVisible = presenter.canArchive()
|
||||
menu.findItem(R.id.action_unarchive_habit).isVisible = presenter.canUnarchive()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -44,6 +47,15 @@ class ShowHabitMenu(
|
||||
presenter.onEditHabit()
|
||||
return true
|
||||
}
|
||||
R.id.action_archive_habit -> {
|
||||
presenter.onArchiveHabits()
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.action_unarchive_habit -> {
|
||||
presenter.onUnarchiveHabits()
|
||||
return true
|
||||
}
|
||||
R.id.action_delete -> {
|
||||
presenter.onDeleteHabit()
|
||||
return true
|
||||
|
||||
@@ -26,6 +26,16 @@
|
||||
android:title="@string/export"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_archive_habit"
|
||||
android:title="@string/archive"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_unarchive_habit"
|
||||
android:title="@string/unarchive"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_delete"
|
||||
android:title="@string/delete"
|
||||
|
||||
Reference in New Issue
Block a user