Java 类com.facebook.react.uimanager.CatalystStylesDiffMap 实例源码
项目:react-native-circle-view
文件:ReactCircleViewManager.java
@Override
public void updateView(final CircleProgressView view,
final CatalystStylesDiffMap props) {
BaseViewPropertyApplicator.applyCommonViewProperties(view, props);
if (props.hasKey(PROP_SHOW_TEXT_WHILE_SPINNING)) {
view.setShowTextWhileSpinning(props.getBoolean(PROP_SHOW_TEXT_WHILE_SPINNING, false));
}
if (props.hasKey(PROP_AUTO_TEXT_SIZE)) {
view.setAutoTextSize(props.getBoolean(PROP_AUTO_TEXT_SIZE, false));
}
if (props.hasKey(PROP_AUTO_TEXT_COLOR)) {
view.setAutoTextColor(props.getBoolean(PROP_AUTO_TEXT_COLOR, false));
}
if (props.hasKey(PROP_SHOW_UNIT)) {
view.setShowUnit(props.getBoolean(PROP_SHOW_UNIT, true));
}
if (props.hasKey(PROP_TEXT_SIZE)) {
view.setTextSize(props.getInt(PROP_TEXT_SIZE, 10));
}
if (props.hasKey(PROP_UNIT_SIZE)) {
view.setUnitSize(props.getInt(PROP_UNIT_SIZE, 10));
}
if (props.hasKey(PROP_CONTOUR_SIZE)) {
view.setContourSize(props.getFloat(PROP_CONTOUR_SIZE, 1));
}
if (props.hasKey(PROP_BAR_WIDTH)) {
view.setBarWidth(props.getInt(PROP_BAR_WIDTH, 1));
}
if (props.hasKey(PROP_RIM_WIDTH)) {
view.setRimWidth(props.getInt(PROP_RIM_WIDTH, 1));
}
if (props.hasKey(PROP_MAX_VALUE)) {
view.setMaxValue(props.getInt(PROP_MAX_VALUE, 100));
}
if (props.hasKey(PROP_VALUE)) {
view.setValue(props.getInt(PROP_VALUE, 0));
}
if (props.hasKey(PROP_VALUE_ANIMATED)) {
view.setValueAnimated(props.getInt(PROP_VALUE_ANIMATED, 42));
}
if (props.hasKey(PROP_СONTOUR_COLOR)) {
view.setContourColor(Color.parseColor(props.getString(PROP_СONTOUR_COLOR)));
}
if (props.hasKey(PROP_RIM_COLOR)) {
view.setRimColor(Color.parseColor(props.getString(PROP_RIM_COLOR)));
}
if (props.hasKey(PROP_BAR_COLOR)) {
int size = props.getArray(PROP_BAR_COLOR).size();
int[] colors = new int[size];
for (int i = 0; i < size; i++) {
colors[i] = Color.parseColor(props.getArray(PROP_BAR_COLOR).getString(i));
}
view.setBarColor(colors);
}
Log.i("CircleProgressView", "updateview finish");
super.updateView(view, props);
}