mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 10:45:23 +08:00
Fixed: Use default values if extra-keys or extra-keys-style termux.properties values are empty
This commit is contained in:
@@ -553,6 +553,17 @@ public class SharedProperties {
|
|||||||
return (object == null) ? def : object;
|
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.
|
* Covert the {@link String} value to lowercase.
|
||||||
*
|
*
|
||||||
|
@@ -423,7 +423,7 @@ public class TermuxSharedProperties {
|
|||||||
* @return Returns the internal value for value.
|
* @return Returns the internal value for value.
|
||||||
*/
|
*/
|
||||||
public static String getExtraKeysInternalPropertyValueFromValue(String 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.
|
* @return Returns the internal value for value.
|
||||||
*/
|
*/
|
||||||
public static String getExtraKeysStyleInternalPropertyValueFromValue(String 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user