clarify error messages when layout can't be saved, see #887

This commit is contained in:
Helium314 2024-06-18 17:51:03 +02:00
parent 0b9fb7334d
commit 5b7f4dae4c

View file

@ -114,16 +114,28 @@ private fun checkKeys(keys: List<List<Key.KeyParams>>): Boolean {
Log.w(TAG, "too many keys in one row") Log.w(TAG, "too many keys in one row")
return false return false
} }
if (keys.any { row -> row.any { ((it.mLabel?.length ?: 0) > 20) } }) { if (keys.any { row -> row.any {
Log.w(TAG, "too long text on key") if ((it.mLabel?.length ?: 0) > 20) {
Log.w(TAG, "too long text on key: ${it.mLabel}")
true
} else false
} }) {
return false return false
} }
if (keys.any { row -> row.any { (it.mPopupKeys?.size ?: 0) > 20 } }) { if (keys.any { row -> row.any {
Log.w(TAG, "too many popup keys on a key") if ((it.mPopupKeys?.size ?: 0) > 20) {
Log.w(TAG, "too many popup keys on key ${it.mLabel}")
true
} else false
} }) {
return false return false
} }
if (keys.any { row -> row.any { it.mPopupKeys?.any { popupKey -> (popupKey.mLabel?.length ?: 0) > 10 } == true } }) { if (keys.any { row -> row.any { true == it.mPopupKeys?.any { popupKey ->
Log.w(TAG, "too long text on popup key") if ((popupKey.mLabel?.length ?: 0) > 10) {
Log.w(TAG, "too long text on popup key: ${popupKey.mLabel}")
true
} else false
} } }) {
return false return false
} }
return true return true