Fixed: Use default values if extra-keys or extra-keys-style termux.properties values are empty

This commit is contained in:
agnostic-apollo
2021-08-23 08:24:19 +05:00
parent 2a74d43ca5
commit fbb91149b5
2 changed files with 13 additions and 2 deletions

View File

@@ -553,6 +553,17 @@ public class SharedProperties {
return (object == null) ? def : object;
}
/**
* Get the {@link String} object itself if it is not {@code null} or empty, otherwise default.
*
* @param object The {@link String} to check.
* @param def The default {@link String}.
* @return Returns {@code object} if it is not {@code null}, otherwise returns {@code def}.
*/
public static String getDefaultIfNullOrEmpty(@androidx.annotation.Nullable String object, @androidx.annotation.Nullable String def) {
return (object == null || object.isEmpty()) ? def : object;
}
/**
* Covert the {@link String} value to lowercase.
*

View File

@@ -423,7 +423,7 @@ public class TermuxSharedProperties {
* @return Returns the internal value for value.
*/
public static String getExtraKeysInternalPropertyValueFromValue(String value) {
return SharedProperties.getDefaultIfNull(value, TermuxPropertyConstants.DEFAULT_IVALUE_EXTRA_KEYS);
return SharedProperties.getDefaultIfNullOrEmpty(value, TermuxPropertyConstants.DEFAULT_IVALUE_EXTRA_KEYS);
}
/**
@@ -433,7 +433,7 @@ public class TermuxSharedProperties {
* @return Returns the internal value for value.
*/
public static String getExtraKeysStyleInternalPropertyValueFromValue(String value) {
return SharedProperties.getDefaultIfNull(value, TermuxPropertyConstants.DEFAULT_IVALUE_EXTRA_KEYS_STYLE);
return SharedProperties.getDefaultIfNullOrEmpty(value, TermuxPropertyConstants.DEFAULT_IVALUE_EXTRA_KEYS_STYLE);
}
/**