mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Don't allow empty name in app rename
This commit is contained in:
parent
3d6b2068a6
commit
d20191529d
3 changed files with 8 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.appcompat.widget.AppCompatButton
|
import androidx.appcompat.widget.AppCompatButton
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
|
@ -157,6 +158,10 @@ class AppActionMenu(private val activity: MainActivity, private val binding: Act
|
||||||
|
|
||||||
// Once the new name is confirmed, close the keyboard, save the new app name and update the apps on screen
|
// Once the new name is confirmed, close the keyboard, save the new app name and update the apps on screen
|
||||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||||
|
if (editText.text.isNullOrBlank()) {
|
||||||
|
Toast.makeText(activity, activity.getString(R.string.empty_rename), Toast.LENGTH_SHORT).show()
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
val imm =
|
val imm =
|
||||||
activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
imm.hideSoftInputFromWindow(editText.windowToken, 0)
|
imm.hideSoftInputFromWindow(editText.windowToken, 0)
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
<string name="launch_error">Sovelluksen avaaminen epäonnistui</string>
|
<string name="launch_error">Sovelluksen avaaminen epäonnistui</string>
|
||||||
|
|
||||||
<!--Action Menu Items-->
|
<!--Action Menu Items-->
|
||||||
|
<string name="empty_rename">Tyhjää sovelluksen nimeä ei voi määrittää</string>
|
||||||
<string name="info">Tiedot</string>
|
<string name="info">Tiedot</string>
|
||||||
<string name="uninstall">Poista</string>
|
<string name="uninstall">Poista</string>
|
||||||
<string name="rename">Nimeä</string>
|
<string name="rename">Nimeä</string>
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
<string name="launch_error">Cannot launch app</string>
|
<string name="launch_error">Cannot launch app</string>
|
||||||
|
|
||||||
|
<string name="empty_rename">Cannot set empty app name</string>
|
||||||
|
|
||||||
<!--Action Menu Items-->
|
<!--Action Menu Items-->
|
||||||
<string name="info">Info</string>
|
<string name="info">Info</string>
|
||||||
<string name="uninstall">Uninstall</string>
|
<string name="uninstall">Uninstall</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue