use of net.iGap.libs.photoEdit.BrushDrawingView in project iGap-Android by KianIranian-STDG.
the class PhotoViewer method onViewRemoved.
@Override
public void onViewRemoved(BrushDrawingView brushDrawingView) {
if (addedViews.get(viewHolderPostion).size() > 0) {
View removeView = addedViews.get(viewHolderPostion).remove(addedViews.get(viewHolderPostion).size() - 1);
if (!(removeView instanceof BrushDrawingView)) {
textStickersParentView.removeView(removeView);
}
onPaintChanged.setValue(addedViews.size());
redoViews.add(removeView);
if (addedViews.get(viewHolderPostion).size() == 0) {
mode = StoryModes.NONE;
modes.put(viewHolderPostion, StoryModes.NONE);
}
}
}
use of net.iGap.libs.photoEdit.BrushDrawingView in project iGap-Android by KianIranian-STDG.
the class PhotoViewer method undo.
public boolean undo() {
if (addedViews.get(viewHolderPostion).size() > 0) {
View removeView = addedViews.get(viewHolderPostion).get(addedViews.get(viewHolderPostion).size() - 1);
if (removeView instanceof BrushDrawingView) {
return textStickersParentView.getmBrushDrawingView() != null && textStickersParentView.getmBrushDrawingView().undo();
} else {
addedViews.get(viewHolderPostion).remove(addedViews.get(viewHolderPostion).size() - 1);
textStickersParentView.removeView(removeView);
redoViews.add(removeView);
onPaintChanged.setValue(addedViews.size());
if (addedViews.get(viewHolderPostion).size() == 0) {
mode = StoryModes.NONE;
modes.put(viewHolderPostion, StoryModes.NONE);
}
}
}
return addedViews.get(viewHolderPostion).size() != 0;
}
use of net.iGap.libs.photoEdit.BrushDrawingView in project iGap-Android by KianIranian-STDG.
the class TextStickerView method init.
private void init(@Nullable AttributeSet attrs) {
// Setup image attributes
if (bitmapHolderImageView == null) {
bitmapHolderImageView = new FilterImageView(getContext());
RelativeLayout.LayoutParams imageViewParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
imageViewParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
bitmapHolderImageView.setLayoutParams(imageViewParams);
bitmapHolderImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
bitmapHolderImageView.setAdjustViewBounds(true);
bitmapHolderImageView.setDrawingCacheEnabled(true);
addView(bitmapHolderImageView, imageViewParams);
}
if (attrs != null) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PhotoEditorView);
Drawable imgSrcDrawable = a.getDrawable(R.styleable.PhotoEditorView_photo_src);
if (imgSrcDrawable != null) {
bitmapHolderImageView.setImageDrawable(imgSrcDrawable);
}
}
// Setup brush view
if (mBrushDrawingView == null) {
mBrushDrawingView = new BrushDrawingView(getContext());
// mBrushDrawingView.setVisibility(GONE);
mBrushDrawingView.setId(brushSrcId);
// Align brush to the size of image view
RelativeLayout.LayoutParams brushParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
brushParam.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
brushParam.addRule(RelativeLayout.ALIGN_TOP, imgSrcId);
brushParam.addRule(RelativeLayout.ALIGN_BOTTOM, imgSrcId);
// Setup GLSurface attributes
mImageFilterView = new ImageFilterView(getContext());
mImageFilterView.setId(glFilterId);
mImageFilterView.setVisibility(GONE);
// Align brush to the size of image view
RelativeLayout.LayoutParams imgFilterParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
imgFilterParam.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
imgFilterParam.addRule(RelativeLayout.ALIGN_TOP, imgSrcId);
imgFilterParam.addRule(RelativeLayout.ALIGN_BOTTOM, imgSrcId);
addView(mImageFilterView, imgFilterParam);
// Add brush view
addView(mBrushDrawingView, brushParam);
}
}
use of net.iGap.libs.photoEdit.BrushDrawingView in project iGap-Android by KianIranian-STDG.
the class CustomPaintView method init.
@SuppressLint("Recycle")
private void init(@Nullable AttributeSet attrs) {
// Setup image attributes
mImgSource = new FilterImageView(getContext());
mImgSource.setId(imgSrcId);
mImgSource.setAdjustViewBounds(true);
RelativeLayout.LayoutParams imgSrcParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
imgSrcParam.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
if (attrs != null) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PhotoEditorView);
Drawable imgSrcDrawable = a.getDrawable(R.styleable.PhotoEditorView_photo_src);
if (imgSrcDrawable != null) {
mImgSource.setImageDrawable(imgSrcDrawable);
}
}
// Setup brush view
mBrushDrawingView = new BrushDrawingView(getContext());
// mBrushDrawingView.setVisibility(GONE);
mBrushDrawingView.setId(brushSrcId);
// Align brush to the size of image view
RelativeLayout.LayoutParams brushParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
brushParam.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
brushParam.addRule(RelativeLayout.ALIGN_TOP, imgSrcId);
brushParam.addRule(RelativeLayout.ALIGN_BOTTOM, imgSrcId);
// Align brush to the size of image view
RelativeLayout.LayoutParams imgFilterParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
imgFilterParam.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
imgFilterParam.addRule(RelativeLayout.ALIGN_TOP, imgSrcId);
imgFilterParam.addRule(RelativeLayout.ALIGN_BOTTOM, imgSrcId);
// Add image source
addView(mImgSource, imgSrcParam);
// Add brush view
addView(mBrushDrawingView, brushParam);
}
Aggregations