@@ -7,6 +7,8 @@ import android.graphics.Bitmap
7
7
import android.graphics.drawable.Drawable
8
8
import android.net.Uri
9
9
import android.os.Bundle
10
+ import android.text.Editable
11
+ import android.text.TextWatcher
10
12
import android.view.View
11
13
import android.widget.PopupMenu
12
14
import android.widget.Toast
@@ -17,6 +19,7 @@ import androidx.core.graphics.drawable.toBitmap
17
19
import com.bumptech.glide.request.RequestOptions
18
20
import com.bumptech.glide.request.target.CustomTarget
19
21
import com.bumptech.glide.request.transition.Transition
22
+ import com.google.android.material.textfield.TextInputLayout
20
23
import com.maltaisn.icondialog.IconDialog
21
24
import com.maltaisn.icondialog.IconDialogSettings
22
25
import com.maltaisn.icondialog.data.Icon
@@ -60,8 +63,23 @@ class AddShortcutDialogActivity : AppCompatActivity(), IconDialog.Callback {
60
63
val activityModel = intent?.serializable<ActivityModel >(ARG_ACTIVITY_MODEL )
61
64
val historyModel = intent?.serializable<HistoryModel >(ARG_HISTORY_MODEL )
62
65
63
- binding.label.setText(activityModel?.name)
66
+ binding.label.addTextChangedListener(object : TextWatcher {
67
+ override fun beforeTextChanged (s : CharSequence? , start : Int , count : Int , after : Int ) {
68
+ }
69
+
70
+ override fun onTextChanged (s : CharSequence? , start : Int , before : Int , count : Int ) {
71
+ binding.valueLayout.endIconMode =
72
+ if (count != 0 ) TextInputLayout .END_ICON_CLEAR_TEXT
73
+ else TextInputLayout .END_ICON_DROPDOWN_MENU
74
+ }
75
+
76
+ override fun afterTextChanged (s : Editable ? ) {
77
+ }
78
+ })
79
+ binding.label.setText(activityModel?.label)
64
80
binding.label.text?.let { binding.label.setSelection(it.length) }
81
+ binding.label.setSimpleItems(arrayOf(activityModel?.label, activityModel?.name))
82
+
65
83
66
84
val loader = IconPackLoader (applicationContext)
67
85
iconPack = createMaterialDesignIconPack(loader)
0 commit comments