updating manage included/excluded/hidden folders

This commit is contained in:
tibbi 2022-07-27 12:56:14 +02:00
parent b798dac213
commit aa3a9fdc88
4 changed files with 86 additions and 58 deletions

View file

@ -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() {

View file

@ -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() {

View file

@ -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() {

View file

@ -1,28 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/manage_folders_wrapper"
android:id="@+id/manage_folders_coordinator"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/manage_folders_list"
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/manage_folders_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbars="vertical"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/>
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/manage_folders_placeholder"
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/manage_folders_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:menu="@menu/menu_add_folder"
app:title=""
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout
android:id="@+id/manage_folders_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingLeft="@dimen/big_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/big_margin"
android:text="@string/excluded_activity_placeholder"
android:visibility="gone"/>
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</RelativeLayout>
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/manage_folders_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbars="vertical"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/manage_folders_placeholder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingLeft="@dimen/big_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/big_margin"
android:text="@string/excluded_activity_placeholder"
android:visibility="gone" />
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>