diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ExcludedFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ExcludedFoldersActivity.kt index 8dc1434b7..af0de805f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ExcludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ExcludedFoldersActivity.kt @@ -1,13 +1,12 @@ package com.simplemobiletools.gallery.pro.activities import android.os.Bundle -import android.view.Menu -import android.view.MenuItem import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.extensions.internalStoragePath import com.simplemobiletools.commons.extensions.isExternalStorageManager +import com.simplemobiletools.commons.helpers.NavigationIcon import com.simplemobiletools.commons.helpers.isRPlus import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.gallery.pro.R @@ -20,6 +19,13 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { super.onCreate(savedInstanceState) setContentView(R.layout.activity_manage_folders) updateFolders() + setupOptionsMenu() + manage_folders_toolbar.title = getString(R.string.excluded_folders) + } + + override fun onResume() { + super.onResume() + setupToolbar(manage_folders_toolbar, NavigationIcon.Arrow) } private fun updateFolders() { @@ -41,18 +47,14 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { manage_folders_list.adapter = adapter } - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_add_folder, menu) - updateMenuItemColors(menu) - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - R.id.add_folder -> addFolder() - else -> return super.onOptionsItemSelected(item) + private fun setupOptionsMenu() { + manage_folders_toolbar.setOnMenuItemClickListener { menuItem -> + when (menuItem.itemId) { + R.id.add_folder -> addFolder() + else -> return@setOnMenuItemClickListener false + } + return@setOnMenuItemClickListener true } - return true } override fun refreshItems() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/HiddenFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/HiddenFoldersActivity.kt index 4ad3c1c33..c2597651e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/HiddenFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/HiddenFoldersActivity.kt @@ -1,11 +1,10 @@ package com.simplemobiletools.gallery.pro.activities import android.os.Bundle -import android.view.Menu -import android.view.MenuItem import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.getProperTextColor +import com.simplemobiletools.commons.helpers.NavigationIcon import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.gallery.pro.R @@ -20,6 +19,13 @@ class HiddenFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { super.onCreate(savedInstanceState) setContentView(R.layout.activity_manage_folders) updateFolders() + setupOptionsMenu() + manage_folders_toolbar.title = getString(R.string.hidden_folders) + } + + override fun onResume() { + super.onResume() + setupToolbar(manage_folders_toolbar, NavigationIcon.Arrow) } private fun updateFolders() { @@ -37,18 +43,14 @@ class HiddenFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { } } - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_add_folder, menu) - updateMenuItemColors(menu) - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - R.id.add_folder -> addFolder() - else -> return super.onOptionsItemSelected(item) + private fun setupOptionsMenu() { + manage_folders_toolbar.setOnMenuItemClickListener { menuItem -> + when (menuItem.itemId) { + R.id.add_folder -> addFolder() + else -> return@setOnMenuItemClickListener false + } + return@setOnMenuItemClickListener true } - return true } override fun refreshItems() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/IncludedFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/IncludedFoldersActivity.kt index cc1975ef4..86d0b3fc0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/IncludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/IncludedFoldersActivity.kt @@ -1,10 +1,9 @@ package com.simplemobiletools.gallery.pro.activities import android.os.Bundle -import android.view.Menu -import android.view.MenuItem import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.getProperTextColor +import com.simplemobiletools.commons.helpers.NavigationIcon import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.adapters.ManageFoldersAdapter @@ -16,6 +15,13 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { super.onCreate(savedInstanceState) setContentView(R.layout.activity_manage_folders) updateFolders() + setupOptionsMenu() + manage_folders_toolbar.title = getString(R.string.excluded_folders) + } + + override fun onResume() { + super.onResume() + setupToolbar(manage_folders_toolbar, NavigationIcon.Arrow) } private fun updateFolders() { @@ -31,18 +37,14 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { manage_folders_list.adapter = adapter } - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_add_folder, menu) - updateMenuItemColors(menu) - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - R.id.add_folder -> addFolder() - else -> return super.onOptionsItemSelected(item) + private fun setupOptionsMenu() { + manage_folders_toolbar.setOnMenuItemClickListener { menuItem -> + when (menuItem.itemId) { + R.id.add_folder -> addFolder() + else -> return@setOnMenuItemClickListener false + } + return@setOnMenuItemClickListener true } - return true } override fun refreshItems() { diff --git a/app/src/main/res/layout/activity_manage_folders.xml b/app/src/main/res/layout/activity_manage_folders.xml index e4526f204..231e46d26 100644 --- a/app/src/main/res/layout/activity_manage_folders.xml +++ b/app/src/main/res/layout/activity_manage_folders.xml @@ -1,28 +1,50 @@ - + android:layout_height="match_parent"> - + android:layout_height="wrap_content"> - + + + + + app:layout_behavior="@string/appbar_scrolling_view_behavior"> - + + + + + +