Skip to content

Commit 565e446

Browse files
committed
add an info bubble at the fastscroller
1 parent 58ded92 commit 565e446

File tree

5 files changed

+44
-13
lines changed

5 files changed

+44
-13
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ ext {
4242
}
4343

4444
dependencies {
45-
implementation 'com.simplemobiletools:commons:3.2.1'
45+
implementation 'com.simplemobiletools:commons:3.2.2'
4646

4747
implementation files('../libs/RootTools.jar')
4848

app/src/main/kotlin/com/simplemobiletools/filemanager/activities/SettingsActivity.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class SettingsActivity : SimpleActivity() {
3131
setupShowHidden()
3232
setupPasswordProtection()
3333
setupKeepLastModified()
34+
setupShowInfoBubble()
3435
setupEnableRootAccess()
3536
updateTextColors(settings_holder)
3637
}
@@ -105,6 +106,14 @@ class SettingsActivity : SimpleActivity() {
105106
}
106107
}
107108

109+
private fun setupShowInfoBubble() {
110+
settings_show_info_bubble.isChecked = config.showInfoBubble
111+
settings_show_info_bubble_holder.setOnClickListener {
112+
settings_show_info_bubble.toggle()
113+
config.showInfoBubble = settings_show_info_bubble.isChecked
114+
}
115+
}
116+
108117
private fun setupEnableRootAccess() {
109118
settings_enable_root_access_holder.beVisibleIf(config.isRootAvailable)
110119
settings_enable_root_access.isChecked = config.enableRootAccess

app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
4545

4646
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
4747
mView = inflater.inflate(R.layout.items_fragment, container, false)!!
48-
storeConfigVariables()
48+
storeStateVariables()
4949
return mView
5050
}
5151

@@ -86,16 +86,20 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
8686
storedTextColor = newTextColor
8787
}
8888

89+
items_fastscroller.updateBubbleColors()
90+
items_fastscroller.allowBubbleDisplay = context!!.config.showInfoBubble
8991
refreshItems()
9092
}
9193

9294
override fun onPause() {
9395
super.onPause()
94-
storeConfigVariables()
96+
storeStateVariables()
9597
}
9698

97-
private fun storeConfigVariables() {
98-
storedTextColor = context!!.config.textColor
99+
private fun storeStateVariables() {
100+
context!!.config.apply {
101+
storedTextColor = textColor
102+
}
99103
}
100104

101105
fun openPath(path: String) {
@@ -141,7 +145,10 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
141145
addVerticalDividers(true)
142146
items_list.adapter = this
143147
}
144-
items_fastscroller.setViews(items_list, items_swipe_refresh)
148+
items_fastscroller.allowBubbleDisplay = context.config.showInfoBubble
149+
items_fastscroller.setViews(items_list, items_swipe_refresh) {
150+
items_fastscroller.updateBubbleText(storedItems[it].getBubbleText())
151+
}
145152
} else {
146153
(currAdapter as ItemsAdapter).updateItems(storedItems)
147154

app/src/main/res/layout/activity_settings.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,26 @@
129129

130130
</RelativeLayout>
131131

132+
<RelativeLayout
133+
android:id="@+id/settings_show_info_bubble_holder"
134+
android:layout_width="match_parent"
135+
android:layout_height="wrap_content"
136+
android:layout_marginTop="@dimen/medium_margin"
137+
android:background="?attr/selectableItemBackground"
138+
android:padding="@dimen/activity_margin">
139+
140+
<com.simplemobiletools.commons.views.MySwitchCompat
141+
android:id="@+id/settings_show_info_bubble"
142+
android:layout_width="match_parent"
143+
android:layout_height="wrap_content"
144+
android:background="@null"
145+
android:clickable="false"
146+
android:paddingLeft="@dimen/medium_margin"
147+
android:paddingStart="@dimen/medium_margin"
148+
android:text="@string/show_info_bubble"/>
149+
150+
</RelativeLayout>
151+
132152
<RelativeLayout
133153
android:id="@+id/settings_enable_root_access_holder"
134154
android:layout_width="match_parent"

app/src/main/res/layout/items_fragment.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,8 @@
4141
android:paddingLeft="@dimen/normal_margin"
4242
android:paddingStart="@dimen/normal_margin">
4343

44-
<ImageView
45-
android:id="@+id/fastscroller_handle_vertical"
46-
android:layout_width="wrap_content"
47-
android:layout_height="wrap_content"
48-
android:layout_gravity="end"
49-
android:alpha="0"
50-
android:background="@drawable/fastscroller_handle_vertical"/>
44+
<include layout="@layout/fastscroller_handle_vertical"/>
45+
5146
</com.simplemobiletools.commons.views.FastScroller>
5247
</RelativeLayout>
5348
</android.support.v4.widget.SwipeRefreshLayout>

0 commit comments

Comments
 (0)