private void initStyles(Context context) { TypedValue outValue = new TypedValue(); context.getTheme().resolveAttribute(R.attr.cropImageStyle, outValue, true); TypedArray attributes = context.obtainStyledAttributes(outValue.resourceId, R.styleable.CropImageView); try { showThirds = attributes.getBoolean(R.styleable.CropImageView_showThirds, false); highlightColor = attributes.getColor(R.styleable.CropImageView_highlightColor, DEFAULT_HIGHLIGHT_COLOR); handleMode = HandleMode.values()[attributes.getInt(R.styleable.CropImageView_showHandles, 0)]; } finally { attributes.recycle(); } }
public void setMode(String mode) { this.mode = HandleMode.valueOf(mode); }