public static Rect fromString(String kanmaValues) { checkNotNull(kanmaValues); String[] vs = kanmaValues.split(","); // checkArgument(vs.length==4,"invalid rect format:%s",kanmaValues); if (vs.length != 4) { return new Rect(); // } int x = ValuesUtils.toInt(vs[0], 0); int y = ValuesUtils.toInt(vs[1], 0); int w = ValuesUtils.toInt(vs[2], 0); int h = ValuesUtils.toInt(vs[3], 0); return new Rect(x, y, w, h); }
public static PointXY fromString(String text) { if (text == null || text.isEmpty()) { return new PointXY(0, 0); } int index = text.indexOf("x"); if (index == -1) { return new PointXY(0, 0); } int x = ValuesUtils.toInt(text.substring(0, index), 0); int y = ValuesUtils.toInt(text.substring(index + 1), 0); return new PointXY(x, y); }