list the included folders at the manager screen

This commit is contained in:
tibbi 2017-03-17 23:12:23 +01:00
parent ff1f29b1f8
commit a3777d0f73
3 changed files with 35 additions and 9 deletions

View file

@ -8,7 +8,7 @@ import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.config
import kotlinx.android.synthetic.main.activity_excluded_folders.* import kotlinx.android.synthetic.main.activity_excluded_folders.*
import kotlinx.android.synthetic.main.item_excluded_folder.view.* import kotlinx.android.synthetic.main.item_manage_folder.view.*
class ExcludedFoldersActivity : SimpleActivity() { class ExcludedFoldersActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -21,12 +21,12 @@ class ExcludedFoldersActivity : SimpleActivity() {
excluded_folders_holder.removeAllViews() excluded_folders_holder.removeAllViews()
val folders = config.excludedFolders val folders = config.excludedFolders
for (folder in folders) { for (folder in folders) {
layoutInflater.inflate(R.layout.item_excluded_folder, null, false).apply { layoutInflater.inflate(R.layout.item_manage_folder, null, false).apply {
excluded_folder_title.apply { managed_folder_title.apply {
text = folder text = folder
setTextColor(config.textColor) setTextColor(config.textColor)
} }
excluded_folders_icon.apply { managed_folders_icon.apply {
setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN) setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN)
alpha = 0.7f alpha = 0.7f
setOnClickListener { setOnClickListener {

View file

@ -1,16 +1,42 @@
package com.simplemobiletools.gallery.activities package com.simplemobiletools.gallery.activities
import android.graphics.PorterDuff
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.config
import kotlinx.android.synthetic.main.activity_included_folders.*
import kotlinx.android.synthetic.main.item_manage_folder.view.*
class IncludedFoldersActivity : SimpleActivity() { class IncludedFoldersActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_included_folders) setContentView(R.layout.activity_included_folders)
updateIncludedFolders()
}
private fun updateIncludedFolders() {
included_folders_holder.removeAllViews()
val folders = config.includedFolders
for (folder in folders) {
layoutInflater.inflate(R.layout.item_manage_folder, null, false).apply {
managed_folder_title.apply {
text = folder
setTextColor(config.textColor)
}
managed_folders_icon.apply {
setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN)
alpha = 0.7f
setOnClickListener {
config.removeIncludedFolder(folder)
updateIncludedFolders()
}
}
included_folders_holder.addView(this)
}
}
} }
override fun onCreateOptionsMenu(menu: Menu?): Boolean { override fun onCreateOptionsMenu(menu: Menu?): Boolean {

View file

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/excluded_folder_holder" android:id="@+id/managed_folder_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/activity_margin"> android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/excluded_folder_title" android:id="@+id/managed_folder_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/medium_margin" android:layout_marginLeft="@dimen/medium_margin"
android:layout_marginRight="@dimen/medium_margin" android:layout_marginRight="@dimen/medium_margin"
android:layout_toLeftOf="@+id/excluded_folders_icon" android:layout_toLeftOf="@+id/managed_folders_icon"
android:layout_toStartOf="@+id/excluded_folders_icon"/> android:layout_toStartOf="@+id/managed_folders_icon"/>
<com.simplemobiletools.gallery.views.MyImageView <com.simplemobiletools.gallery.views.MyImageView
android:id="@+id/excluded_folders_icon" android:id="@+id/managed_folders_icon"
style="@style/MyBorderlessBackgroundStyle" style="@style/MyBorderlessBackgroundStyle"
android:layout_width="@dimen/exclude_folder_img_size" android:layout_width="@dimen/exclude_folder_img_size"
android:layout_height="@dimen/exclude_folder_img_size" android:layout_height="@dimen/exclude_folder_img_size"