mirror of
https://github.com/TonyJiangWJ/Auto.js.git
synced 2026-06-24 21:33:16 +08:00
feat(ui): default dimension dp
This commit is contained in:
parent
8a7966ba3c
commit
aa7318bfbd
@ -45,7 +45,7 @@ function showRegisterUI(){
|
||||
</linear>
|
||||
<linear>
|
||||
<text w="56" gravity="center" color="#111111" size="16">邮箱</text>
|
||||
<input w="*" h="40" inputType="email"/>
|
||||
<input w="*" h="40" inputType="textEmailAddress"/>
|
||||
</linear>
|
||||
<linear gravity="center">
|
||||
<button>确定</button>
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user