add menu items for adding and removing favorites
This commit is contained in:
parent
600613b88d
commit
afd0411ee9
|
@ -106,6 +106,8 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.go_home -> goHome()
|
R.id.go_home -> goHome()
|
||||||
|
R.id.add_favorite -> addFavorite()
|
||||||
|
R.id.remove_favorite -> removeFavorite()
|
||||||
R.id.set_as_home -> setAsHome()
|
R.id.set_as_home -> setAsHome()
|
||||||
R.id.settings -> startActivity(Intent(this, SettingsActivity::class.java))
|
R.id.settings -> startActivity(Intent(this, SettingsActivity::class.java))
|
||||||
R.id.about -> launchAbout()
|
R.id.about -> launchAbout()
|
||||||
|
@ -118,6 +120,14 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
|
||||||
openPath(config.homeFolder)
|
openPath(config.homeFolder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun addFavorite() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun removeFavorite() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private fun setAsHome() {
|
private fun setAsHome() {
|
||||||
config.homeFolder = getCurrenPath()
|
config.homeFolder = getCurrenPath()
|
||||||
toast(R.string.home_folder_updated)
|
toast(R.string.home_folder_updated)
|
||||||
|
|
|
@ -6,6 +6,16 @@
|
||||||
android:icon="@drawable/ic_home"
|
android:icon="@drawable/ic_home"
|
||||||
android:title="@string/go_to_home_folder"
|
android:title="@string/go_to_home_folder"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/add_favorite"
|
||||||
|
android:icon="@drawable/ic_star_off"
|
||||||
|
android:title="@string/add_to_favorites"
|
||||||
|
app:showAsAction="ifRoom"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/remove_favorite"
|
||||||
|
android:icon="@drawable/ic_star_on"
|
||||||
|
android:title="@string/remove_from_favorites"
|
||||||
|
app:showAsAction="ifRoom"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/set_as_home"
|
android:id="@+id/set_as_home"
|
||||||
android:title="@string/set_as_home_folder"
|
android:title="@string/set_as_home_folder"
|
||||||
|
|
Loading…
Reference in New Issue