Last active
July 31, 2020 17:11
-
-
Save mitchtabian/44e82008f3393d7e19d127dd9bfc484a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val google_maps = "17.0.0" | |
val google_maps_ktx = "2.1.1" | |
val google_maps_utils = "2.0.3" | |
val google_maps_utils_ktx = "1.7.0" | |
val google_maps = "com.google.android.gms:play-services-maps:${Versions.google_maps}" | |
val google_maps_ktx = "com.google.maps.android:maps-ktx:${Versions.google_maps_ktx}" | |
val google_maps_utils = "com.google.maps.android:android-maps-utils:${Versions.google_maps_utils}" | |
val google_maps_utils_ktx = "com.google.maps.android:maps-utils-ktx:${Versions.google_maps_utils_ktx}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.coordinatorlayout.widget.CoordinatorLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:background="?android:attr/windowBackground"> | |
<com.google.android.material.appbar.AppBarLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<com.google.android.material.appbar.MaterialToolbar | |
android:id="@+id/outage_map_app_bar" | |
android:layout_width="match_parent" | |
android:layout_height="@dimen/toolbar_height" | |
app:navigationIcon="@drawable/ic_close_white_24dp" | |
style="@style/Widget.App.Toolbar" | |
android:maxLines="1" | |
/> | |
</com.google.android.material.appbar.AppBarLayout> | |
<androidx.constraintlayout.motion.widget.MotionLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
app:layout_behavior="@string/appbar_scrolling_view_behavior" | |
app:layoutDescription="@xml/outage_map_scene" | |
tools:showPaths="true" | |
> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:id="@+id/map_container" | |
android:layout_width="match_parent" | |
android:layout_height="320dp" | |
android:background="?android:attr/windowBackground" | |
app:layout_constrainedWidth="true" | |
app:layout_constraintTop_toTopOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" /> | |
<com.google.android.gms.maps.MapView | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
app:layout_constrainedWidth="true" | |
app:layout_constraintTop_toTopOf="@id/map_container" | |
app:layout_constraintStart_toStartOf="@id/map_container" | |
app:layout_constraintEnd_toEndOf="@id/map_container" | |
app:layout_constraintBottom_toBottomOf="@id/map_container" | |
android:id="@+id/outage_map" | |
/> | |
<FrameLayout | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:id="@+id/content_container" | |
android:background="?android:attr/windowBackground" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toBottomOf="@id/map_container" | |
/> | |
<TextView | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:id="@+id/content" | |
android:padding="@dimen/default_padding" | |
android:text="@string/long_text" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toBottomOf="@id/map_container" | |
/> | |
</androidx.constraintlayout.motion.widget.MotionLayout> | |
</androidx.coordinatorlayout.widget.CoordinatorLayout> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:motion="http://schemas.android.com/apk/res-auto"> | |
<Transition | |
motion:constraintSetStart="@+id/map_contracted" | |
motion:constraintSetEnd="@+id/map_expanded" | |
motion:duration="1000" | |
motion:motionInterpolator="linear" | |
> | |
<OnSwipe | |
motion:touchAnchorId="@id/content_container" | |
motion:touchAnchorSide="top" | |
motion:dragDirection="dragDown" /> | |
<ConstraintSet android:id="@+id/map_contracted"> | |
<Constraint | |
android:id="@id/map_container" | |
android:layout_width="0dp" | |
android:layout_height="320dp" | |
motion:layout_constraintTop_toTopOf="parent" | |
motion:layout_constraintStart_toStartOf="parent" | |
motion:layout_constraintEnd_toEndOf="parent" | |
/> | |
<Constraint | |
android:id="@id/outage_map" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
motion:layout_constraintTop_toTopOf="@id/map_container" | |
motion:layout_constraintStart_toStartOf="@id/map_container" | |
motion:layout_constraintEnd_toEndOf="@id/map_container" | |
motion:layout_constraintBottom_toBottomOf="@id/map_container" | |
/> | |
<Constraint | |
android:id="@id/content_container" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
motion:layout_constraintTop_toBottomOf="@id/map_container" | |
motion:layout_constraintBottom_toBottomOf="parent" | |
motion:layout_constraintEnd_toEndOf="parent" | |
motion:layout_constraintStart_toStartOf="parent" /> | |
<Constraint | |
android:id="@id/content" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
motion:layout_constraintTop_toBottomOf="@id/map_container" | |
motion:layout_constraintBottom_toBottomOf="parent" | |
motion:layout_constraintEnd_toEndOf="parent" | |
motion:layout_constraintStart_toStartOf="parent"/> | |
</ConstraintSet> | |
<ConstraintSet android:id="@id/map_expanded"> | |
<Constraint | |
android:id="@id/map_container" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
motion:layout_constraintRight_toRightOf="parent" | |
motion:layout_constraintLeft_toLeftOf="parent" | |
motion:layout_constraintTop_toTopOf="parent" | |
motion:layout_constraintBottom_toBottomOf="parent" | |
/> | |
<Constraint | |
android:id="@id/outage_map" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:layout_marginBottom="20dp" | |
motion:layout_constraintTop_toTopOf="@id/map_container" | |
motion:layout_constraintStart_toStartOf="@id/map_container" | |
motion:layout_constraintEnd_toEndOf="@id/map_container" | |
motion:layout_constraintBottom_toBottomOf="@id/map_container" | |
/> | |
<Constraint | |
android:id="@id/content_container" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
motion:layout_constraintTop_toBottomOf="@id/map_container" | |
motion:layout_constraintBottom_toBottomOf="parent" | |
motion:layout_constraintEnd_toEndOf="parent" | |
motion:layout_constraintStart_toStartOf="parent" /> | |
<Constraint | |
android:id="@id/content" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:alpha="0" | |
motion:layout_constraintTop_toBottomOf="@id/map_container" | |
motion:layout_constraintBottom_toBottomOf="@id/map_container" | |
motion:layout_constraintEnd_toEndOf="@id/map_container" | |
motion:layout_constraintStart_toStartOf="@id/map_container"/> | |
</ConstraintSet> | |
<KeyFrameSet> | |
<KeyPosition | |
motion:motionTarget="@id/map_container" | |
motion:framePosition="90" | |
motion:percentWidth="0" | |
motion:percentX="0" | |
motion:curveFit="linear" | |
/> | |
<KeyPosition | |
motion:motionTarget="@id/content_container" | |
motion:framePosition="90" | |
motion:percentWidth="0" | |
motion:curveFit="linear" | |
/> | |
<KeyPosition | |
motion:motionTarget="@id/content" | |
motion:framePosition="90" | |
motion:percentWidth="0" | |
motion:curveFit="linear" | |
/> | |
</KeyFrameSet> | |
</Transition> | |
</MotionScene> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private lateinit var map: GoogleMap | |
private lateinit var mapView: MapView | |
private fun setupMap(){ | |
mapView = view.findViewById(R.id.outage_map) | |
mapView.onCreate(null) | |
mapView.getMapAsync { | |
map = it | |
} | |
} | |
override fun onStop() { | |
super.onStop() | |
mapView.onStop() | |
} | |
override fun onStart() { | |
super.onStart() | |
mapView.onStart() | |
} | |
override fun onLowMemory() { | |
super.onLowMemory() | |
mapView.onLowMemory() | |
} | |
override fun onResume() { | |
super.onResume() | |
mapView.onResume() | |
} | |
override fun onDestroy() { | |
super.onDestroy() | |
mapView.onDestroy() | |
} | |
override fun onPause() { | |
super.onPause() | |
mapView.onPause() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment