burhanrashid52 / PhotoEditor

A Photo Editor library with simple, easy support for image editing using paints,text,filters,emoji and Sticker like stories.
MIT License
4.19k stars 993 forks source link

Emoji gets cut on the bottom. #111

Open vladzbuker opened 6 years ago

vladzbuker commented 6 years ago

Basically, all issue can be explained just in the title. I use the typeface from demo app "emojione-android.ttf". In fact, I use everything from the demo project so there is no point in adding code to this issue.

example

burhanrashid52 commented 6 years ago

Thanks for the issue. Will try to fix it

vasanihardik commented 4 years ago

i have resolved this issue. comment case EMOJI:

txtTextEmoji.setTypeface(mDefaultEmojiTypeface)

; line it is working fine.

changed on PhotoEditor.java file

private View getLayout(final ViewType viewType) {
        View rootView = null;
        switch (viewType) {
            case TEXT:
                rootView = mLayoutInflater.inflate(R.layout.view_photo_editor_text, null);
                TextView txtText = rootView.findViewById(R.id.tvPhotoEditorText);
                if (txtText != null && mDefaultTextTypeface != null) {
                    txtText.setGravity(Gravity.CENTER);
                    if (mDefaultEmojiTypeface != null) {
                        txtText.setTypeface(mDefaultTextTypeface);
                    }
                }
                break;
            case IMAGE:
                rootView = mLayoutInflater.inflate(R.layout.view_photo_editor_image, null);
                break;
            case EMOJI:
                rootView = mLayoutInflater.inflate(R.layout.view_photo_editor_text, null);
                TextView txtTextEmoji = rootView.findViewById(R.id.tvPhotoEditorText);
                /*
                if (txtTextEmoji != null) {
                    if (mDefaultEmojiTypeface != null) {
                        txtTextEmoji.setTypeface(mDefaultEmojiTypeface);
                    }

                }*/
                txtTextEmoji.setGravity(Gravity.CENTER);
                txtTextEmoji.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
                break;
        }

        if (rootView != null) {
            //We are setting tag as ViewType to identify what type of the view it is
            //when we remove the view from stack i.e onRemoveViewListener(ViewType viewType, int numberOfAddedViews);
            rootView.setTag(viewType);
            final ImageView imgClose = rootView.findViewById(R.id.imgPhotoEditorClose);
            final View finalRootView = rootView;
            if (imgClose != null) {
                imgClose.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        viewUndo(finalRootView, viewType);
                    }
                });
            }
        }
        return rootView;
    }