Add TextInputLayout to homepoint dialog, and re-add it to save dialog.

This commit is contained in:
voussoir 2023-03-30 18:00:57 -07:00
parent 9b67ca8bfd
commit 7eba6e262a
4 changed files with 51 additions and 41 deletions

View file

@ -160,6 +160,7 @@ class MapFragment : Fragment()
Log.i("VOUSSOIR", "MapFragment MapEventsReceiver.longPressHelper")
val dialog = Dialog(activity as Context)
dialog.setContentView(R.layout.dialog_homepoint)
dialog.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
dialog.setTitle("Homepoint")
(dialog.findViewById(R.id.homepoint_dialog_title) as TextView).text = "Add a homepoint"
@ -514,6 +515,7 @@ class MapFragment : Fragment()
Log.i("VOUSSOIR", "MapFragment homepoint.longpress")
val dialog = Dialog(activity as Context)
dialog.setContentView(R.layout.dialog_homepoint)
dialog.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
dialog.setTitle("Homepoint")
(dialog.findViewById(R.id.homepoint_dialog_title) as TextView).text = "Edit homepoint"

View file

@ -14,44 +14,45 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/homepoint_name_label"
android:layout_width="wrap_content"
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/homepoint_name_textlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Name"
android:hint="Name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/homepoint_dialog_title" />
app:layout_constraintTop_toBottomOf="@+id/homepoint_dialog_title">
<EditText
android:id="@+id/homepoint_name_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:minHeight="48dp"
android:text=""
app:layout_constraintStart_toStartOf="@+id/homepoint_name_label"
app:layout_constraintTop_toBottomOf="@+id/homepoint_name_label" />
<EditText
android:id="@+id/homepoint_name_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:minHeight="48dp"
android:text=""
app:layout_constraintStart_toStartOf="@+id/homepoint_name_label"
app:layout_constraintTop_toBottomOf="@+id/homepoint_name_label" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/homepoint_radius_label"
android:layout_width="wrap_content"
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/homepoint_radius_textlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Radius"
app:layout_constraintStart_toStartOf="@+id/homepoint_name_input"
app:layout_constraintTop_toBottomOf="@+id/homepoint_name_input" />
android:hint="Radius"
app:layout_constraintStart_toStartOf="@+id/homepoint_name_textlayout"
app:layout_constraintTop_toBottomOf="@+id/homepoint_name_textlayout">
<EditText
android:id="@+id/homepoint_radius_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits="0123456789."
android:inputType="numberDecimal"
android:minHeight="48dp" />
</com.google.android.material.textfield.TextInputLayout>
<EditText
android:id="@+id/homepoint_radius_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number"
android:minHeight="48dp"
app:layout_constraintStart_toStartOf="@+id/homepoint_radius_label"
app:layout_constraintTop_toBottomOf="@+id/homepoint_radius_label" />
<Button
android:id="@+id/homepoint_save_button"
@ -61,7 +62,7 @@
android:text="Save"
app:cornerRadius="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/homepoint_radius_input" />
app:layout_constraintTop_toBottomOf="@+id/homepoint_radius_textlayout" />
<Button
android:id="@+id/homepoint_delete_cancel_button"
@ -71,6 +72,6 @@
android:text="Delete"
app:cornerRadius="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/homepoint_radius_input" />
app:layout_constraintTop_toBottomOf="@+id/homepoint_radius_textlayout" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -5,14 +5,21 @@
android:layout_height="wrap_content"
android:layout_margin="16dp">
<EditText
android:id="@+id/dialog_rename_track_input_edit_text"
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/dialog_rename_track_textlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/dialog_rename_track_input_hint"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
>
<EditText
android:id="@+id/dialog_rename_track_input_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/dialog_rename_track_input_hint"
/>
</com.google.android.material.textfield.TextInputLayout>
<Button
@ -22,8 +29,8 @@
android:layout_marginTop="16dp"
android:text="Save"
app:cornerRadius="8dp"
app:layout_constraintEnd_toEndOf="@+id/dialog_rename_track_input_edit_text"
app:layout_constraintTop_toBottomOf="@+id/dialog_rename_track_input_edit_text" />
app:layout_constraintEnd_toEndOf="@+id/dialog_rename_track_textlayout"
app:layout_constraintTop_toBottomOf="@+id/dialog_rename_track_textlayout" />
<Button
android:id="@+id/name_track_cancel_button"
@ -32,7 +39,7 @@
android:layout_marginTop="16dp"
android:text="Cancel"
app:cornerRadius="8dp"
app:layout_constraintStart_toStartOf="@+id/dialog_rename_track_input_edit_text"
app:layout_constraintTop_toBottomOf="@+id/dialog_rename_track_input_edit_text" />
app:layout_constraintStart_toStartOf="@+id/dialog_rename_track_textlayout"
app:layout_constraintTop_toBottomOf="@+id/dialog_rename_track_textlayout" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -31,7 +31,7 @@
<string name="dialog_generic_button_okay">OK</string>
<string name="dialog_generic_details_button">Show details</string>
<string name="dialog_rename_track_button">Rename</string>
<string name="dialog_rename_track_input_hint">Enter a new name</string>
<string name="dialog_rename_track_input_hint">Name this track</string>
<string name="dialog_share_gpx">Share GPX file with</string>
<string name="dialog_yes_no_positive_button_default">Yes</string>
<string name="dialog_yes_no_positive_button_delete_recording">Delete</string>