mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-10 04:52:38 +01:00
Switch theme when selected in intro
This commit is contained in:
parent
af20a977ef
commit
dd39148188
@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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),
|
||||
|
@ -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 {
|
||||
|
@ -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">
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user