Try a new location button position.

This commit is contained in:
voussoir 2022-04-08 18:13:10 -07:00
parent 629973e323
commit edcb149ac7
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
2 changed files with 14 additions and 13 deletions

View file

@ -22,6 +22,7 @@ import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.content.res.Resources
import android.graphics.Paint import android.graphics.Paint
import android.location.Location import android.location.Location
import android.view.LayoutInflater import android.view.LayoutInflater
@ -51,7 +52,6 @@ import org.y20k.trackbook.R
import org.y20k.trackbook.core.Track import org.y20k.trackbook.core.Track
import org.y20k.trackbook.helpers.* import org.y20k.trackbook.helpers.*
/* /*
* MapFragmentLayoutHolder class * MapFragmentLayoutHolder class
*/ */
@ -120,7 +120,8 @@ data class MapFragmentLayoutHolder(private var context: Context, private var mar
val compassOverlay = CompassOverlay(context, InternalCompassOrientationProvider(context), mapView) val compassOverlay = CompassOverlay(context, InternalCompassOrientationProvider(context), mapView)
compassOverlay.enableCompass() compassOverlay.enableCompass()
// compassOverlay.setCompassCenter(36f, 36f + (statusBarHeight / densityScalingFactor)) // TODO uncomment when transparent status bar is re-implemented // compassOverlay.setCompassCenter(36f, 36f + (statusBarHeight / densityScalingFactor)) // TODO uncomment when transparent status bar is re-implemented
compassOverlay.setCompassCenter(36f, 36f) val screen_width = Resources.getSystem().getDisplayMetrics().widthPixels;
compassOverlay.setCompassCenter((screen_width / densityScalingFactor) - 36f, 36f)
mapView.overlays.add(compassOverlay) mapView.overlays.add(compassOverlay)
// position the live statistics // position the live statistics
@ -254,7 +255,7 @@ data class MapFragmentLayoutHolder(private var context: Context, private var mar
mainButton.text = context.getString(R.string.button_resume) mainButton.text = context.getString(R.string.button_resume)
mainButton.contentDescription = context.getString(R.string.descr_button_resume) mainButton.contentDescription = context.getString(R.string.descr_button_resume)
additionalButtons.isVisible = true additionalButtons.isVisible = true
currentLocationButton.isGone = true currentLocationButton.isVisible = true
} }
} }
} }

View file

@ -77,14 +77,14 @@
style="@style/Widget.MaterialComponents.FloatingActionButton" style="@style/Widget.MaterialComponents.FloatingActionButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginTop="64dp"
android:layout_marginEnd="16dp"
android:contentDescription="@string/descr_button_location" android:contentDescription="@string/descr_button_location"
android:src="@drawable/ic_current_location_24dp" android:src="@drawable/ic_current_location_24dp"
app:backgroundTint="@color/location_button_background" app:backgroundTint="@color/location_button_background"
app:fabSize="mini" app:fabSize="mini"
app:layout_constraintBottom_toBottomOf="@+id/main_button" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toTopOf="@+id/main_button"
app:tint="@color/location_button_icon" /> app:tint="@color/location_button_icon" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
@ -101,13 +101,11 @@
android:id="@+id/live_statistics_distance" android:id="@+id/live_statistics_distance"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="64dp"
android:layout_marginEnd="16dp"
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textAppearance="@style/TextAppearance.Material3.LabelLarge" android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
android:textColor="@color/text_default" android:textColor="@color/text_default"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="@+id/live_statistics_duration"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toBottomOf="@+id/live_statistics_duration"
tools:text="@string/sample_text_default_live_statistics_distance" /> tools:text="@string/sample_text_default_live_statistics_distance" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
@ -124,14 +122,16 @@
android:id="@+id/live_statistics_duration" android:id="@+id/live_statistics_duration"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textAppearance="@style/TextAppearance.Material3.LabelLarge" android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
android:textColor="@color/text_default" android:textColor="@color/text_default"
app:layout_constraintEnd_toEndOf="@+id/live_statistics_distance" app:layout_constraintEnd_toEndOf="@+id/location_button"
app:layout_constraintTop_toBottomOf="@+id/live_statistics_distance" app:layout_constraintTop_toBottomOf="@+id/location_button"
tools:text="@string/sample_text_default_live_statistics_duration" /> tools:text="@string/sample_text_default_live_statistics_duration" />
<!-- GROUPS --> <!-- GROUPS -->
<androidx.constraintlayout.widget.Group <androidx.constraintlayout.widget.Group
android:id="@+id/additional_buttons" android:id="@+id/additional_buttons"
android:layout_width="0dp" android:layout_width="0dp"