mirror of
				https://github.com/SimpleMobileTools/Simple-File-Manager.git
				synced 2025-06-05 22:09:15 +02:00 
			
		
		
		
	make sure folder labels at search occupy the whole line in grid view
This commit is contained in:
		| @@ -688,6 +688,8 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem | |||||||
|         notifyDataSetChanged() |         notifyDataSetChanged() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     fun isASectionTitle(position: Int) = listItems.getOrNull(position)?.isSectionTitle ?: false | ||||||
|  |  | ||||||
|     override fun onViewRecycled(holder: ViewHolder) { |     override fun onViewRecycled(holder: ViewHolder) { | ||||||
|         super.onViewRecycled(holder) |         super.onViewRecycled(holder) | ||||||
|         if (!activity.isDestroyed && !activity.isFinishing) { |         if (!activity.isDestroyed && !activity.isFinishing) { | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ import android.view.LayoutInflater | |||||||
| import android.view.View | import android.view.View | ||||||
| import android.view.ViewGroup | import android.view.ViewGroup | ||||||
| import androidx.fragment.app.Fragment | import androidx.fragment.app.Fragment | ||||||
|  | import androidx.recyclerview.widget.GridLayoutManager | ||||||
| import com.simplemobiletools.commons.activities.BaseSimpleActivity | import com.simplemobiletools.commons.activities.BaseSimpleActivity | ||||||
| import com.simplemobiletools.commons.dialogs.StoragePickerDialog | import com.simplemobiletools.commons.dialogs.StoragePickerDialog | ||||||
| import com.simplemobiletools.commons.extensions.* | import com.simplemobiletools.commons.extensions.* | ||||||
| @@ -427,6 +428,16 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb | |||||||
|     private fun setupGridLayoutManager() { |     private fun setupGridLayoutManager() { | ||||||
|         val layoutManager = mView.items_list.layoutManager as MyGridLayoutManager |         val layoutManager = mView.items_list.layoutManager as MyGridLayoutManager | ||||||
|         layoutManager.spanCount = context?.config?.fileColumnCnt ?: 3 |         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() { |     private fun setupListLayoutManager() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user