mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-22 07:09:10 +00:00
only show default button in reorder dialog if default actually exists
This commit is contained in:
parent
a4b07d6de2
commit
10c0b64e45
1 changed files with 6 additions and 4 deletions
|
@ -119,16 +119,18 @@ fun reorderDialog(
|
||||||
|
|
||||||
adapter.submitList(orderedItems)
|
adapter.submitList(orderedItems)
|
||||||
|
|
||||||
AlertDialog.Builder(context)
|
val builder = AlertDialog.Builder(context)
|
||||||
.setTitle(dialogTitleId)
|
.setTitle(dialogTitleId)
|
||||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||||
val value = orderedItems.joinToString(";") { it.first + "," + it.second }
|
val value = orderedItems.joinToString(";") { it.first + "," + it.second }
|
||||||
prefs.edit().putString(key, value).apply()
|
prefs.edit().putString(key, value).apply()
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.setNeutralButton(R.string.button_default) { _, _ ->
|
.setView(rv)
|
||||||
|
if (prefs.contains(key))
|
||||||
|
builder.setNeutralButton(R.string.button_default) { _, _ ->
|
||||||
prefs.edit().remove(key).apply()
|
prefs.edit().remove(key).apply()
|
||||||
}
|
}
|
||||||
.setView(rv)
|
|
||||||
.show()
|
builder.show()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue