From fbd722198dd3e3868951b3604150327706826185 Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Sat, 4 Mar 2017 20:40:25 +0800 Subject: [PATCH] reverted part of "reverted to kotlin 1.0.6" --- build.gradle | 2 +- .../kotlin/org/mariotaku/twidere/extension/GlideExtensions.kt | 2 +- .../mariotaku/twidere/extension/SharedPreferencesExtensions.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 78194c3fd..35a134f39 100644 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,7 @@ subprojects { buildscript { ext { libVersions = [ - Kotlin : '1.0.6', + Kotlin : '1.1.0', SupportLib : '25.2.0', MariotakuCommons: '0.9.11', RestFu : '0.9.35', diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/extension/GlideExtensions.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/extension/GlideExtensions.kt index 6e0f72cc6..3f190e070 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/extension/GlideExtensions.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/extension/GlideExtensions.kt @@ -96,7 +96,7 @@ fun RequestManager.loadProfileImage(context: Context, conversation: ParcelableMe fun RequestManager.loadOriginalProfileImage(context: Context, user: ParcelableUser, @ImageShapeStyle shapeStyle: Int = ImageShapeStyle.SHAPE_CIRCLE): DrawableRequestBuilder { - val original = user.extras.profile_image_url_original?.let { if (it.isEmpty()) null else it } + val original = user.extras.profile_image_url_original?.takeUnless(String::isEmpty) ?: Utils.getOriginalTwitterProfileImage(user.profile_image_url) return configureLoadProfileImage(context, shapeStyle) { load(original) } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/extension/SharedPreferencesExtensions.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/extension/SharedPreferencesExtensions.kt index 046500f30..a35c6c10f 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/extension/SharedPreferencesExtensions.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/extension/SharedPreferencesExtensions.kt @@ -6,5 +6,5 @@ import android.content.SharedPreferences * Created by mariotaku on 16/8/25. */ fun SharedPreferences.getNonEmptyString(key: String, def: String): String { - return getString(key, def)?.let { if (it.isEmpty()) null else it } ?: def + return getString(key, def)?.takeUnless(String::isEmpty) ?: def } \ No newline at end of file