feat(ui): default dimension dp
This commit is contained in:
@@ -59,7 +59,7 @@ public class Dimensions {
|
||||
if (!m.matches()) {
|
||||
throw new InflateException("dimension cannot be resolved: " + dimension);
|
||||
}
|
||||
int unit = m.groupCount() == 2 ? UNITS.get(m.group(2)) : TypedValue.COMPLEX_UNIT_PX;
|
||||
int unit = m.groupCount() == 2 ? UNITS.getOr(m.group(2), TypedValue.COMPLEX_UNIT_DIP) : TypedValue.COMPLEX_UNIT_DIP;
|
||||
float value = Integer.valueOf(m.group(1));
|
||||
return TypedValue.applyDimension(unit, value, context.getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
@@ -22,6 +22,15 @@ public class ValueMapper<V> {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public V getOr(String key, V defValue) {
|
||||
V v = mHashMap.get(key);
|
||||
if (v == null) {
|
||||
return defValue;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public V get(String key) {
|
||||
V v = mHashMap.get(key);
|
||||
if (v == null) {
|
||||
|
||||
Reference in New Issue
Block a user