@Test public void testGetElevation() { int elevation = 100, viewPortW = 750; attr.put(Constants.Name.ELEVATION, elevation); assertThat(attr.getElevation(viewPortW), is(WXViewUtils.getRealSubPxByWidth(elevation, viewPortW))); attr.put(Constants.Name.ELEVATION, ""); assertThat(attr.getElevation(viewPortW), is(0f)); attr.put(Constants.Name.ELEVATION, "give me a NAN"); assertThat(attr.getElevation(viewPortW), is(Float.NaN)); }
public float getElevation(int viewPortW) { Object obj = get(Constants.Name.ELEVATION); float ret = Float.NaN; if (obj != null) { String number = obj.toString(); if (!TextUtils.isEmpty(number)) { ret = WXViewUtils.getRealSubPxByWidth(WXUtils.getFloat(number),viewPortW); } else { ret = 0; } } return ret; }
WXAttr implements Map<String, Object>,Cloneable { public float getElevation(int viewPortW) { Object obj = get(Constants.Name.ELEVATION); float ret = Float.NaN; if (obj != null) { String number = obj.toString(); if (!TextUtils.isEmpty(number)) { ret = WXViewUtils.getRealSubPxByWidth(WXUtils.getFloat(number),viewPortW); } else { ret = 0; } } return ret; } }
WXAttr implements Map<String, Object>,Cloneable { public float getElevation(int viewPortW) { Object obj = get(Constants.Name.ELEVATION); float ret = Float.NaN; if (obj != null) { String number = obj.toString(); if (!TextUtils.isEmpty(number)) { ret = WXViewUtils.getRealSubPxByWidth(WXUtils.getFloat(number),viewPortW); } else { ret = 0; } } return ret; } WXAttr();  WXAttr(@NonNull Map<String,Object> standardMap); }
WXAttr implements Map<String, Object>,Cloneable { public float getElevation(int viewPortW) { Object obj = get(Constants.Name.ELEVATION); float ret = Float.NaN; if (obj != null) { String number = obj.toString(); if (!TextUtils.isEmpty(number)) { ret = WXViewUtils.getRealSubPxByWidth(WXUtils.getFloat(number),viewPortW); } else { ret = 0; } } return ret; } WXAttr();  WXAttr(@NonNull Map<String,Object> standardMap); static String getPrefix(Map<String, Object> attr); static String getSuffix(Map<String, Object> attr); static String getValue(Map<String, Object> attr); WXImageQuality getImageQuality(); WXImageSharpen getImageSharpen(); String getImageSrc(); boolean showIndicators(); boolean autoPlay(); String getScope(); String getLoadMoreRetry(); String getLoadMoreOffset(); String optString(String key); boolean getIsRecycleImage(); String getScrollDirection(); float getElevation(int viewPortW); @Override boolean equals(Object o); @Override int hashCode(); @Override void clear(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @NonNull @Override Set<Entry<String, Object>> entrySet(); @Override Object get(Object key); @Override boolean isEmpty(); @NonNull @Override Set<String> keySet(); @Override Object put(String key, Object value); @Override void putAll(Map<? extends String, ?> map); @Override Object remove(Object key); @Override int size(); @NonNull @Override Collection<Object> values(); }
WXAttr implements Map<String, Object>,Cloneable { public float getElevation(int viewPortW) { Object obj = get(Constants.Name.ELEVATION); float ret = Float.NaN; if (obj != null) { String number = obj.toString(); if (!TextUtils.isEmpty(number)) { ret = WXViewUtils.getRealSubPxByWidth(WXUtils.getFloat(number),viewPortW); } else { ret = 0; } } return ret; } WXAttr();  WXAttr(@NonNull Map<String,Object> standardMap); static String getPrefix(Map<String, Object> attr); static String getSuffix(Map<String, Object> attr); static String getValue(Map<String, Object> attr); WXImageQuality getImageQuality(); WXImageSharpen getImageSharpen(); String getImageSrc(); boolean showIndicators(); boolean autoPlay(); String getScope(); String getLoadMoreRetry(); String getLoadMoreOffset(); String optString(String key); boolean getIsRecycleImage(); String getScrollDirection(); float getElevation(int viewPortW); @Override boolean equals(Object o); @Override int hashCode(); @Override void clear(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @NonNull @Override Set<Entry<String, Object>> entrySet(); @Override Object get(Object key); @Override boolean isEmpty(); @NonNull @Override Set<String> keySet(); @Override Object put(String key, Object value); @Override void putAll(Map<? extends String, ?> map); @Override Object remove(Object key); @Override int size(); @NonNull @Override Collection<Object> values();  }