From 565e44667c44be74586793dbe32f64a36eb80999 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 6 Dec 2017 21:54:36 +0100 Subject: [PATCH] add an info bubble at the fastscroller --- app/build.gradle | 2 +- .../activities/SettingsActivity.kt | 9 +++++++++ .../filemanager/fragments/ItemsFragment.kt | 17 +++++++++++----- app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ app/src/main/res/layout/items_fragment.xml | 9 ++------- 5 files changed, 44 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 223e77f7..5e67c0c0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,7 +42,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.2.1' + implementation 'com.simplemobiletools:commons:3.2.2' implementation files('../libs/RootTools.jar') diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/SettingsActivity.kt index f42547ca..531bee5e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/SettingsActivity.kt @@ -31,6 +31,7 @@ class SettingsActivity : SimpleActivity() { setupShowHidden() setupPasswordProtection() setupKeepLastModified() + setupShowInfoBubble() setupEnableRootAccess() updateTextColors(settings_holder) } @@ -105,6 +106,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupShowInfoBubble() { + settings_show_info_bubble.isChecked = config.showInfoBubble + settings_show_info_bubble_holder.setOnClickListener { + settings_show_info_bubble.toggle() + config.showInfoBubble = settings_show_info_bubble.isChecked + } + } + private fun setupEnableRootAccess() { settings_enable_root_access_holder.beVisibleIf(config.isRootAvailable) settings_enable_root_access.isChecked = config.enableRootAccess diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt index bb022a43..7154f9e6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt @@ -45,7 +45,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { mView = inflater.inflate(R.layout.items_fragment, container, false)!! - storeConfigVariables() + storeStateVariables() return mView } @@ -86,16 +86,20 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum storedTextColor = newTextColor } + items_fastscroller.updateBubbleColors() + items_fastscroller.allowBubbleDisplay = context!!.config.showInfoBubble refreshItems() } override fun onPause() { super.onPause() - storeConfigVariables() + storeStateVariables() } - private fun storeConfigVariables() { - storedTextColor = context!!.config.textColor + private fun storeStateVariables() { + context!!.config.apply { + storedTextColor = textColor + } } fun openPath(path: String) { @@ -141,7 +145,10 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum addVerticalDividers(true) items_list.adapter = this } - items_fastscroller.setViews(items_list, items_swipe_refresh) + items_fastscroller.allowBubbleDisplay = context.config.showInfoBubble + items_fastscroller.setViews(items_list, items_swipe_refresh) { + items_fastscroller.updateBubbleText(storedItems[it].getBubbleText()) + } } else { (currAdapter as ItemsAdapter).updateItems(storedItems) diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index d8fb1c29..fc2ebc5d 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -129,6 +129,26 @@ + + + + + + - + +