From 0931219b05e9df84aee60b3f714a72e8d91ecdce Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 3 Jul 2019 14:07:09 -0700 Subject: Fix support for textless --- app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt | 12 +++++------- .../kotlin/com/pitchedapps/frost/activities/ImageActivity.kt | 8 +++++--- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'app') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt index 051b3235..61b4a194 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt @@ -46,7 +46,6 @@ import com.pitchedapps.frost.utils.BiometricUtils import com.pitchedapps.frost.utils.EXTRA_COOKIES import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs -import com.pitchedapps.frost.utils.launchImageActivity import com.pitchedapps.frost.utils.launchNewTask import com.pitchedapps.frost.utils.loadAssets import com.raizlabs.android.dbflow.kotlinextensions.from @@ -99,12 +98,11 @@ class StartActivity : KauBaseActivity() { cookies.isEmpty() -> launchNewTask() // Has cookies but no selected account Prefs.userId == -1L -> launchNewTask(cookies) - else -> launchImageActivity("https://images.pexels.com/photos/374870/pexels-photo-374870.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500", "Hello world\nLong Text\nLSEF") -// else -> startActivity(intentBuilder = { -// putParcelableArrayListExtra(EXTRA_COOKIES, cookies) -// flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or -// Intent.FLAG_ACTIVITY_SINGLE_TOP -// }) + else -> startActivity(intentBuilder = { + putParcelableArrayListExtra(EXTRA_COOKIES, cookies) + flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or + Intent.FLAG_ACTIVITY_SINGLE_TOP + }) } } catch (e: Exception) { L._e(e) { "Load start failed" } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt index 46e53887..8cf9dfbf 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt @@ -144,7 +144,7 @@ class ImageActivity : KauBaseActivity() { } private lateinit var binding: ActivityImageBinding - private lateinit var bottomBehavior: BottomSheetBehavior + private var bottomBehavior: BottomSheetBehavior? = null private val baseBackgroundColor = if (Prefs.blackMediaBg) Color.BLACK else Prefs.bgColor.withMinAlpha(235) @@ -260,8 +260,10 @@ class ImageActivity : KauBaseActivity() { val multiplier = max(1f - scrollPercent, 0f) imageFab.alpha = multiplier - imageText.alpha = - multiplier * (if (bottomBehavior.state == BottomSheetBehavior.STATE_COLLAPSED) 0.5f else 1f) + bottomBehavior?.also { + imageText.alpha = + multiplier * (if (it.state == BottomSheetBehavior.STATE_COLLAPSED) 0.5f else 1f) + } imageContainer.setBackgroundColor(baseBackgroundColor.adjustAlpha(multiplier)) if (scrollPercent >= 1) { -- cgit v1.2.3