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.content.Context
import android.content.pm.PackageManager
import android.content.res.Resources
import android.graphics.Paint
import android.location.Location
import android.view.LayoutInflater
@ -51,7 +52,6 @@ import org.y20k.trackbook.R
import org.y20k.trackbook.core.Track
import org.y20k.trackbook.helpers.*
/*
* MapFragmentLayoutHolder class
*/
@ -120,7 +120,8 @@ data class MapFragmentLayoutHolder(private var context: Context, private var mar
val compassOverlay = CompassOverlay(context, InternalCompassOrientationProvider(context), mapView)
compassOverlay.enableCompass()
// 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)
// 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.contentDescription = context.getString(R.string.descr_button_resume)
additionalButtons.isVisible = true
currentLocationButton.isGone = true
currentLocationButton.isVisible = true
}
}
}

View file

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