mirror of
https://github.com/IllusionMan1212/NPS-Browser.git
synced 2026-10-24 02:12:37 +00:00
refactor: switch to SplashScreen API
This commit is contained in:
@@ -10,20 +10,22 @@
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/NPSTheme">
|
||||
<activity android:name=".activities.SplashActivity" android:theme="@style/NPSTheme.Splash"
|
||||
android:exported="true">
|
||||
android:theme="@style/NPSTheme"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity
|
||||
android:name=".activities.MainActivity"
|
||||
android:configChanges="screenSize|screenLayout|keyboardHidden|orientation"
|
||||
android:exported="true"
|
||||
android:theme="@style/NPSTheme.Splash"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".activities.MainActivity"
|
||||
android:configChanges="screenSize|screenLayout|keyboardHidden|orientation">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -2,6 +2,7 @@ package com.illusionware.npsbrowser.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import com.illusionware.npsbrowser.R
|
||||
import com.illusionware.npsbrowser.fragments.mainactivity.MainActivityFragment
|
||||
@@ -9,6 +10,8 @@ import com.illusionware.npsbrowser.fragments.mainactivity.MainActivityFragment
|
||||
class MainActivity : BaseActivity(), FragmentManager.OnBackStackChangedListener {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
installSplashScreen()
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
setTheme(R.style.NPSTheme)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.illusionware.npsbrowser.activities
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
|
||||
class SplashActivity : BaseActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
startActivity(Intent(this, MainActivity::class.java))
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasFocus)
|
||||
if (hasFocus) hideSystemUI()
|
||||
}
|
||||
|
||||
private fun hideSystemUI() {
|
||||
// Enables regular immersive mode.
|
||||
// For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE.
|
||||
// Or for "sticky immersive," replace it with SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_IMMERSIVE
|
||||
// Set the content to appear under the system bars so that the
|
||||
// content doesn't resize when the system bars hide and show.
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
// Hide the nav bar and status bar
|
||||
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
or View.SYSTEM_UI_FLAG_FULLSCREEN)
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textColor="@color/colorError"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
<color name="colorSecondaryDark">#515151</color>
|
||||
<color name="colorOnSecondary">#DFFFFFFF</color>
|
||||
<color name="colorAmoled">#000000</color>
|
||||
<color name="colorAccent">#F93422</color>
|
||||
<color name="colorError">#F93422</color>
|
||||
</resources>
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
<color name="colorSecondaryDark">#888888</color>
|
||||
<color name="colorOnSecondary">#111111</color>
|
||||
<color name="colorAmoled">#FFFFFF</color>
|
||||
<color name="colorAccent">#F93422</color>
|
||||
<color name="colorError">#F93422</color>
|
||||
<color name="colorAccent">#545FBF</color>
|
||||
</resources>
|
||||
|
||||
@@ -31,4 +31,5 @@
|
||||
<item>List</item>
|
||||
<item>Grid</item>
|
||||
</string-array>
|
||||
<string name="title_activity_thing">thing</string>
|
||||
</resources>
|
||||
|
||||
@@ -30,9 +30,13 @@
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="NPSTheme.Splash" parent="NPSTheme">
|
||||
<item name="android:statusBarColor">#FF00A7FF</item>
|
||||
<item name="android:windowBackground">@drawable/splash</item>
|
||||
<style name="NPSTheme.Splash" parent="Theme.SplashScreen">
|
||||
<item name="windowSplashScreenBackground">@color/colorAccent</item>
|
||||
|
||||
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_nps_fg_no_shadow</item>
|
||||
<item name="windowSplashScreenAnimationDuration">500</item>
|
||||
|
||||
<item name="postSplashScreenTheme">@style/NPSTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="NPSTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
Reference in New Issue
Block a user