Don't continue to use custom theme files
This commit is contained in:
Generated
+2
@@ -19,6 +19,8 @@
|
||||
<entry key="..\:/Users/Alie/Documents/GitHub/YandView/app/src/main/res/layout/tag_item_layout.xml" value="0.2056159420289855" />
|
||||
<entry key="..\:/Users/Alie/Documents/GitHub/YandView/app/src/main/res/menu/nav_menu.xml" value="0.24947916666666667" />
|
||||
<entry key="..\:/Users/Alie/Documents/GitHub/YandView/app/src/main/res/menu/toolbar_menu.xml" value="0.24947916666666667" />
|
||||
<entry key="..\:/Users/Alie/Documents/GitHub/YandView/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.15208333333333332" />
|
||||
<entry key="..\:/Users/Alie/Documents/GitHub/YandView/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.15208333333333332" />
|
||||
<entry key="..\:/Users/Alie/Documents/GitHub/YandView/app/src/main/res/xml/root_preferences.xml" value="0.1" />
|
||||
<entry key="app/src/main/res/drawable-anydpi-v26/ic_launcher_foreground.xml" value="0.3333333333333333" />
|
||||
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.3333333333333333" />
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.lsper.view"
|
||||
minSdkVersion 21
|
||||
minSdkVersion 28
|
||||
targetSdkVersion 32
|
||||
versionCode 11010101
|
||||
versionName "1.2.5"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MyTheme">
|
||||
android:theme="@style/Theme.Material3.DayNight.NoActionBar">
|
||||
<activity
|
||||
android:name=".activity.favtag.FavTagActivity"
|
||||
android:exported="false" />
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
package com.lsp.view.activity
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat.Type.statusBars
|
||||
import com.lsp.view.R
|
||||
|
||||
open class BaseActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
transparentStatusBar()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.setDecorFitsSystemWindows(false)
|
||||
}
|
||||
@@ -19,4 +25,23 @@ open class BaseActivity : AppCompatActivity() {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
|
||||
}
|
||||
}
|
||||
private fun transparentStatusBar(){
|
||||
// 设置状态栏颜色为透明
|
||||
window.statusBarColor = Color.TRANSPARENT
|
||||
window.navigationBarColor = Color.TRANSPARENT
|
||||
//状态栏反色
|
||||
val controller = ViewCompat.getWindowInsetsController(window.decorView)
|
||||
controller?.isAppearanceLightStatusBars = !isDarkMode()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前是否为深色模式
|
||||
* 深色模式的值为:0x21
|
||||
* 浅色模式的值为:0x11
|
||||
* @return true 为是深色模式 false为不是深色模式
|
||||
*/
|
||||
private fun isDarkMode(): Boolean {
|
||||
return resources.configuration.uiMode == 0x21
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.MyTheme" parent="Theme.Material3.Dark.NoActionBar">
|
||||
<item name="android:statusBarColor">
|
||||
@android:color/transparent
|
||||
</item>
|
||||
<item name="android:navigationBarColor">
|
||||
@android:color/transparent
|
||||
</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.MyTheme" parent="Theme.Material3.Light.NoActionBar">
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:statusBarColor">
|
||||
@android:color/transparent
|
||||
</item>
|
||||
|
||||
<item name="android:navigationBarColor">
|
||||
@android:color/transparent
|
||||
</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user