add an info bubble at the fastscroller

This commit is contained in:
tibbi 2017-12-06 21:54:36 +01:00
parent 58ded92b34
commit 565e44667c
5 changed files with 44 additions and 13 deletions

View file

@ -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')

View file

@ -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

View file

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

View file

@ -129,6 +129,26 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_info_bubble_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_show_info_bubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/show_info_bubble"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_enable_root_access_holder"
android:layout_width="match_parent"

View file

@ -41,13 +41,8 @@
android:paddingLeft="@dimen/normal_margin"
android:paddingStart="@dimen/normal_margin">
<ImageView
android:id="@+id/fastscroller_handle_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:alpha="0"
android:background="@drawable/fastscroller_handle_vertical"/>
<include layout="@layout/fastscroller_handle_vertical"/>
</com.simplemobiletools.commons.views.FastScroller>
</RelativeLayout>
</android.support.v4.widget.SwipeRefreshLayout>