public Text(Context context, HashMap<Object, Object> hashMap) { super(context); if (Tools.isString(hashMap.get("value"))) { this.setValue((String) hashMap.get("value")); LinearLayout.LayoutParams view_params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); view.setLayoutParams(view_params); if (Tools.isString(hashMap.get("align"))) { String valueAlign = (String) hashMap.get("align"); this.setAlignment(valueAlign); } if (Tools.isString(hashMap.get("appearance"))) { String appearance = (String) hashMap.get("appearance"); this.setAppearance(appearance); } if (Tools.isHashmap(hashMap.get("shadow"))) { this.setShadow((HashMap<Object, Object>) hashMap.get("shadow")); } this.properties = hashMap; } }
public void setShadow(HashMap<Object, Object> shadow) { int color = Color.BLACK; if (Tools.isString(shadow.get("color"))) { color = Tools.parseColor((String) shadow.get("color")); } int offsetX = 3; if (Tools.isInt(shadow.get("x"))) { offsetX = (Integer) shadow.get("x") * 2; } int offsetY = 3; if (Tools.isInt(shadow.get("y"))) { offsetY = (Integer) shadow.get("y") * 2; } float scale = 1.5f; if (Tools.isInt(shadow.get("scale"))) { scale = (Integer) shadow.get("scale") * 2; } view.setShadowLayer(scale, offsetX, offsetY, color); }