Search in sources :

Example 1 with BrushDrawingView

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);
        }
    }
}
Also used : BrushDrawingView(net.iGap.libs.photoEdit.BrushDrawingView) ImageView(android.widget.ImageView) BrushDrawingView(net.iGap.libs.photoEdit.BrushDrawingView) RippleView(net.iGap.libs.rippleeffect.RippleView) CropImageView(com.theartofdev.edmodo.cropper.CropImageView) View(android.view.View) KeyboardView(net.iGap.libs.emojiKeyboard.KeyboardView) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) EmojiView(net.iGap.libs.emojiKeyboard.EmojiView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView)

Example 2 with BrushDrawingView

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;
}
Also used : BrushDrawingView(net.iGap.libs.photoEdit.BrushDrawingView) ImageView(android.widget.ImageView) BrushDrawingView(net.iGap.libs.photoEdit.BrushDrawingView) RippleView(net.iGap.libs.rippleeffect.RippleView) CropImageView(com.theartofdev.edmodo.cropper.CropImageView) View(android.view.View) KeyboardView(net.iGap.libs.emojiKeyboard.KeyboardView) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) EmojiView(net.iGap.libs.emojiKeyboard.EmojiView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView)

Example 3 with BrushDrawingView

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);
    }
}
Also used : BrushDrawingView(net.iGap.libs.photoEdit.BrushDrawingView) TypedArray(android.content.res.TypedArray) RelativeLayout(android.widget.RelativeLayout) Drawable(android.graphics.drawable.Drawable) FilterImageView(net.iGap.libs.photoEdit.FilterImageView)

Example 4 with BrushDrawingView

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);
}
Also used : BrushDrawingView(net.iGap.libs.photoEdit.BrushDrawingView) TypedArray(android.content.res.TypedArray) RelativeLayout(android.widget.RelativeLayout) Drawable(android.graphics.drawable.Drawable) FilterImageView(net.iGap.libs.photoEdit.FilterImageView) SuppressLint(android.annotation.SuppressLint)

Aggregations

BrushDrawingView (net.iGap.libs.photoEdit.BrushDrawingView)4 TypedArray (android.content.res.TypedArray)2 Drawable (android.graphics.drawable.Drawable)2 View (android.view.View)2 ImageView (android.widget.ImageView)2 RelativeLayout (android.widget.RelativeLayout)2 TextView (android.widget.TextView)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 CropImageView (com.theartofdev.edmodo.cropper.CropImageView)2 EmojiView (net.iGap.libs.emojiKeyboard.EmojiView)2 KeyboardView (net.iGap.libs.emojiKeyboard.KeyboardView)2 FilterImageView (net.iGap.libs.photoEdit.FilterImageView)2 RippleView (net.iGap.libs.rippleeffect.RippleView)2 MaterialDesignTextView (net.iGap.module.MaterialDesignTextView)2 SuppressLint (android.annotation.SuppressLint)1