diff --git a/src/androidTest/java/com/owncloud/android/ui/fragment/OCFileListFragmentStaticServerIT.kt b/src/androidTest/java/com/owncloud/android/ui/fragment/OCFileListFragmentStaticServerIT.kt index 80e46220c8..db75ddfa76 100644 --- a/src/androidTest/java/com/owncloud/android/ui/fragment/OCFileListFragmentStaticServerIT.kt +++ b/src/androidTest/java/com/owncloud/android/ui/fragment/OCFileListFragmentStaticServerIT.kt @@ -32,6 +32,7 @@ import com.owncloud.android.lib.resources.shares.ShareType import com.owncloud.android.lib.resources.shares.ShareeUser import com.owncloud.android.utils.ScreenshotTest import org.junit.After +import org.junit.Assert import org.junit.Rule import org.junit.Test @@ -200,4 +201,37 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { screenshot(sut) } + + @Test + fun shouldShowHeader() { + val activity = testActivityRule.launchActivity(null) + val sut = OCFileListFragment() + + val folder = OCFile("/test/", "00001") + folder.setFolder() + activity.storageManager.saveFile(folder) + + activity.addFragment(sut) + val testFolder: OCFile = activity.storageManager.getFileByEncryptedRemotePath("/test/") + + activity.runOnUiThread { + // richWorkspace is not set + Assert.assertFalse(sut.adapter.shouldShowHeader()) + + testFolder.richWorkspace = " " + activity.storageManager.saveFile(testFolder) + sut.adapter.swapDirectory(user, testFolder, activity.storageManager, false, "") + Assert.assertFalse(sut.adapter.shouldShowHeader()) + + testFolder.richWorkspace = null + activity.storageManager.saveFile(testFolder) + sut.adapter.swapDirectory(user, testFolder, activity.storageManager, false, "") + Assert.assertFalse(sut.adapter.shouldShowHeader()) + + testFolder.richWorkspace = "1" + activity.storageManager.saveFile(testFolder) + sut.adapter.setCurrentDirectory(testFolder) + Assert.assertTrue(sut.adapter.shouldShowHeader()) + } + } } diff --git a/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index 0c92e1829b..8933e58c69 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -851,7 +851,11 @@ public class OCFileListAdapter extends RecyclerView.Adapter