aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-07-03 14:07:09 -0700
committerAllan Wang <me@allanwang.ca>2019-07-03 14:07:09 -0700
commit0931219b05e9df84aee60b3f714a72e8d91ecdce (patch)
tree0232d39a5bc73759ae4f94f0d67ed8351bb1277f
parentc5008fb253ee52d978b09b34e8a0714262dc8fe2 (diff)
downloadfrost-0931219b05e9df84aee60b3f714a72e8d91ecdce.tar.gz
frost-0931219b05e9df84aee60b3f714a72e8d91ecdce.tar.bz2
frost-0931219b05e9df84aee60b3f714a72e8d91ecdce.zip
Fix support for textless
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt12
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt8
2 files changed, 10 insertions, 10 deletions
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<LoginActivity>()
// Has cookies but no selected account
Prefs.userId == -1L -> launchNewTask<SelectorActivity>(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<MainActivity>(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<MainActivity>(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<View>
+ private var bottomBehavior: BottomSheetBehavior<View>? = 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) {