aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-08-04 22:45:18 -0700
committerAllan Wang <me@allanwang.ca>2019-08-04 22:45:18 -0700
commitdd391481881683e7b58a69ef2b9b671fb6197208 (patch)
treef34fed073d3a01234e27942b35fb532ef2361e8d
parentaf20a977ef11197178a11e3a6d047967b2a1beae (diff)
downloadfrost-dd391481881683e7b58a69ef2b9b671fb6197208.tar.gz
frost-dd391481881683e7b58a69ef2b9b671fb6197208.tar.bz2
frost-dd391481881683e7b58a69ef2b9b671fb6197208.zip
Switch theme when selected in intro
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt18
-rw-r--r--app/src/main/res/layout/intro_analytics.xml2
-rw-r--r--app/src/main/res/layout/intro_end.xml2
5 files changed, 16 insertions, 10 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt
index 2844d833..94f8d6c1 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt
@@ -55,6 +55,7 @@ import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.cookies
import com.pitchedapps.frost.utils.launchNewTask
import com.pitchedapps.frost.utils.loadAssets
+import com.pitchedapps.frost.utils.setFrostTheme
import com.pitchedapps.frost.widgets.NotificationWidget
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.launch
@@ -113,6 +114,7 @@ class IntroActivity : KauBaseActivity(), ViewPager.PageTransformer, ViewPager.On
indicator.setColour(Prefs.textColor)
indicator.invalidate()
fragments.forEach { it.themeFragment() }
+ setFrostTheme(true)
}
/**
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt
index 635bcfa5..22dd086b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt
@@ -139,7 +139,7 @@ class IntroFragmentWelcome : BaseIntroFragment(R.layout.intro_welcome) {
class IntroFragmentAnalytics : BaseIntroFragment(R.layout.intro_analytics) {
- val container: ConstraintLayout by bindViewResettable(R.id.intro_end_container)
+ val container: ConstraintLayout by bindViewResettable(R.id.intro_analytics_container)
override fun viewArray(): Array<Array<out View>> = arrayOf(
arrayOf(title), arrayOf(image),
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
index 0574aeae..8544aac3 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -137,7 +137,8 @@ private inline fun <reified T : WebOverlayActivityBase> Context.launchWebOverlay
fun Context.launchWebOverlay(url: String) = launchWebOverlayImpl<WebOverlayActivity>(url)
-fun Context.launchWebOverlayDesktop(url: String) = launchWebOverlayImpl<WebOverlayDesktopActivity>(url)
+fun Context.launchWebOverlayDesktop(url: String) =
+ launchWebOverlayImpl<WebOverlayDesktopActivity>(url)
private fun Context.fadeBundle() = ActivityOptions.makeCustomAnimation(
this,
@@ -154,9 +155,11 @@ fun Context.launchImageActivity(imageUrl: String, text: String? = null, cookie:
}
fun Activity.launchTabCustomizerActivity() {
- startActivityForResult<TabCustomizerActivity>(SettingsActivity.ACTIVITY_REQUEST_TABS, bundleBuilder = {
- with(fadeBundle())
- })
+ startActivityForResult<TabCustomizerActivity>(
+ SettingsActivity.ACTIVITY_REQUEST_TABS,
+ bundleBuilder = {
+ with(fadeBundle())
+ })
}
fun WebOverlayActivity.url(): String {
@@ -165,11 +168,12 @@ fun WebOverlayActivity.url(): String {
fun Activity.setFrostTheme(forceTransparent: Boolean = false) {
val isTransparent =
- (Color.alpha(Prefs.bgColor) != 255) || (Color.alpha(Prefs.headerColor) != 255) || forceTransparent
- if (Prefs.bgColor.isColorDark)
+ forceTransparent || (Color.alpha(Prefs.bgColor) != 255) || (Color.alpha(Prefs.headerColor) != 255)
+ if (Prefs.bgColor.isColorDark) {
setTheme(if (isTransparent) R.style.FrostTheme_Transparent else R.style.FrostTheme)
- else
+ } else {
setTheme(if (isTransparent) R.style.FrostTheme_Light_Transparent else R.style.FrostTheme_Light)
+ }
}
class ActivityThemeUtils {
diff --git a/app/src/main/res/layout/intro_analytics.xml b/app/src/main/res/layout/intro_analytics.xml
index e0998721..a62a0b0f 100644
--- a/app/src/main/res/layout/intro_analytics.xml
+++ b/app/src/main/res/layout/intro_analytics.xml
@@ -2,7 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/intro_end_container"
+ android:id="@+id/intro_analytics_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
diff --git a/app/src/main/res/layout/intro_end.xml b/app/src/main/res/layout/intro_end.xml
index 501cf1a9..fbaa2042 100644
--- a/app/src/main/res/layout/intro_end.xml
+++ b/app/src/main/res/layout/intro_end.xml
@@ -2,8 +2,8 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
android:id="@+id/intro_end_container"
+ android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView