From a3777d0f73d34afe11be8fab3c2623e59081a38b Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 17 Mar 2017 23:12:23 +0100 Subject: [PATCH] list the included folders at the manager screen --- .../activities/ExcludedFoldersActivity.kt | 8 +++--- .../activities/IncludedFoldersActivity.kt | 26 +++++++++++++++++++ ...uded_folder.xml => item_manage_folder.xml} | 10 +++---- 3 files changed, 35 insertions(+), 9 deletions(-) rename app/src/main/res/layout/{item_excluded_folder.xml => item_manage_folder.xml} (78%) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt index 2043f6435..c5e4d09c5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt @@ -8,7 +8,7 @@ import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.config 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() { override fun onCreate(savedInstanceState: Bundle?) { @@ -21,12 +21,12 @@ class ExcludedFoldersActivity : SimpleActivity() { excluded_folders_holder.removeAllViews() val folders = config.excludedFolders for (folder in folders) { - layoutInflater.inflate(R.layout.item_excluded_folder, null, false).apply { - excluded_folder_title.apply { + layoutInflater.inflate(R.layout.item_manage_folder, null, false).apply { + managed_folder_title.apply { text = folder setTextColor(config.textColor) } - excluded_folders_icon.apply { + managed_folders_icon.apply { setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN) alpha = 0.7f setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt index 5103a6d8e..c1c2902ea 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt @@ -1,16 +1,42 @@ package com.simplemobiletools.gallery.activities +import android.graphics.PorterDuff import android.os.Bundle import android.view.Menu import android.view.MenuItem import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.gallery.R 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() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) 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 { diff --git a/app/src/main/res/layout/item_excluded_folder.xml b/app/src/main/res/layout/item_manage_folder.xml similarity index 78% rename from app/src/main/res/layout/item_excluded_folder.xml rename to app/src/main/res/layout/item_manage_folder.xml index 8efeb10b5..9d60dab8f 100644 --- a/app/src/main/res/layout/item_excluded_folder.xml +++ b/app/src/main/res/layout/item_manage_folder.xml @@ -1,23 +1,23 @@ + android:layout_toLeftOf="@+id/managed_folders_icon" + android:layout_toStartOf="@+id/managed_folders_icon"/>