make sure folder labels at search occupy the whole line in grid view

This commit is contained in:
tibbi 2020-10-29 23:23:08 +01:00
parent f2c1f7688a
commit af5862f045
2 changed files with 13 additions and 0 deletions

View File

@ -688,6 +688,8 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
notifyDataSetChanged()
}
fun isASectionTitle(position: Int) = listItems.getOrNull(position)?.isSectionTitle ?: false
override fun onViewRecycled(holder: ViewHolder) {
super.onViewRecycled(holder)
if (!activity.isDestroyed && !activity.isFinishing) {

View File

@ -6,6 +6,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.StoragePickerDialog
import com.simplemobiletools.commons.extensions.*
@ -427,6 +428,16 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
private fun setupGridLayoutManager() {
val layoutManager = mView.items_list.layoutManager as MyGridLayoutManager
layoutManager.spanCount = context?.config?.fileColumnCnt ?: 3
layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int {
return if (getRecyclerAdapter()?.isASectionTitle(position) == true) {
layoutManager.spanCount
} else {
1
}
}
}
}
private fun setupListLayoutManager() {