Merge pull request #11673 from nextcloud/fixShowingOneGroupfolder
fix showing only one groupfolder
This commit is contained in:
commit
8e86617177
Binary file not shown.
After Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
|
@ -42,13 +42,35 @@ class GroupfolderListFragmentIT : AbstractIT() {
|
|||
activity = testActivityRule.launchActivity(null)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun showGroupfolder() {
|
||||
val sut = GroupfolderListFragment()
|
||||
activity.addFragment(sut)
|
||||
|
||||
shortSleep() // to let async task finish
|
||||
|
||||
activity.runOnUiThread {
|
||||
sut.setAdapter(null)
|
||||
sut.setData(
|
||||
mapOf(
|
||||
Pair("2", Groupfolder(2, "/subfolder/group"))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
shortSleep()
|
||||
screenshot(activity)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun showGroupfolders() {
|
||||
val sut = GroupfolderListFragment()
|
||||
activity.addFragment(sut)
|
||||
|
||||
waitForIdleSync()
|
||||
shortSleep() // to let async task finish
|
||||
|
||||
activity.runOnUiThread {
|
||||
sut.setAdapter(null)
|
||||
|
|
|
@ -26,7 +26,7 @@ import android.content.Intent.ACTION_VIEW
|
|||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.nextcloud.android.lib.resources.groupfolders.Groupfolder
|
||||
import com.nextcloud.client.di.Injectable
|
||||
import com.nextcloud.client.logger.Logger
|
||||
|
@ -35,6 +35,7 @@ import com.owncloud.android.R
|
|||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation
|
||||
import com.owncloud.android.lib.resources.files.model.RemoteFile
|
||||
import com.owncloud.android.ui.EmptyRecyclerView
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||
import com.owncloud.android.ui.adapter.GroupfolderListAdapter
|
||||
import com.owncloud.android.ui.asynctasks.GroupfoldersSearchTask
|
||||
|
@ -65,6 +66,7 @@ class GroupfolderListFragment : OCFileListFragment(), Injectable, GroupfolderLis
|
|||
searchFragment = true
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
|
||||
|
@ -79,8 +81,9 @@ class GroupfolderListFragment : OCFileListFragment(), Injectable, GroupfolderLis
|
|||
adapter = GroupfolderListAdapter(requireContext(), viewThemeUtils, this)
|
||||
setRecyclerViewAdapter(adapter)
|
||||
|
||||
val layoutManager = GridLayoutManager(context, 1)
|
||||
val layoutManager = LinearLayoutManager(context)
|
||||
recyclerView.layoutManager = layoutManager
|
||||
(recyclerView as EmptyRecyclerView).setHasFooter(false)
|
||||
}
|
||||
|
||||
private fun search() {
|
||||
|
@ -104,6 +107,12 @@ class GroupfolderListFragment : OCFileListFragment(), Injectable, GroupfolderLis
|
|||
}
|
||||
}
|
||||
|
||||
override fun onRefresh() {
|
||||
super.onRefresh()
|
||||
|
||||
search()
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun setData(result: Map<String, Groupfolder>) {
|
||||
adapter.setData(result)
|
||||
|
|
Loading…
Reference in New Issue