Skip to content

Commit af5862f

Browse files
committed
make sure folder labels at search occupy the whole line in grid view
1 parent f2c1f76 commit af5862f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,8 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
688688
notifyDataSetChanged()
689689
}
690690

691+
fun isASectionTitle(position: Int) = listItems.getOrNull(position)?.isSectionTitle ?: false
692+
691693
override fun onViewRecycled(holder: ViewHolder) {
692694
super.onViewRecycled(holder)
693695
if (!activity.isDestroyed && !activity.isFinishing) {

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.view.LayoutInflater
66
import android.view.View
77
import android.view.ViewGroup
88
import androidx.fragment.app.Fragment
9+
import androidx.recyclerview.widget.GridLayoutManager
910
import com.simplemobiletools.commons.activities.BaseSimpleActivity
1011
import com.simplemobiletools.commons.dialogs.StoragePickerDialog
1112
import com.simplemobiletools.commons.extensions.*
@@ -427,6 +428,16 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
427428
private fun setupGridLayoutManager() {
428429
val layoutManager = mView.items_list.layoutManager as MyGridLayoutManager
429430
layoutManager.spanCount = context?.config?.fileColumnCnt ?: 3
431+
432+
layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
433+
override fun getSpanSize(position: Int): Int {
434+
return if (getRecyclerAdapter()?.isASectionTitle(position) == true) {
435+
layoutManager.spanCount
436+
} else {
437+
1
438+
}
439+
}
440+
}
430441
}
431442

432443
private fun setupListLayoutManager() {

0 commit comments

Comments
 (0)