fixed sync errors

This commit is contained in:
Mariotaku Lee 2017-01-08 00:38:36 +08:00
parent d442182184
commit 8a3bd1e958
2 changed files with 7 additions and 2 deletions

View File

@ -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

View File

@ -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) })
}