mirror of https://github.com/Ashinch/ReadYou.git
feat(ui): switch to androidx edge to edge implementation (#690)
* switch to androidx edge to edge implementation * switch to androidx edge to edge implementation for CrashReportActivity * Remove systemuicontroller enableEdgeToEdge() has replaced systemuicontroller * Remove systemuicontroller dependency * clean code
This commit is contained in:
parent
71b470a139
commit
1199c6850b
|
@ -179,7 +179,6 @@ dependencies {
|
|||
implementation "androidx.compose.material3:material3:$material3"
|
||||
|
||||
// https://github.com/google/accompanist/releases
|
||||
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist"
|
||||
implementation "com.google.accompanist:accompanist-pager:$accompanist"
|
||||
implementation "com.google.accompanist:accompanist-flowlayout:$accompanist"
|
||||
implementation "com.google.accompanist:accompanist-navigation-animation:$accompanist"
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
|
||||
package me.ash.reader.infrastructure.android
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
|
@ -41,8 +43,6 @@ import androidx.compose.ui.text.font.FontFamily
|
|||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
import me.ash.reader.R
|
||||
import me.ash.reader.infrastructure.preference.LocalDarkTheme
|
||||
import me.ash.reader.infrastructure.preference.LocalOpenLink
|
||||
|
@ -55,11 +55,9 @@ import me.ash.reader.ui.theme.AppTheme
|
|||
class CrashReportActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v, insets ->
|
||||
v.setPadding(0, 0, 0, 0)
|
||||
insets
|
||||
}
|
||||
|
||||
enableEdgeToEdge()
|
||||
|
||||
val errorMessage: String = intent.getStringExtra(ERROR_REPORT_KEY).toString()
|
||||
|
||||
setContent {
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.util.Log
|
|||
import android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||
import android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
|
@ -45,12 +46,10 @@ class MainActivity : AppCompatActivity() {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.addFlags(FLAG_LAYOUT_IN_SCREEN or FLAG_LAYOUT_NO_LIMITS)
|
||||
}
|
||||
Log.i("RLog", "onCreate: ${ProfileInstallerInitializer().create(this)}")
|
||||
|
||||
enableEdgeToEdge()
|
||||
|
||||
// Set the language
|
||||
if (Build.VERSION.SDK_INT < 33) {
|
||||
LanguagesPreference.fromValue(languages).let {
|
||||
|
|
|
@ -12,12 +12,10 @@ import androidx.compose.runtime.mutableStateOf
|
|||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import com.google.accompanist.navigation.animation.AnimatedNavHost
|
||||
import com.google.accompanist.navigation.animation.rememberAnimatedNavController
|
||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import me.ash.reader.domain.model.general.Filter
|
||||
|
@ -144,12 +142,6 @@ fun HomeEntry(
|
|||
else LocalDarkTheme.current.isDarkTheme()
|
||||
) {
|
||||
|
||||
rememberSystemUiController().run {
|
||||
setStatusBarColor(Color.Transparent, !useDarkTheme)
|
||||
setSystemBarsColor(Color.Transparent, !useDarkTheme)
|
||||
setNavigationBarColor(Color.Transparent, !useDarkTheme)
|
||||
}
|
||||
|
||||
AnimatedNavHost(
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.surface),
|
||||
navController = navController,
|
||||
|
|
Loading…
Reference in New Issue