UIDefaultsLoader: detect string values, that start and end with '"', after determining value type from key to allow font values like "Roboto Mono"

This commit is contained in:
Karl Tauber
2021-10-17 14:59:18 +02:00
parent 80f51bfe1e
commit 80297f113f

View File

@@ -410,10 +410,7 @@ class UIDefaultsLoader
// check whether value type is specified in the value // check whether value type is specified in the value
if( value.startsWith( "#" ) ) if( value.startsWith( "#" ) )
valueType = ValueType.COLOR; valueType = ValueType.COLOR;
else if( value.startsWith( "\"" ) && value.indexOf( '"', 1 ) == value.length() - 1 ) { else if( value.startsWith( TYPE_PREFIX ) ) {
valueType = ValueType.STRING;
value = value.substring( 1, value.length() - 1 );
} else if( value.startsWith( TYPE_PREFIX ) ) {
int end = value.indexOf( TYPE_PREFIX_END ); int end = value.indexOf( TYPE_PREFIX_END );
if( end != -1 ) { if( end != -1 ) {
try { try {
@@ -482,6 +479,12 @@ class UIDefaultsLoader
case GRAYFILTER: return parseGrayFilter( value ); case GRAYFILTER: return parseGrayFilter( value );
case UNKNOWN: case UNKNOWN:
default: default:
// string
if( value.startsWith( "\"" ) && value.endsWith( "\"" ) ) {
resultValueType[0] = ValueType.STRING;
return value.substring( 1, value.length() - 1 );
}
// colors // colors
Object color = parseColorOrFunction( value, resolver, false ); Object color = parseColorOrFunction( value, resolver, false );
if( color != null ) { if( color != null ) {