Added "download button" with icon and updated onMapTouch

This commit is contained in:
Jackson Rosenthal 2022-02-17 17:12:17 -05:00
parent 1ee500b14d
commit 068f2ba8b2
3 changed files with 44 additions and 19 deletions

View file

@ -200,7 +200,6 @@ class MapFragment : ScreenFragment("Map"), Logging {
var mapView: MapView? = null
private fun showDownloadedRegions() {
// Get a list of tile regions that are currently available.
tileStore.getAllTileRegions { expected ->
@ -265,6 +264,9 @@ class MapFragment : ScreenFragment("Map"), Logging {
//TODO: Setup Style menu for satellite view, street view, & outdoor view
// downloadOfflineRegion()
}
binding.downloadRegion.setOnClickListener {
downloadOfflineRegion()
}
// We might not have a real mapview if running with analytics
if ((requireContext().applicationContext as GeeksvilleApplication).isAnalyticsAllowed) {
val vIn = viewIn.findViewById<MapView>(R.id.mapView)
@ -478,10 +480,12 @@ class MapFragment : ScreenFragment("Map"), Logging {
}
private val click = OnMapClickListener {
if (binding.fabStyleToggle.isVisible) {
if (binding.fabStyleToggle.isVisible && binding.downloadRegion.isVisible) {
binding.fabStyleToggle.visibility = View.INVISIBLE
binding.downloadRegion.visibility = View.INVISIBLE
} else {
binding.fabStyleToggle.visibility = View.VISIBLE
binding.downloadRegion.visibility = View.VISIBLE
}
return@OnMapClickListener true
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M5,20h14v-2H5V20zM19,9h-4V3H9v6H5l7,7L19,9z"/>
</vector>

View file

@ -5,12 +5,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mapbox.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
<com.mapbox.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
mapbox:mapbox_cameraZoom="0" />
app:mapbox_cameraZoom="0" />
<LinearLayout
android:layout_width="match_parent"
@ -26,21 +25,37 @@
android:clickable="false"
android:indeterminate="false"
android:max="100"
android:visibility="gone"
android:progressTint="@color/colorPrimaryDark" />
android:progressTint="@color/colorPrimaryDark"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_style_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:backgroundTint="@color/buttonColor"
android:contentDescription="@string/style_selection"
android:src="@drawable/baseline_layers_white_24dp"
tools:background="@color/buttonColor" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/download_region"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:backgroundTint="@color/buttonColor"
android:contentDescription="@string/download_region"
android:src="@drawable/baseline_download_white_24dp"
tools:background="@color/buttonColor" />
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_style_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/baseline_layers_white_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:backgroundTint="@color/buttonColor"
android:contentDescription="@string/style_selection" />
</androidx.constraintlayout.widget.ConstraintLayout>