Updated on 2026-08-14
This commit is contained in:
parent
6a7d67e0c0
commit
a0c675b051
4 changed files with 35 additions and 12 deletions
|
|
@ -7,6 +7,7 @@ import android.widget.Button
|
|||
import android.widget.EditText
|
||||
import android.widget.LinearLayout
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.DividerItemDecoration
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.transition.Fade
|
||||
|
|
@ -155,7 +156,8 @@ class PersonalizationFragment : BaseCardActionFragment(), PersonalizationPresetV
|
|||
dlg.setTitle(R.string.menu_personalization_preset_save)
|
||||
dlg.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.btn_cancel)) { dialog, which -> }
|
||||
dlg.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.btn_ok)) { dialog, which ->
|
||||
val tvName = dlgController.view?.findViewById<EditText>(R.id.et_item) ?: return@setButton
|
||||
val tvName = dlgController.view?.findViewById<EditText>(R.id.et_item)
|
||||
?: return@setButton
|
||||
val name = tvName.text.toString()
|
||||
if (name.isEmpty()) showSnackbar("Not saved")
|
||||
else onOk.invoke(name)
|
||||
|
|
@ -169,7 +171,10 @@ class PersonalizationFragment : BaseCardActionFragment(), PersonalizationPresetV
|
|||
dlg.setTitle(R.string.menu_personalization_preset_load)
|
||||
val rvPresetNames: RecyclerView = dlgController.view?.findViewById(R.id.recycler_view) ?: return
|
||||
|
||||
rvPresetNames.layoutManager = LinearLayoutManager(context)
|
||||
val layoutManager = LinearLayoutManager(context)
|
||||
rvPresetNames.layoutManager = layoutManager
|
||||
rvPresetNames.addItemDecoration(DividerItemDecoration(activity, layoutManager.orientation))
|
||||
|
||||
rvPresetNames.adapter = RvPresetNamesAdapter({
|
||||
onChoose(it)
|
||||
dlgController.dismiss()
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class PresetNameVH(
|
|||
private val onDeleteClicked: (Int, String) -> Unit
|
||||
) : RvVH<String>(itemView) {
|
||||
private val tvName = itemView.findViewById<TextView>(R.id.tv_name)
|
||||
private val btnDelete = itemView.findViewById<Button>(R.id.btn_delete)
|
||||
private val btnDelete = itemView.findViewById<View>(R.id.btn_delete)
|
||||
override fun onDataBound(data: String) {
|
||||
tvName.text = data
|
||||
tvName.isClickable = false
|
||||
|
|
|
|||
|
|
@ -1,6 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/recycler_view"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/def_indent"/>
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/def_indent"
|
||||
android:paddingBottom="@dimen/def_half_indent">
|
||||
|
||||
<include
|
||||
layout="@layout/m_divider_h"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/def_indent"
|
||||
android:layout_marginEnd="@dimen/def_indent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -11,22 +11,25 @@
|
|||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_delete"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:hint="Field name" />
|
||||
|
||||
<Button
|
||||
<ImageView
|
||||
android:id="@+id/btn_delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:text="@string/btn_delete"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@android:drawable/ic_menu_delete" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue