From 8a3bd1e958fe25470ae500f310e0bf74e29a388e Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Sun, 8 Jan 2017 00:38:36 +0800 Subject: [PATCH] fixed sync errors --- .../twidere/util/sync/dropbox/DropboxSyncTaskRunner.kt | 5 +++++ .../main/kotlin/org/mariotaku/ktextension/ColorExtensions.kt | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/dropbox/DropboxSyncTaskRunner.kt b/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/dropbox/DropboxSyncTaskRunner.kt index a32f67eaf..11cd5da08 100644 --- a/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/dropbox/DropboxSyncTaskRunner.kt +++ b/twidere/src/google/kotlin/org/mariotaku/twidere/util/sync/dropbox/DropboxSyncTaskRunner.kt @@ -118,6 +118,11 @@ class DropboxSyncTaskRunner(context: Context, val authToken: String) : SyncTaskR listResult = client.files().listFolderContinue(listResult.cursor) } } catch (e: DbxException) { + if (e is ListFolderErrorException) { + if (e.errorValue?.pathValue?.isNotFound ?: false) { + return emptyList() + } + } throw IOException(e) } return result diff --git a/twidere/src/main/kotlin/org/mariotaku/ktextension/ColorExtensions.kt b/twidere/src/main/kotlin/org/mariotaku/ktextension/ColorExtensions.kt index c1a1d45a6..b5f08ecfe 100644 --- a/twidere/src/main/kotlin/org/mariotaku/ktextension/ColorExtensions.kt +++ b/twidere/src/main/kotlin/org/mariotaku/ktextension/ColorExtensions.kt @@ -10,6 +10,6 @@ import java.util.* fun toHexColor(@ColorInt color: Int, format: HexColorFormat = HexColorFormat.ARGB) = format.transform(color) enum class HexColorFormat(val transform: (Int) -> String) { - ARGB({ "%08X".format(Locale.ROOT, it) }), - RGB({ "%06X".format(Locale.ROOT, 0xFFFFFF and it) }) + ARGB({ "#%08X".format(Locale.ROOT, it) }), + RGB({ "#%06X".format(Locale.ROOT, 0xFFFFFF and it) }) } \ No newline at end of file