Skip to content

Commit

Permalink
[Crane] Migrate to new edge to edge API (#1220)
Browse files Browse the repository at this point in the history
Simple migration
  • Loading branch information
JolandaVerhoef authored Nov 21, 2023
2 parents 8cf3301 + 7b1fa7a commit 9810c90
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 4 additions & 2 deletions Crane/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@

<activity
android:name=".home.MainActivity"
android:exported="true">
android:exported="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -55,7 +56,8 @@
</activity>
<activity
android:name=".details.DetailsActivity"
android:exported="false" />
android:exported="false"
android:windowSoftInputMode="adjustResize" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ package androidx.compose.samples.crane.details

import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.annotation.VisibleForTesting
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.layout.Arrangement
Expand Down Expand Up @@ -54,7 +57,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.core.view.WindowCompat
import androidx.lifecycle.viewmodel.compose.viewModel
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.model.CameraPosition
Expand Down Expand Up @@ -85,10 +87,9 @@ fun createDetailsActivityIntent(context: Context, item: ExploreModel): Intent {
@AndroidEntryPoint
class DetailsActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge(statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT))
super.onCreate(savedInstanceState)

WindowCompat.setDecorFitsSystemWindows(window, false)

setContent {
CraneTheme {
Surface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@

package androidx.compose.samples.crane.home

import android.graphics.Color
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.annotation.VisibleForTesting
import androidx.compose.animation.core.MutableTransitionState
import androidx.compose.animation.core.Spring.StiffnessLow
Expand Down Expand Up @@ -51,7 +54,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.core.view.WindowCompat
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
Expand All @@ -63,10 +65,9 @@ import dagger.hilt.android.AndroidEntryPoint
class MainActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge(statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT))
super.onCreate(savedInstanceState)

WindowCompat.setDecorFitsSystemWindows(window, false)

setContent {
CraneTheme {
val widthSizeClass = calculateWindowSizeClass(this).widthSizeClass
Expand Down

0 comments on commit 9810c90

Please sign in to comment.