1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 20:12:39 +01:00

Switch theme when selected in intro

This commit is contained in:
Allan Wang 2019-08-04 22:45:18 -07:00
parent af20a977ef
commit dd39148188
No known key found for this signature in database
GPG Key ID: C93E3F9C679D7A56
5 changed files with 16 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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

View File

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