Skip to content

Commit 963ee4c

Browse files
committed
fix: empty list state visibility
Signed-off-by: alperozturk <[email protected]>
1 parent 4758170 commit 963ee4c

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

app/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.kt

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ import com.owncloud.android.utils.FileSortOrder
5252
import com.owncloud.android.utils.PathUtils
5353
import kotlinx.coroutines.Dispatchers
5454
import kotlinx.coroutines.launch
55-
import kotlinx.coroutines.withContext
5655
import java.io.File
5756
import javax.inject.Inject
5857

@@ -242,7 +241,6 @@ open class FolderPickerActivity :
242241
startSyncFolderOperation(currentDir, false)
243242
}
244243

245-
@Suppress("DEPRECATION", "TooGenericExceptionCaught")
246244
private fun startSyncFolderOperation(folder: OCFile?, ignoreETag: Boolean) {
247245
val optionalUser = user ?: return
248246
if (optionalUser.isEmpty) {
@@ -253,7 +251,6 @@ open class FolderPickerActivity :
253251

254252
lifecycleScope.launch(Dispatchers.IO) {
255253
val currentSyncTime = System.currentTimeMillis()
256-
val client = clientRepository.getOwncloudClient() ?: return@launch
257254
val operation = RefreshFolderOperation(
258255
folder,
259256
currentSyncTime,
@@ -263,22 +260,14 @@ open class FolderPickerActivity :
263260
user,
264261
applicationContext
265262
)
266-
267-
val newState = try {
268-
val result = operation.execute(client)
269-
if (result.isSuccess) {
270-
EmptyListState.LOCAL_FILE_LIST_EMPTY_FILE
271-
} else {
272-
EmptyListState.ERROR
273-
}
274-
} catch (e: Exception) {
275-
Log_OC.e(TAG, "Error executing RefreshFolderOperation", e)
276-
EmptyListState.ERROR
277-
}
278-
279-
withContext(Dispatchers.Main) {
280-
listOfFilesFragment?.setEmptyListMessage(newState)
281-
}
263+
operation.execute(
264+
account,
265+
this@FolderPickerActivity,
266+
{ _, _ ->
267+
listOfFilesFragment?.setEmptyListMessage(EmptyListState.LOCAL_FILE_LIST_EMPTY_FILE)
268+
},
269+
null
270+
)
282271
}
283272
}
284273

app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ open class ExtendedListFragment :
777777
mEmptyListContainer.setVisibleIf(showEmptyListState)
778778

779779
// clear previous state
780-
if (showEmptyListState) {
780+
if (!showEmptyListState) {
781781
mEmptyListMessage?.text = ""
782782
mEmptyListHeadline?.text = ""
783783
mEmptyListIcon?.setImageDrawable(null)

0 commit comments

Comments
 (0)