init:added feature clearEntires

pull/2089/head
Ankit Jangid 9 months ago
parent fc9cc423d0
commit 059653ac71

@ -56,6 +56,10 @@ class ShowHabitMenu(
presenter.onExportCSV()
return true
}
R.id.action_clearEntries -> {
presenter.onClearEntries()
return true
}
}
return false
}

@ -43,4 +43,9 @@
android:visible="false"
app:showAsAction="never"/>
<item
android:id="@+id/action_clearEntries"
android:title="@string/clear_entries"
app:showAsAction="never"/>
</menu>

@ -233,4 +233,5 @@
<string name="activity_not_found">No app was found to support this action</string>
<string name="pref_midnight_delay_title">Extend day a few hours past midnight</string>
<string name="pref_midnight_delay_description">Wait until 3:00 AM to show a new day. Useful if you typically go to sleep after midnight. Requires app restart.</string>
<string name="clear_entries">Clear Entries</string>
</resources>

@ -64,6 +64,12 @@ class ShowHabitMenuPresenter(
}
}
fun onClearEntries() {
habit.originalEntries.clear()
habit.recompute()
screen.refresh()
}
fun onRandomize() {
val random = Random()
habit.originalEntries.clear()

Loading…
Cancel
Save