Files
OcheCompanion/app/src/main/res/layout/activity_add_player.xml
Alexander Doerflinger 0d71d93ea6 Added primaryPlayer functionality
Added a new functionality to mark one player as the primary player. This player is the main user of the app and the training data will be stored for that player only.
2026-02-17 08:09:15 +01:00

172 lines
6.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/surface_primary"
android:id="@+id/main">
<ImageView
android:id="@+id/btnDeletePlayer"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="top|end"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:padding="8dp"
android:src="@drawable/ic_delete"
android:background="?attr/selectableItemBackgroundBorderless"
android:visibility="gone"
app:tint="@color/double_red" />
<!-- FORM VIEW -->
<LinearLayout
android:id="@+id/layoutForm"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="24dp"
android:gravity="center_horizontal">
<TextView
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_create_profile_header"
android:textAppearance="@style/TextAppearance.Oche.Headline"
android:layout_marginBottom="32dp"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/ivAddPlayerProfile"
android:layout_width="120dp"
android:layout_height="120dp"
android:background="@color/surface_secondary"
android:src="@drawable/ic_users"
app:tint="@color/text_dim"
app:shapeAppearanceOverlay="@style/ShapeAppearance.MaterialComponents.MediumComponent"
app:strokeColor="@color/volt_green"
app:strokeWidth="2dp" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/surface_secondary"
android:hint="@string/txt_create_profile_username_hint"
android:textColor="@color/text_primary" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Primary User Toggle -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="@color/surface_secondary"
android:padding="16dp">
<ImageView
android:id="@+id/ivPrimaryUserIcon"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_favorite_profile"
app:tint="@color/text_dim" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="12dp"
android:text="@string/txt_primary_user_label"
android:textColor="@color/text_primary"
android:textSize="16sp" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchPrimaryUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false" />
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnShowStats"
style="@style/Widget.Oche_Button_Primary"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginTop="32dp"
android:text="@string/txt_create_profile_show_stats"
android:visibility="gone"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnSavePlayer"
style="@style/Widget.Oche_Button_Primary"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginTop="32dp"
android:text="@string/txt_create_profile_username_save" />
</LinearLayout>
<!-- CROPPER VIEW -->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layoutCropper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ImageView
android:id="@+id/ivCropPreview"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="fitCenter"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Corrected package reference -->
<com.aldo.apps.ochecompanion.ui.CropOverlayView
android:id="@+id/cropOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="24dp"
app:layout_constraintBottom_toBottomOf="parent">
<Button
android:id="@+id/btnCancelCrop"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/txt_cancel_crop"
android:backgroundTint="@color/surface_secondary" />
<Button
android:id="@+id/btnConfirmCrop"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="@string/txt_confirm_crop"
android:backgroundTint="@color/volt_green"
android:textColor="@color/midnight_black" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<com.aldo.apps.ochecompanion.ui.PlayerStatsView
android:id="@+id/player_stats_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"/>
</FrameLayout>