Skip to content

Commit

Permalink
Migrate to the new enableEdgeToEdge API
Browse files Browse the repository at this point in the history
  • Loading branch information
fibelatti committed Oct 5, 2023
1 parent 6ce9d8a commit af5d973
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import android.transition.TransitionManager
import android.view.View
import android.view.animation.LinearInterpolator
import androidx.activity.OnBackPressedCallback
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.view.WindowCompat
import androidx.lifecycle.Lifecycle
import com.fibelatti.core.android.BaseIntentBuilder
import com.fibelatti.core.android.intentExtras
Expand Down Expand Up @@ -118,6 +118,7 @@ class MainActivity : BaseActivity() {
// endregion ConstraintSets

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
setContentView(binding.root)

Expand All @@ -141,8 +142,6 @@ class MainActivity : BaseActivity() {
}

private fun setupView() {
WindowCompat.setDecorFitsSystemWindows(window, false)

binding.root.addView(
widthWindowSizeClassReactiveView { windowSizeClass ->
mainViewModel.updateState { currentState ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.fibelatti.pinboard.features.share

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.core.app.ShareCompat
import androidx.core.view.WindowCompat
import com.fibelatti.pinboard.core.android.base.BaseActivity
import com.fibelatti.pinboard.core.extension.setThemedContent
import com.fibelatti.pinboard.features.MainActivity
Expand All @@ -15,6 +15,7 @@ open class ShareReceiverActivity : BaseActivity() {
open val skipEdit: Boolean = false

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)

setThemedContent {
Expand All @@ -28,8 +29,6 @@ open class ShareReceiverActivity : BaseActivity() {
)
}

WindowCompat.setDecorFitsSystemWindows(window, false)

val intentReader = ShareCompat.IntentReader(this)
val url = intentReader.text.toString().ifEmpty {
finish()
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="color_status_bar">#00000000</color>
<color name="color_navigation_bar">#000000</color>

<color name="color_background">#000000</color>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<resources>
<!-- Only colors that change depending on the configuration should be defined here
everything else should be follow the style and use the query syntax (?attr/) -->
<color name="color_status_bar">#C2C2C2</color>
<color name="color_navigation_bar">#9E9E9E</color>

<color name="color_background">#FFFFFF</color>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
<resources xmlns:tools="http://schemas.android.com/tools">

<style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:statusBarColor">@color/color_status_bar</item>
<item name="android:navigationBarColor">@color/color_navigation_bar</item>
<item name="android:windowBackground">@color/color_background</item>

<item name="android:windowAnimationStyle">@style/AppTheme.AppActivityAnimation</item>

<item name="enableEdgeToEdge">true</item>

<item name="fontFamily">@font/opensansregular</item>

<item name="materialAlertDialogTheme">@style/AppTheme.MaterialDialog</item>
Expand Down

0 comments on commit af5d973

Please sign in to comment.