Search in sources :

Example 1 with NotifyFrameLayout

use of net.iGap.libs.emojiKeyboard.NotifyFrameLayout in project iGap-Android by KianIranian-STDG.

the class PhotoViewer method createView.

@SuppressLint("ResourceType")
@Override
public View createView(Context context) {
    if (getActivity() != null) {
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
    rootView = new NotifyFrameLayout(context) {

        @Override
        public boolean dispatchKeyEventPreIme(KeyEvent event) {
            if (event != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
                if (isKeyboardVisible()) {
                    showPopUPView(-1);
                    return true;
                }
                return false;
            }
            return super.dispatchKeyEventPreIme(event);
        }
    };
    rootView.setListener(this);
    rootView.setBackgroundColor(context.getResources().getColor(R.color.black_register));
    rootView.setClickable(true);
    toolbar = new Toolbar(context);
    toolbar.setContentInsetStartWithNavigation(0);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        toolbar.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
        rootView.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
    } else {
        ViewCompat.setLayoutDirection(toolbar, ViewCompat.LAYOUT_DIRECTION_LTR);
        ViewCompat.setLayoutDirection(rootView, ViewCompat.LAYOUT_DIRECTION_LTR);
    }
    toolbar.setBackgroundColor(context.getResources().getColor(R.color.colorEditImageBlack));
    viewPager = new CustomViewPager(context);
    rootView.addView(viewPager, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    cancelCropLayout = new LinearLayout(context);
    cancelCropLayout.setOrientation(LinearLayout.HORIZONTAL);
    cancelCropLayout.setBackgroundColor(context.getResources().getColor(R.color.colorEditImageBlack2));
    rippleView = new RippleView(context);
    rippleView.setCentered(true);
    rippleView.setRippleAlpha(200);
    rippleView.setRippleDuration(0);
    rippleView.setRipplePadding(5);
    cancelCropLayout.addView(rippleView, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT));
    designTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
    designTextView.setText(context.getString(R.string.icon_close));
    designTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
    designTextView.setGravity(Gravity.CENTER);
    rippleView.addView(designTextView, LayoutCreator.createRelative(48, LayoutCreator.MATCH_PARENT));
    emptyView = new View(context);
    cancelCropLayout.addView(emptyView, LayoutCreator.createLinear(0, LayoutCreator.MATCH_PARENT, 1F));
    revertTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
    revertTextView.setText(context.getString(R.string.icon_forward));
    revertTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
    revertTextView.setGravity(Gravity.CENTER);
    revertTextView.setVisibility(View.GONE);
    cancelCropLayout.addView(revertTextView, LayoutCreator.createLinear(52, 52));
    cropTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
    cropTextView.setGravity(Gravity.CENTER);
    cropTextView.setText(context.getString(R.string.icon_crop_picture));
    cropTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
    cancelCropLayout.addView(cropTextView, LayoutCreator.createLinear(52, LayoutCreator.MATCH_PARENT));
    editTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
    editTextView.setGravity(Gravity.CENTER);
    editTextView.setText(getString(R.string.icon_edit_picture));
    editTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
    cancelCropLayout.addView(editTextView, LayoutCreator.createLinear(52, LayoutCreator.MATCH_PARENT, 0, 0, 8, 0));
    emoji = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
    emoji.setGravity(Gravity.CENTER);
    emoji.setText(getString(R.string.icon_emoji_smile));
    emoji.setTextColor(context.getResources().getColor(R.color.white));
    emoji.setTextSize(26);
    cancelCropLayout.addView(emoji, LayoutCreator.createLinear(52, LayoutCreator.MATCH_PARENT, 0, 0, 8, 0));
    addTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
    addTextView.setGravity(Gravity.CENTER);
    addTextView.setBackground(context.getResources().getDrawable(R.drawable.ic_cam_text));
    addTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
    cancelCropLayout.addView(addTextView, LayoutCreator.createLinear(30, 30, 0, 0, 8, 0));
    paintTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
    paintTextView.setGravity(Gravity.CENTER);
    paintTextView.setText(getString(R.string.icon_edit));
    paintTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
    cancelCropLayout.addView(paintTextView, LayoutCreator.createLinear(52, 52, 0, 0, 8, 0));
    rootView.addView(cancelCropLayout, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 60, Gravity.TOP));
    LinearLayout bottomRootView = new LinearLayout(context);
    bottomRootView.setOrientation(LinearLayout.VERTICAL);
    LinearLayout bottomRecyclerViewContainer = new LinearLayout(context);
    bottomRecyclerViewContainer.setOrientation(LinearLayout.VERTICAL);
    bottomRecyclerViewContainer.setBackground(context.getResources().getDrawable(R.drawable.background_transparent));
    bottomRootView.addView(bottomRecyclerViewContainer, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, 0, 0, 0, 7));
    previewRecycler = new RecyclerView(context);
    previewRecycler.setLayoutManager(new LinearLayoutManager(context, RecyclerView.HORIZONTAL, false));
    bottomRecyclerViewContainer.addView(previewRecycler, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    bottomLayoutPanel = new LinearLayout(context);
    bottomLayoutPanel.setOrientation(LinearLayout.VERTICAL);
    bottomLayoutPanel.setBackgroundColor(context.getResources().getColor(R.color.colorEditImageBlack));
    bottomRootView.addView(bottomLayoutPanel, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    layoutCaption = new LinearLayout(context);
    layoutCaption.setOrientation(LinearLayout.HORIZONTAL);
    layoutCaption.setMinimumHeight(48);
    layoutCaption.setPadding(4, 0, 4, 0);
    bottomLayoutPanel.addView(layoutCaption, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, 60, Gravity.CENTER));
    keyboardEmoji = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
    keyboardEmoji.setGravity(Gravity.CENTER);
    keyboardEmoji.setPadding(8, 0, 8, 8);
    keyboardEmoji.setText(context.getString(R.string.icon_emoji_smile));
    keyboardEmoji.setTextColor(context.getResources().getColor(R.color.white));
    keyboardEmoji.setTextSize(26);
    layoutCaption.addView(keyboardEmoji, LayoutCreator.createLinear(30, 30, Gravity.CENTER, 0, 0, 0, 0));
    captionEditText = new EventEditText(context);
    captionEditText.setGravity(Gravity.BOTTOM);
    captionEditText.setHint(context.getString(R.string.type_message));
    captionEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    captionEditText.setMaxLines(4);
    captionEditText.setPadding(10, 0, 10, 8);
    captionEditText.setTextColor(context.getResources().getColor(R.color.white));
    captionEditText.setHintTextColor(context.getResources().getColor(R.color.light_gray));
    captionEditText.setTextSize(14);
    captionEditText.setBackground(null);
    layoutCaption.addView(captionEditText, LayoutCreator.createLinear(0, LayoutCreator.WRAP_CONTENT, 1, Gravity.CENTER));
    iconOkTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
    iconOkTextView.setGravity(Gravity.BOTTOM);
    iconOkTextView.setPadding(8, 0, 8, 8);
    iconOkTextView.setText(context.getString(R.string.icon_check_ok));
    iconOkTextView.setTextColor(context.getResources().getColor(R.color.white));
    iconOkTextView.setTextSize(26);
    iconOkTextView.setVisibility(View.GONE);
    layoutCaption.addView(iconOkTextView, LayoutCreator.createLinear(52, 52, Gravity.BOTTOM));
    chatKeyBoardContainer = new FrameLayout(context);
    bottomLayoutPanel.addView(chatKeyBoardContainer, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT));
    pickerViewSendButton = new ImageView(context);
    pickerViewSendButton.setScaleType(ImageView.ScaleType.CENTER);
    pickerViewSendButton.setImageResource(R.drawable.attach_send);
    layoutCaption.addView(pickerViewSendButton, LayoutCreator.createLinear(40, 40, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 8, 0));
    progressBar = new ProgressBar(context);
    progressBar.setVisibility(View.GONE);
    layoutCaption.addView(progressBar, LayoutCreator.createLinear(40, 40, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 8, 0));
    sendTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
    sendTextView.setGravity(Gravity.CENTER);
    sendTextView.setText(context.getString(R.string.icon_send));
    sendTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
    sendTextView.setVisibility(View.GONE);
    rootView.addView(bottomRootView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM));
    return rootView;
}
Also used : EventEditText(net.iGap.module.customView.EventEditText) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) RippleView(net.iGap.libs.rippleeffect.RippleView) 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) KeyEvent(android.view.KeyEvent) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) ContextThemeWrapper(android.view.ContextThemeWrapper) FrameLayout(android.widget.FrameLayout) NotifyFrameLayout(net.iGap.libs.emojiKeyboard.NotifyFrameLayout) RecyclerView(androidx.recyclerview.widget.RecyclerView) ImageView(android.widget.ImageView) CropImageView(com.theartofdev.edmodo.cropper.CropImageView) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout) NotifyFrameLayout(net.iGap.libs.emojiKeyboard.NotifyFrameLayout) Toolbar(androidx.appcompat.widget.Toolbar) SuppressLint(android.annotation.SuppressLint)

Example 2 with NotifyFrameLayout

use of net.iGap.libs.emojiKeyboard.NotifyFrameLayout in project iGap-Android by KianIranian-STDG.

the class StoryDisplayFragment method createView.

@Override
public View createView(Context context) {
    fragmentView = new FrameLayout(context);
    rootLayout = (FrameLayout) fragmentView;
    notifyFrameLayout = new NotifyFrameLayout(context) {

        @Override
        public boolean dispatchKeyEventPreIme(KeyEvent event) {
            if (event != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
                if (keyboardViewVisible) {
                    hideStoryReply();
                    return true;
                }
                return false;
            }
            return super.dispatchKeyEventPreIme(event);
        }
    };
    notifyFrameLayout.setListener(this::onScreenSizeChanged);
    rootLayout.addView(notifyFrameLayout, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT));
    storyVideoPlayer = new PlayerView(context);
    storyVideoPlayer.setVisibility(View.GONE);
    storyVideoPlayer.setContentDescription("storyVideoPlayer");
    notifyFrameLayout.addView(storyVideoPlayer, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT));
    storyDisplayImage = new ImageView(context);
    storyDisplayImage.setScaleType(ImageView.ScaleType.CENTER_CROP);
    storyDisplayImage.setContentDescription("storyDisplayImage");
    notifyFrameLayout.addView(storyDisplayImage, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT));
    DisplayMetrics displayMetrics = new DisplayMetrics();
    requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    int width = displayMetrics.widthPixels;
    previous = new LinearLayout(context);
    FrameLayout.LayoutParams previousLayoutParam = new FrameLayout.LayoutParams(width / 2, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.LEFT);
    previous.setContentDescription("previous");
    notifyFrameLayout.addView(previous, previousLayoutParam);
    next = new LinearLayout(context);
    FrameLayout.LayoutParams nextLayoutParam = new FrameLayout.LayoutParams(width / 2, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.RIGHT);
    next.setContentDescription("next");
    notifyFrameLayout.addView(next, nextLayoutParam);
    storyVideoProgress = new ProgressBar(context);
    storyVideoProgress.setContentDescription("storyVideoProgress");
    notifyFrameLayout.addView(storyVideoProgress, LayoutCreator.createFrame(40, 40, Gravity.RIGHT | Gravity.TOP, 0, 20, 20, 0));
    storyOverlay = new FrameLayout(context);
    storyOverlay.setContentDescription("storyOverlay");
    notifyFrameLayout.addView(storyOverlay, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT));
    topShadow = new View(context);
    topShadow.setContentDescription("topShadow");
    topShadow.setBackground(context.getResources().getDrawable(R.drawable.story_top_shadow));
    storyOverlay.addView(topShadow, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 60, Gravity.TOP));
    storiesProgressView = new StoriesProgressView(context, null);
    storiesProgressView.setContentDescription("storiesProgressView");
    storiesProgressView.setPadding(8, 0, 8, 0);
    storyOverlay.addView(storiesProgressView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.TOP, 0, 2, 0, 0));
    profileImage = new CircleImageView(context);
    profileImage.setContentDescription("profileImage");
    storyOverlay.addView(profileImage, LayoutCreator.createFrame(40, 40, Gravity.LEFT, 8, 10, 8, 8));
    LinearLayout profileContainer = new LinearLayout(context);
    profileContainer.setContentDescription("profileContainer");
    profileContainer.setOrientation(LinearLayout.VERTICAL);
    topLinearRootView = new LinearLayout(context);
    topLinearRootView.setGravity(Gravity.CENTER);
    topLinearRootView.setOrientation(LinearLayout.HORIZONTAL);
    profileContainer.addView(topLinearRootView, 0, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.TOP));
    nickName = new TextView(context);
    nickName.setContentDescription("nickName");
    nickName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
    nickName.setTypeface(ResourcesCompat.getFont(context, R.font.main_font_bold));
    nickName.setTextColor(Color.WHITE);
    topLinearRootView.addView(nickName, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    chatIconTv = new FontIconTextView(getContext());
    setTextSize(chatIconTv, R.dimen.dp14);
    chatIconTv.setVisibility(View.GONE);
    chatIconTv.setContentDescription("chatIconTv");
    chatIconTv.setText(R.string.icon_channel);
    chatIconTv.setTextColor(Color.WHITE);
    topLinearRootView.addView(chatIconTv, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, 4, 0, 0, 0));
    verifyIconTv = new FontIconTextView(getContext());
    verifyIconTv.setTextColor(getContext().getResources().getColor(R.color.verify_color));
    verifyIconTv.setText(R.string.icon_blue_badge);
    verifyIconTv.setVisibility(View.GONE);
    setTextSize(verifyIconTv, R.dimen.standardTextSize);
    topLinearRootView.addView(verifyIconTv, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, 4, 0, 0, 0));
    storyTime = new TextView(context);
    storyTime.setContentDescription("storyTime");
    storyTime.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
    storyTime.setTypeface(nickName.getTypeface(), Typeface.BOLD);
    storyTime.setTextColor(Color.WHITE);
    profileContainer.addView(storyTime, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM));
    storyOverlay.addView(profileContainer, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.LEFT, 56, 8, 0, 0));
    captionRootView = new ExpandableTextView(context);
    captionRootView.setContentDescription("captionRootView");
    captionRootView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
    captionRootView.setTextColor(Color.WHITE);
    captionRootView.setPadding(8, 8, 8, 8);
    rootLayout.addView(captionRootView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM, 0, 0, 0, 80));
    storySeenContainer = new LinearLayout(context);
    storySeenContainer.setContentDescription("storySeenContainer");
    storySeenContainer.setGravity(Gravity.CENTER_VERTICAL);
    storySeenContainer.setOrientation(LinearLayout.HORIZONTAL);
    eyeIcon = new TextView(context);
    eyeIcon.setContentDescription("eyeIcon");
    eyeIcon.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    eyeIcon.setTextColor(Color.WHITE);
    eyeIcon.setGravity(Gravity.CENTER_VERTICAL);
    eyeIcon.setBackground(context.getResources().getDrawable(R.drawable.ic_view_seen));
    eyeIcon.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);
    seenCount = new TextView(context);
    seenCount.setContentDescription("seenCount");
    seenCount.setTypeface(ResourcesCompat.getFont(context, R.font.main_font));
    seenCount.setGravity(Gravity.CENTER_VERTICAL);
    seenCount.setTextColor(Color.WHITE);
    seenCount.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
    storySeenContainer.addView(eyeIcon, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.LEFT));
    storySeenContainer.addView(seenCount, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.RIGHT, 3, 0, 0, 0));
    storyProgress = new ProgressBar(context);
    storyProgress.setContentDescription("storyProgress");
    storyProgress.setVisibility(View.GONE);
    notifyFrameLayout.addView(storyProgress, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    GradientDrawable layer1 = new GradientDrawable();
    layer1.setShape(GradientDrawable.RECTANGLE);
    layer1.setCornerRadii(new float[] { LayoutCreator.dp(8), LayoutCreator.dp(8), 0, 0, 0, 0, LayoutCreator.dp(8), LayoutCreator.dp(8) });
    layer1.setColor(Theme.getInstance().getToolbarBackgroundColor(context));
    GradientDrawable layer2 = new GradientDrawable();
    layer2.setShape(GradientDrawable.RECTANGLE);
    layer2.setColor(Theme.getInstance().getReplyContentBackground(context));
    InsetDrawable insetDrawable = new InsetDrawable(layer2, LayoutCreator.dp(8), 0, 0, 0);
    LayerDrawable drawable = new LayerDrawable(new Drawable[] { layer1, insetDrawable });
    LinearLayout replyAndKeyboardContainer = new LinearLayout(context);
    replyAndKeyboardContainer.setOrientation(LinearLayout.VERTICAL);
    notifyFrameLayout.addView(replyAndKeyboardContainer, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM));
    replyContainer = new FrameLayout(context);
    replyContainer.setVisibility(View.GONE);
    replyContainer.setContentDescription("replyContainer");
    replyContainer.setBackground(Theme.getInstance().tintDrawable(context.getResources().getDrawable(R.drawable.chat_item_sent_bg_light), context, R.attr.iGapSendMessageBubbleColor));
    replyContainer.setPadding(15, 15, 15, 15);
    replyAndKeyboardContainer.addView(replyContainer, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.TOP, 15, 0, 15, 10));
    FrameLayout mainContentContainer = new FrameLayout(context);
    replyContainer.addView(mainContentContainer, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.LEFT));
    replyContentContainer = new LinearLayout(context);
    replyContentContainer.setContentDescription("replyContentContainer");
    replyContentContainer.setBackground(drawable);
    replyContentContainer.setOrientation(LinearLayout.VERTICAL);
    mainContentContainer.addView(replyContentContainer, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 50, Gravity.LEFT, 10, 5, 45, 5));
    replyThumb = new ImageView(context);
    replyThumb.setContentDescription("replyThumb");
    mainContentContainer.addView(replyThumb, LayoutCreator.createFrame(25, LayoutCreator.MATCH_PARENT, Gravity.RIGHT | Gravity.TOP, 0, 0, 5, 0));
    replyTo = new TextView(context);
    replyTo.setContentDescription("replyTo");
    replyTo.setTypeface(ResourcesCompat.getFont(context, R.font.main_font_bold));
    replyTo.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
    replyTo.setEllipsize(TextUtils.TruncateAt.END);
    replyTo.setTextColor(Theme.getInstance().getSendReplayUserColor(context));
    replyContentContainer.addView(replyTo, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.TOP, 8, 0, 0, 0));
    replyCaption = new TextView(context);
    replyCaption.setContentDescription("replyCaption");
    replyCaption.setTypeface(ResourcesCompat.getFont(context, R.font.main_font));
    replyCaption.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
    replyCaption.setEllipsize(TextUtils.TruncateAt.END);
    replyCaption.setSingleLine(true);
    replyCaption.setTextColor(Theme.getInstance().getSubTitleColor(context));
    replyContentContainer.addView(replyCaption, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM, 8, 0, 8, 0));
    sendReplyContainer = new FrameLayout(context);
    sendReplyContainer.setContentDescription("sendReplyContainer");
    replyContainer.addView(sendReplyContainer, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM, 0, 60, 0, 0));
    emojiIcon = new TextView(context);
    emojiIcon.setContentDescription("emojiIcon");
    emojiIcon.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    emojiIcon.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);
    emojiIcon.setText(R.string.icon_emoji_smile);
    emojiIcon.setGravity(Gravity.CENTER);
    emojiIcon.setTextColor(Theme.getInstance().getSubTitleColor(context));
    sendReplyContainer.addView(emojiIcon, LayoutCreator.createFrame(50, 50, Gravity.LEFT, 5, 0, 5, 0));
    replyEditText = new EventEditText(context);
    replyEditText.setBackground(null);
    replyEditText.setContentDescription("replyEditText");
    replyEditText.setListener(this::chatMotionEvent);
    replyEditText.setHintTextColor(Theme.getInstance().getSubTitleColor(context));
    replyEditText.setTextColor(Theme.getInstance().getTitleTextColor(context));
    sendReplyContainer.addView(replyEditText, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT, Gravity.LEFT, 50, 0, 55, 0));
    sendIcon = new TextView(context);
    sendIcon.setContentDescription("sendIcon");
    sendIcon.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    sendIcon.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);
    sendIcon.setText(R.string.icon_send);
    sendIcon.setGravity(Gravity.CENTER);
    sendIcon.setTextColor(Theme.getInstance().getSubTitleColor(context));
    sendReplyContainer.addView(sendIcon, LayoutCreator.createFrame(50, 50, Gravity.RIGHT, 5, 0, 5, 0));
    keyboardContainer = new FrameLayout(context);
    keyboardContainer.setContentDescription("keyboardContainer");
    replyAndKeyboardContainer.addView(keyboardContainer, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM));
    storyReplyContainer = new LinearLayout(context);
    storyReplyContainer.setContentDescription("storyReplyContainer");
    storyReplyContainer.setOrientation(LinearLayout.VERTICAL);
    storyReplyContainer.setGravity(Gravity.CENTER_HORIZONTAL);
    replyIcon = new TextView(context);
    replyIcon.setContentDescription("replyIcon");
    replyIcon.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    replyIcon.setTextColor(Color.WHITE);
    replyIcon.setText(R.string.icon_chevron_Down);
    replyIcon.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
    replyText = new TextView(context);
    replyText.setContentDescription("replyText");
    replyText.setTypeface(ResourcesCompat.getFont(context, R.font.main_font));
    replyText.setTextColor(Color.WHITE);
    replyText.setText(R.string.replay);
    replyText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
    storyReplyContainer.addView(replyIcon, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT));
    storyReplyContainer.addView(replyText, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT));
    notifyFrameLayout.addView(storySeenContainer, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, 0, 0, 0, 20));
    notifyFrameLayout.addView(storyReplyContainer, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, 0, 0, 0, 30));
    return rootLayout;
}
Also used : ExpandableTextView(net.iGap.story.ExpandableTextView) EventEditText(net.iGap.module.customView.EventEditText) FontIconTextView(net.iGap.module.FontIconTextView) DisplayMetrics(android.util.DisplayMetrics) ImageView(android.widget.ImageView) FontIconTextView(net.iGap.module.FontIconTextView) PlayerView(com.google.android.exoplayer2.ui.PlayerView) RecyclerListView(net.iGap.module.customView.RecyclerListView) View(android.view.View) KeyboardView(net.iGap.libs.emojiKeyboard.KeyboardView) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) ExpandableTextView(net.iGap.story.ExpandableTextView) EmojiView(net.iGap.libs.emojiKeyboard.EmojiView) ImageLoadingView(net.iGap.story.liststories.ImageLoadingView) CircleImageView(net.iGap.module.CircleImageView) GradientDrawable(android.graphics.drawable.GradientDrawable) KeyEvent(android.view.KeyEvent) CircleImageView(net.iGap.module.CircleImageView) FrameLayout(android.widget.FrameLayout) NotifyFrameLayout(net.iGap.libs.emojiKeyboard.NotifyFrameLayout) LayerDrawable(android.graphics.drawable.LayerDrawable) PlayerView(com.google.android.exoplayer2.ui.PlayerView) FontIconTextView(net.iGap.module.FontIconTextView) TextView(android.widget.TextView) ExpandableTextView(net.iGap.story.ExpandableTextView) InsetDrawable(android.graphics.drawable.InsetDrawable) ImageView(android.widget.ImageView) CircleImageView(net.iGap.module.CircleImageView) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout) NotifyFrameLayout(net.iGap.libs.emojiKeyboard.NotifyFrameLayout)

Example 3 with NotifyFrameLayout

use of net.iGap.libs.emojiKeyboard.NotifyFrameLayout in project iGap-Android by KianIranian-STDG.

the class FragmentChat method onCreateView.

@Nullable
@Override
public View onCreateView(@NotNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    isNeedResume = true;
    G.locationListener = this;
    StickerRepository.getInstance().getUserStickersGroup();
    notifyFrameLayout = new NotifyFrameLayout(context) {

        @Override
        public boolean dispatchKeyEventPreIme(KeyEvent event) {
            if (event != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
                if (topFragmentIsChat() && keyboardViewVisible) {
                    showPopup(-1);
                    return true;
                }
                return false;
            }
            return super.dispatchKeyEventPreIme(event);
        }
    };
    Bundle extras = getArguments();
    if (extras != null) {
        mRoomId = extras.getLong("RoomId");
        if (mustCheckPermission())
            currentRoomAccess = DbManager.getInstance().doRealmTask(realm -> {
                return realm.where(RealmRoomAccess.class).equalTo("id", mRoomId + "_" + AccountManager.getInstance().getCurrentUser().getId()).findFirst();
            });
    }
    notifyFrameLayout.setListener(this::onScreenSizeChanged);
    rootView = (FrameLayout) inflater.inflate(R.layout.fragment_chat, container, false);
    chatContainer = rootView.findViewById(R.id.chatMainContainer);
    mediaContainer = new FragmentMediaContainer(getActivity(), this);
    mediaContainer.setListener(i -> {
        switch(i) {
            case FragmentMediaContainer.CALL_TAG:
                getActivity().startActivity(new Intent(getContext(), CallActivity.class));
                break;
            case FragmentMediaContainer.MEDIA_TAG:
                if (!MusicPlayer.isVoice) {
                    Intent intent = new Intent(context, ActivityMain.class);
                    intent.putExtra(ActivityMain.openMediaPlayer, true);
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    getActivity().startActivity(intent);
                }
                break;
            case FragmentMediaContainer.PLAY_TAG:
                break;
        }
    });
    // mediaContainer.setVisibility(View.GONE);
    chatContainer.addView(mediaContainer, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, 39, Gravity.TOP | Gravity.LEFT, 0, 59, 0, 0));
    mToolbar = new Toolbar(context);
    searchFieldItem = mToolbar.addItem(searchFieldTag, R.string.icon_search, Theme.getInstance().getTitleTextColor(getContext())).setIsSearchBox(true).setActionBarMenuItemSearchListener(new ToolbarItem.ActionBarMenuItemSearchListener() {

        int textLength;

        @Override
        public void onSearchExpand() {
            if (layoutMute != null) {
                layoutMute.setVisibility(View.GONE);
            }
            if (viewAttachFile != null) {
                viewAttachFile.setVisibility(View.GONE);
            }
            if (rootView.findViewById(R.id.ac_ll_join).getVisibility() == View.VISIBLE) {
                rootView.findViewById(R.id.ac_ll_join).setVisibility(View.GONE);
            }
            if (pinedMessageLayout != null) {
                changePinnedMessageVisibility(true, false, MusicPlayer.isMusicPlyerEnable, CallManager.getInstance().isCallAlive());
            }
            if (vgSpamUser != null) {
                vgSpamUser.setVisibility(View.GONE);
            }
            isSearchVisible = true;
        }

        @Override
        public void onTextChanged(EditText editText) {
            String text = editText.getText().toString();
            if (text.length() > 0 && !text.startsWith("#")) {
                if (!initHash) {
                    initHash = true;
                    initHashView();
                }
                searchHash.setHashString(editText.getText().toString());
                searchHash.setPosition("");
                if (searchFragment != null) {
                    searchFragment.onSearchCollapsed();
                }
                if (ll_navigateHash != null) {
                    ll_navigateHash.setVisibility(View.VISIBLE);
                }
                if (viewAttachFile != null) {
                    viewAttachFile.setVisibility(View.GONE);
                }
            } else if (text.startsWith("#") && text.length() < 2) {
                if (text.length() > textLength) {
                    searchFragment = SearchFragment.newInstance(mRoomId, text, true);
                    getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.chatContainer, searchFragment).commit();
                }
                if (keyboardContainer != null) {
                    keyboardContainer.setVisibility(View.GONE);
                }
                if (ll_navigateHash != null) {
                    ll_navigateHash.setVisibility(View.GONE);
                }
                if (txtFloatingTime != null) {
                    txtFloatingTime.setVisibility(View.GONE);
                }
            } else if (text.startsWith("#") && text.length() > 1) {
                if (searchFragment != null && searchFragment.isAdded()) {
                    searchFragment.onTextChanged(editText.getText().toString());
                }
            } else {
                hideKeyboardView();
                if (ll_navigateHash != null) {
                    ll_navigateHash.setVisibility(View.GONE);
                }
                if (searchFragment != null && searchFragment.isAdded()) {
                    searchFragment.onSearchCollapsed();
                }
            }
            textLength = editText.getText().length();
        }

        @Override
        public void onSearchCollapse() {
            if (muteIcon != null) {
                muteIcon.setVisibility(getRoom().getMute() ? View.VISIBLE : View.GONE);
            }
            if (verifiedIcon != null) {
                RealmChannelRoom channelRoom = getRoom().getChannelRoom();
                boolean isVerified = false;
                if (channelRoom != null) {
                    isVerified = channelRoom.isVerified();
                }
                verifiedIcon.setVisibility(isVerified ? View.VISIBLE : View.GONE);
            }
            if (avatarItem != null) {
                avatarItem.setVisibility(View.VISIBLE);
            }
            if (pinedMessageLayout != null) {
                if (isPinAvailable) {
                    changePinnedMessageVisibility(true, true, MusicPlayer.isMusicPlyerEnable, CallManager.getInstance().isCallAlive());
                }
            }
            if (isNotJoin) {
                rootView.findViewById(R.id.ac_ll_join).setVisibility(View.VISIBLE);
            }
            if (searchFragment != null) {
                searchFragment.onSearchCollapsed();
            }
            if (vgSpamUser != null) {
                showSpamBar();
            }
            goneSearchHashFooter();
            hideKeyboardView();
            searchFieldItem.setVisibility(View.GONE);
            isSearchVisible = false;
        }
    });
    searchFieldItem.setVisibility(View.GONE);
    mToolbar.setOnClickListener(view -> {
        hideKeyboard();
        goToProfile();
    });
    mToolbar.setListener(i -> {
        switch(i) {
            case -1:
                if (mToolbar.isActionModeShowed()) {
                    mAdapter.deselect();
                    return;
                }
                if (webViewChatPage != null) {
                    closeWebViewForSpecialUrlChat(false);
                    return;
                }
                hideKeyboard();
                if (chatType == CHANNEL && !floatingHidden) {
                    if (channelRole == ChannelChatRole.OWNER && !isRecording) {
                        hideFloatingButton(true);
                        micAndAddStoryAnimateVisible(false);
                    }
                    return;
                }
                if (currentRoomAccess != null) {
                    if (currentRoomAccess != null) {
                        if (!currentRoomAccess.getRealmPostMessageRights().isCanSendText()) {
                            G.runOnUiThread(() -> {
                                viewAttachFile.setVisibility(View.GONE);
                            });
                        }
                    }
                }
                if (G.twoPaneMode) {
                    if (getActivity() instanceof ActivityMain) {
                        ((ActivityMain) getActivity()).goToTabletEmptyPage();
                    }
                } else {
                    if (!mToolbar.isSearchFieldVisible()) {
                        popBackStackFragment();
                    }
                }
                break;
            case searchItem:
                initLayoutSearchNavigation();
                if (!initHash) {
                    initHash = true;
                    initHashView();
                }
                openSearchBox(null);
                showPopup(KeyboardView.MODE_KEYBOARD);
                G.handler.postDelayed(() -> editTextRequestFocus(searchEditText), 300);
                break;
            case voiceCallTag:
                if (CallManager.getInstance().getCallPeerId() == chatPeerId) {
                    Intent activityIntent = new Intent(getActivity(), CallActivity.class);
                    activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(activityIntent);
                } else if (!CallManager.getInstance().isCallAlive()) {
                    CallSelectFragment selectFragment = CallSelectFragment.getInstance(chatPeerId, false, null);
                    if (getFragmentManager() != null)
                        selectFragment.show(getFragmentManager(), null);
                    if (keyboardViewVisible) {
                        hideKeyboard();
                    }
                } else {
                    Toast.makeText(getContext(), "NOT ALLOWED", Toast.LENGTH_SHORT).show();
                }
                break;
            case moreTag:
                createMoreItems();
                break;
            case clearHistoryItem:
                new MaterialDialog.Builder(G.fragmentActivity).title(R.string.clear_history).content(R.string.clear_history_content).positiveText(R.string.yes).onPositive((dialog, which) -> clearHistory(mRoomId)).negativeText(R.string.no).show();
                break;
            case deleteItem:
                new MaterialDialog.Builder(G.fragmentActivity).title(R.string.delete_chat).content(R.string.delete_chat_content).positiveText(R.string.yes).onPositive((dialog, which) -> deleteChat(mRoomId)).negativeText(R.string.no).show();
                break;
            case muteItem:
            case unMuteItem:
                muteNotification(mRoomId);
                break;
            case chatToGroupItem:
                new MaterialDialog.Builder(G.fragmentActivity).title(R.string.convert_chat_to_group_title).content(R.string.convert_chat_to_group_content).positiveText(R.string.yes).negativeText(R.string.no).onPositive((dialog, which) -> {
                    // finish();
                    finishChat();
                    dialog.dismiss();
                    G.handler.post(() -> G.onConvertToGroup.openFragmentOnActivity("ConvertToGroup", mRoomId));
                }).show();
                break;
            case cleanUpItem:
                resetMessagingValue();
                setDownBtnGone();
                setCountNewMessageZero();
                DbManager.getInstance().doRealmTask(realm -> {
                    RealmRoomMessage.ClearAllMessageRoomAsync(realm, mRoomId, () -> {
                        recyclerView.addOnScrollListener(scrollListener);
                        saveMessageIdPositionState(0, 0);
                        /**
                         * get history from server
                         */
                        topMore = true;
                        getOnlineMessage(0, 0, UP);
                    });
                });
                break;
            case reportItem:
                dialogReport(false, 0, 0);
                break;
            case sendMoneyItem:
                showPaymentDialog();
                break;
            case exportChatItem:
                if (HelperPermission.grantedUseStorage()) {
                    exportChat();
                } else {
                    try {
                        HelperPermission.getStoragePermission(G.fragmentActivity, new OnGetPermission() {

                            @Override
                            public void Allow() {
                                exportChat();
                            }

                            @Override
                            public void deny() {
                                Toast.makeText(G.currentActivity, R.string.export_message, Toast.LENGTH_SHORT).show();
                            }
                        });
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                break;
            case stopItem:
                new MaterialDialog.Builder(G.fragmentActivity).title(R.string.stop).content(R.string.stop_message_bot).positiveText(R.string.yes).onPositive((dialog, which) -> {
                    // onSelectRoomMenu("txtClearHistory", mRoomId);
                    closeWebViewForSpecialUrlChat(true);
                // popBackStackFragment();
                }).negativeText(R.string.no).show();
                break;
            case copyMessageTag:
                copySelectedItemTextToClipboard();
                break;
            case forwardMessageTag:
                // forward selected messages to room list for selecting room
                if (mAdapter != null && mAdapter.getSelectedItems().size() > 0) {
                    onForwardClick(null);
                }
                break;
            case replyMessageTag:
                if (mAdapter != null && !mAdapter.getSelectedItems().isEmpty() && mAdapter.getSelectedItems().size() == 1) {
                    reply(mAdapter.getSelectedItems().iterator().next().messageObject, false);
                }
                break;
            case deleteMessageTag:
                messageIds = new ArrayList<>();
                documentIds = new ArrayList<>();
                bothDeleteMessageId = new ArrayList<>();
                G.handler.post(() -> {
                    for (final AbstractMessage item : mAdapter.getSelectedItems()) {
                        if (mAdapter.getSelectedItems().size() == 1) {
                            confirmAndDeleteMessage(item.messageObject, true);
                            return;
                        }
                        try {
                            if (item != null && item.messageObject != null) {
                                Long messageId = item.messageObject.id;
                                Long documentId = item.messageObject.documentId;
                                messageIds.add(messageId);
                                documentIds.add(documentId);
                                boolean bothDelete = RealmRoomMessage.isBothDelete(item.messageObject.getUpdateOrCreateTime());
                                if (bothDelete)
                                    bothDeleteMessageId.add(messageId);
                            }
                        } catch (NullPointerException e) {
                            e.printStackTrace();
                        }
                    }
                    if (chatType == CHAT && !isCloudRoom && bothDeleteMessageId.size() > 0 && mAdapter.getSelectedItems().iterator().next().messageObject.userId == AccountManager.getInstance().getCurrentUser().getId()) {
                        String delete;
                        String textCheckBox = getContext().getResources().getString(R.string.st_checkbox_delete) + " " + title;
                        delete = getContext().getResources().getString(R.string.st_desc_deletes);
                        new MaterialDialog.Builder(getContext()).content(delete).title(R.string.message).positiveText(R.string.ok).negativeText(R.string.cancel).onPositive((dialog, which) -> {
                            if (!dialog.isPromptCheckBoxChecked()) {
                                bothDeleteMessageId = null;
                            }
                            getMessageController().deleteSelectedMessage(chatType.getNumber(), mRoomId, messageIds, documentIds, bothDeleteMessageId);
                        // deleteSelectedMessageFromAdapter(messageIds);
                        }).checkBoxPrompt(textCheckBox, false, null).show();
                    } else {
                        new MaterialDialog.Builder(getActivity()).title(R.string.message).content(getActivity().getResources().getString(R.string.st_desc_deletes)).positiveText(R.string.ok).negativeText(R.string.cancel).onPositive((dialog, which) -> {
                            bothDeleteMessageId = null;
                            getMessageController().deleteSelectedMessage(chatType.getNumber(), mRoomId, messageIds, documentIds, bothDeleteMessageId);
                        // deleteSelectedMessageFromAdapter(messageIds);
                        }).show();
                    }
                });
                break;
        }
    });
    searchEditText = searchFieldItem.getSearchEditText();
    mToolbar.setBackIcon(new BackDrawable(false));
    verifiedIcon = mToolbar.addVerifiedChannelsIcon();
    muteIcon = mToolbar.addMuteIcon();
    ToolbarItems toolbarItems = mToolbar.createToolbarItems();
    toolbarItems.setBackground(null);
    moreItem = toolbarItems.addItemWithWidth(moreTag, R.string.icon_other_vertical_dots, 48);
    callItem = toolbarItems.addItemWithWidth(voiceCallTag, R.string.icon_voice_call, 48);
    createActionMode();
    rootView.addView(mToolbar, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 60, Gravity.TOP));
    notifyFrameLayout.addView(rootView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT));
    keyboardContainer = rootView.findViewById(R.id.fl_chat_keyboardContainer);
    sendMoney = rootView.findViewById(R.id.btn_chatRoom_wallet);
    /**
     * init chat box edit text and send item because we need change this color in dark mode!
     */
    edtChat = rootView.findViewById(R.id.et_chatRoom_writeMessage);
    edtChat.setGravity(Gravity.CENTER_VERTICAL);
    edtChat.setListener(this::chatMotionEvent);
    imvSendButton = rootView.findViewById(R.id.btn_chatRoom_send);
    editTextProgress = rootView.findViewById(R.id.editTextProgress);
    chatRoom_send_container = rootView.findViewById(R.id.chatRoom_send_container);
    getEventManager().addObserver(EventManager.CALL_STATE_CHANGED, this);
    getEventManager().addObserver(EventManager.EMOJI_LOADED, this);
    getEventManager().addObserver(EventManager.ON_MESSAGE_DELETE, this);
    getEventManager().addObserver(EventManager.ON_EDIT_MESSAGE, this);
    getEventManager().addObserver(EventManager.ON_PINNED_MESSAGE, this);
    getEventManager().addObserver(EventManager.CHAT_CLEAR_MESSAGE, this);
    getEventManager().addObserver(EventManager.CHANNEL_ADD_VOTE, this);
    getEventManager().addObserver(EventManager.CHANNEL_GET_VOTE, this);
    getEventManager().addObserver(EventManager.CHANNEL_UPDATE_VOTE, this);
    getEventManager().addObserver(EventManager.CHANNEL_UPDATE_VOTE, this);
    getEventManager().addObserver(EventManager.CHAT_UPDATE_STATUS, this);
    getEventManager().addObserver(EventManager.MEDIA_PLAYER_STATE_CHANGED, this);
    getEventManager().addObserver(EventManager.NEXT_VOICE, this);
    getEventManager().addObserver(EventManager.ON_FILE_PICKED_FROM_INTENT, this);
    if (twoPaneMode)
        EventManager.getInstance(AccountManager.selectedAccount).addObserver(EventManager.CHAT_BACKGROUND_CHANGED, this);
    return attachToSwipeBack(notifyFrameLayout);
}
Also used : ThumbnailUtils(android.media.ThumbnailUtils) Bundle(android.os.Bundle) HelperNotification(net.iGap.helper.HelperNotification) StructBottomSheetForward(net.iGap.module.structs.StructBottomSheetForward) ProgressBar(android.widget.ProgressBar) NonNull(androidx.annotation.NonNull) FileLog(net.iGap.helper.FileLog) UploadObject(net.iGap.module.upload.UploadObject) IMAGE_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.IMAGE_VALUE) ToolbarItem(net.iGap.messenger.ui.toolBar.ToolbarItem) AppCompatCheckBox(androidx.appcompat.widget.AppCompatCheckBox) NewChatItemHolder(net.iGap.adapter.items.chat.NewChatItemHolder) GroupChatRole(net.iGap.module.enums.GroupChatRole) HelperSetAction(net.iGap.helper.HelperSetAction) OnBotClick(net.iGap.observers.interfaces.OnBotClick) Handler(android.os.Handler) MediaStore(android.provider.MediaStore) Map(java.util.Map) OnChatSendMessageResponse(net.iGap.observers.interfaces.OnChatSendMessageResponse) ClipboardManager(android.content.ClipboardManager) CallActivity(net.iGap.activities.CallActivity) HelperError(net.iGap.helper.HelperError) DOWN(net.iGap.proto.ProtoClientGetRoomHistory.ClientGetRoomHistory.Direction.DOWN) GIF_TEXT(net.iGap.proto.ProtoGlobal.RoomMessageType.GIF_TEXT) RequestClientSubscribeToRoom(net.iGap.request.RequestClientSubscribeToRoom) ContextCompat(androidx.core.content.ContextCompat) HelperFragment(net.iGap.helper.HelperFragment) Log(android.util.Log) R.id.ac_ll_parent(net.iGap.R.id.ac_ll_parent) Realm(io.realm.Realm) HelperCalander(net.iGap.helper.HelperCalander) NumberTextView(net.iGap.messenger.ui.toolBar.NumberTextView) RealmObjectChangeListener(io.realm.RealmObjectChangeListener) RealmRoom(net.iGap.realm.RealmRoom) CHAT(net.iGap.proto.ProtoGlobal.Room.Type.CHAT) VIDEO(net.iGap.proto.ProtoGlobal.RoomMessageType.VIDEO) CHANNEL(net.iGap.proto.ProtoGlobal.Room.Type.CHANNEL) SoundPool(android.media.SoundPool) CountDownLatch(java.util.concurrent.CountDownLatch) RequestChatUpdateDraft(net.iGap.request.RequestChatUpdateDraft) OnHelperSetAction(net.iGap.observers.interfaces.OnHelperSetAction) AttachFile.getFilePathFromUri(net.iGap.module.AttachFile.getFilePathFromUri) CLIPBOARD_SERVICE(android.content.Context.CLIPBOARD_SERVICE) RequestChatGetRoom(net.iGap.request.RequestChatGetRoom) RealmCallConfig(net.iGap.realm.RealmCallConfig) SuggestedStickerAdapter(net.iGap.fragments.emoji.SuggestedStickerAdapter) ActivityMain(net.iGap.activities.ActivityMain) BottomSheetBehavior(com.google.android.material.bottomsheet.BottomSheetBehavior) HelperUrl(net.iGap.helper.HelperUrl) AccountManager(net.iGap.module.accountManager.AccountManager) ChatAttachmentPopup(net.iGap.module.dialog.ChatAttachmentPopup) RealmContacts(net.iGap.realm.RealmContacts) ParamWithInitBitmap(net.iGap.helper.avatar.ParamWithInitBitmap) Calendar(java.util.Calendar) WebSettings(android.webkit.WebSettings) ItemTouchHelper(androidx.recyclerview.widget.ItemTouchHelper) Toast(android.widget.Toast) ImageLoadingServiceInjector(net.iGap.module.imageLoaderService.ImageLoadingServiceInjector) IMAGE_TEXT(net.iGap.proto.ProtoGlobal.RoomMessageType.IMAGE_TEXT) AudioItem(net.iGap.adapter.items.chat.AudioItem) RealmRoomAccess(net.iGap.realm.RealmRoomAccess) MessageObject(net.iGap.structs.MessageObject) VideoWithTextItem(net.iGap.adapter.items.chat.VideoWithTextItem) G.twoPaneMode(net.iGap.G.twoPaneMode) AppCompatDelegate(androidx.appcompat.app.AppCompatDelegate) AttachFile.request_code_VIDEO_CAPTURED(net.iGap.module.AttachFile.request_code_VIDEO_CAPTURED) IOException(java.io.IOException) FragmentMediaContainer(net.iGap.messenger.ui.components.FragmentMediaContainer) IResendMessage(net.iGap.observers.interfaces.IResendMessage) EventEditText(net.iGap.module.customView.EventEditText) SharedPreferences(android.content.SharedPreferences) AUDIO_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.AUDIO_VALUE) HelperMimeType(net.iGap.helper.HelperMimeType) RoomObject(net.iGap.helper.RoomObject) NotifyFrameLayout(net.iGap.libs.emojiKeyboard.NotifyFrameLayout) EditText(android.widget.EditText) FileListerDialog(net.iGap.module.FileListerDialog.FileListerDialog) RequestUserContactsBlock(net.iGap.request.RequestUserContactsBlock) ISendPosition(net.iGap.observers.interfaces.ISendPosition) BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) JsonObject(com.google.gson.JsonObject) LinearLayout(android.widget.LinearLayout) RequestClientUnsubscribeFromRoom(net.iGap.request.RequestClientUnsubscribeFromRoom) AppUtils(net.iGap.module.AppUtils) PackageManager(android.content.pm.PackageManager) WindowManager(android.view.WindowManager) StickerDialogFragment(net.iGap.fragments.emoji.add.StickerDialogFragment) Animator(android.animation.Animator) Theme(net.iGap.module.Theme) GIF_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.GIF_VALUE) G(net.iGap.G) StatusTextFragment(net.iGap.story.StatusTextFragment) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) RequestClientGetRoomHistory(net.iGap.request.RequestClientGetRoomHistory) IntentRequests(net.iGap.module.IntentRequests) RealmUserInfo(net.iGap.realm.RealmUserInfo) ACTION_STATE_SWIPE(androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_SWIPE) ContentResolver(android.content.ContentResolver) UnreadMessage(net.iGap.adapter.items.chat.UnreadMessage) HelperPermission(net.iGap.helper.HelperPermission) IMessageItem(net.iGap.observers.interfaces.IMessageItem) Gson(com.google.gson.Gson) KeyboardView(net.iGap.libs.emojiKeyboard.KeyboardView) RecyclerView(androidx.recyclerview.widget.RecyclerView) RealmString(net.iGap.realm.RealmString) HelperImageBackColor(net.iGap.helper.HelperImageBackColor) VIDEO_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.VIDEO_VALUE) ParamWithAvatarType(net.iGap.helper.avatar.ParamWithAvatarType) UP(net.iGap.proto.ProtoClientGetRoomHistory.ClientGetRoomHistory.Direction.UP) ProgressWaiting(net.iGap.adapter.items.chat.ProgressWaiting) VIDEO_TEXT(net.iGap.proto.ProtoGlobal.RoomMessageType.VIDEO_TEXT) MessageController(net.iGap.controllers.MessageController) Status(net.iGap.module.downloader.Status) ProtoChannelGetMessagesStats(net.iGap.proto.ProtoChannelGetMessagesStats) ItemBottomSheetForward(net.iGap.adapter.items.ItemBottomSheetForward) DisplayMetrics(android.util.DisplayMetrics) GIF_TEXT_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.GIF_TEXT_VALUE) STORY_REPLY_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.STORY_REPLY_VALUE) OnClientGetRoomMessage(net.iGap.observers.interfaces.OnClientGetRoomMessage) Disposable(io.reactivex.disposables.Disposable) RealmRegisteredInfo(net.iGap.realm.RealmRegisteredInfo) MusicPlayer(net.iGap.module.MusicPlayer) OnGetPermission(net.iGap.observers.interfaces.OnGetPermission) StickerRepository(net.iGap.repository.StickerRepository) ActivityTrimVideo(net.iGap.activities.ActivityTrimVideo) LocationManager(android.location.LocationManager) EditorInfo(android.view.inputmethod.EditorInfo) IOnBackPressed(net.iGap.observers.interfaces.IOnBackPressed) RealmRoomMessageLocation(net.iGap.realm.RealmRoomMessageLocation) AppCompatTextView(androidx.appcompat.widget.AppCompatTextView) ActivityManager(android.app.ActivityManager) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) CallManager(net.iGap.viewmodel.controllers.CallManager) HelperGetMessageState(net.iGap.helper.HelperGetMessageState) OnVoiceRecord(net.iGap.observers.interfaces.OnVoiceRecord) RealmList(io.realm.RealmList) RequestClientGetFavoriteMenu(net.iGap.request.RequestClientGetFavoriteMenu) RealmRoomMessage.makeUnreadMessage(net.iGap.realm.RealmRoomMessage.makeUnreadMessage) TimeUtils(net.iGap.module.TimeUtils) AudioManager(android.media.AudioManager) InputMethodManager(android.view.inputmethod.InputMethodManager) FragmentActivity(androidx.fragment.app.FragmentActivity) AnimationUtils(android.view.animation.AnimationUtils) HelperCalander.convertToUnicodeFarsiNumber(net.iGap.helper.HelperCalander.convertToUnicodeFarsiNumber) RequestUserContactsUnblock(net.iGap.request.RequestUserContactsUnblock) MODE_PRIVATE(android.content.Context.MODE_PRIVATE) Build(android.os.Build) RequestUserInfo(net.iGap.request.RequestUserInfo) EmojiView(net.iGap.libs.emojiKeyboard.EmojiView) RequestChannelUpdateDraft(net.iGap.request.RequestChannelUpdateDraft) RealmAdditional(net.iGap.realm.RealmAdditional) JsonSyntaxException(com.google.gson.JsonSyntaxException) LayoutInflater(android.view.LayoutInflater) BadgeView(net.iGap.adapter.items.chat.BadgeView) RealmResults(io.realm.RealmResults) DialogAction(com.afollestad.materialdialogs.DialogAction) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) IDispatchTochEvent(net.iGap.observers.interfaces.IDispatchTochEvent) Color(android.graphics.Color) CountDownTimer(android.os.CountDownTimer) FileItem(net.iGap.adapter.items.chat.FileItem) StructMessageOption(net.iGap.module.structs.StructMessageOption) Bitmap(android.graphics.Bitmap) HelperSaveFile(net.iGap.helper.HelperSaveFile) STICKER_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.STICKER_VALUE) ViewTreeObserver(android.view.ViewTreeObserver) VIDEO_TEXT_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.VIDEO_TEXT_VALUE) VOICE_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.VOICE_VALUE) R(net.iGap.R) OnConnectionChangeStateChat(net.iGap.observers.interfaces.OnConnectionChangeStateChat) ProtoClientGetRoomHistory(net.iGap.proto.ProtoClientGetRoomHistory) StickerItem(net.iGap.adapter.items.chat.StickerItem) SHOW(net.iGap.module.enums.ProgressState.SHOW) Vibrator(android.os.Vibrator) Activity(android.app.Activity) FastItemAdapter(com.mikepenz.fastadapter.commons.adapters.FastItemAdapter) Arrays(java.util.Arrays) MyLinearLayoutManager(net.iGap.module.MyLinearLayoutManager) RequestClientJoinByUsername(net.iGap.request.RequestClientJoinByUsername) VoiceRecord(net.iGap.module.VoiceRecord) ProtoFileDownload(net.iGap.proto.ProtoFileDownload) Uri(android.net.Uri) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) LastSeenTimeUtil(net.iGap.module.LastSeenTimeUtil) Drawable(android.graphics.drawable.Drawable) Manifest(android.Manifest) ProtoClientRoomReport(net.iGap.proto.ProtoClientRoomReport) AdditionalType(net.iGap.module.additionalData.AdditionalType) HelperPermission.showDeniedPermissionMessage(net.iGap.helper.HelperPermission.showDeniedPermissionMessage) Looper(android.os.Looper) DialogAnimation(net.iGap.module.DialogAnimation) Fragment(androidx.fragment.app.Fragment) OnSetAction(net.iGap.observers.interfaces.OnSetAction) Canvas(android.graphics.Canvas) ProgressState(net.iGap.module.enums.ProgressState) RealmConstants(net.iGap.realm.RealmConstants) CardView(androidx.cardview.widget.CardView) OnDeleteChatFinishActivity(net.iGap.observers.interfaces.OnDeleteChatFinishActivity) HelperTracker(net.iGap.helper.HelperTracker) RequestGroupUpdateDraft(net.iGap.request.RequestGroupUpdateDraft) OnLastSeenUpdateTiming(net.iGap.observers.interfaces.OnLastSeenUpdateTiming) OnComplete(net.iGap.observers.interfaces.OnComplete) RealmRoomDraft(net.iGap.realm.RealmRoomDraft) WALLET_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.WALLET_VALUE) Set(java.util.Set) ChatSendMessageUtil(net.iGap.module.ChatSendMessageUtil) ChatMoreItem(net.iGap.model.ChatMoreItem) BotInit(net.iGap.module.BotInit) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) RealmGroupRoom(net.iGap.realm.RealmGroupRoom) Uploader(net.iGap.module.upload.Uploader) StringRes(androidx.annotation.StringRes) JsonArray(com.google.gson.JsonArray) FontIconTextView(net.iGap.module.FontIconTextView) Nullable(androidx.annotation.Nullable) BackDrawable(net.iGap.messenger.ui.toolBar.BackDrawable) HIDE(net.iGap.module.enums.ProgressState.HIDE) Tuple(net.iGap.libs.Tuple) OnGroupAvatarResponse(net.iGap.observers.interfaces.OnGroupAvatarResponse) SHP_SETTING(net.iGap.module.SHP_SETTING) Sort(io.realm.Sort) MyWebViewClient(net.iGap.libs.MyWebViewClient) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) VoiceItem(net.iGap.adapter.items.chat.VoiceItem) InputFilter(android.text.InputFilter) EventManager(net.iGap.observers.eventbus.EventManager) DownloadObject(net.iGap.module.downloader.DownloadObject) TextWatcher(android.text.TextWatcher) OnMessageReceive(net.iGap.observers.interfaces.OnMessageReceive) EmojiManager(net.iGap.libs.emojiKeyboard.emoji.EmojiManager) Config(net.iGap.Config) AttachmentObject(net.iGap.structs.AttachmentObject) StoryViewFragment(net.iGap.story.viewPager.StoryViewFragment) AttachFile.request_code_pic_audi(net.iGap.module.AttachFile.request_code_pic_audi) ImageSpan(android.text.style.ImageSpan) Environment(android.os.Environment) RequestClientGetRoomMessage(net.iGap.request.RequestClientGetRoomMessage) OnChatMessageRemove(net.iGap.observers.interfaces.OnChatMessageRemove) Editable(android.text.Editable) LOCATION_SERVICE(android.content.Context.LOCATION_SERVICE) ArrayList(java.util.ArrayList) VibrationEffect(android.os.VibrationEffect) LOCATION_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.LOCATION_VALUE) RealmChannelExtra(net.iGap.realm.RealmChannelExtra) ConnectionState(net.iGap.module.enums.ConnectionState) HelperGetAction(net.iGap.helper.HelperGetAction) LayoutCreator(net.iGap.helper.LayoutCreator) IMAGE_TEXT_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.IMAGE_TEXT_VALUE) WebChromeClient(android.webkit.WebChromeClient) Toolbar(net.iGap.messenger.ui.toolBar.Toolbar) LogWallet(net.iGap.adapter.items.chat.LogWallet) AvatarHandler(net.iGap.helper.avatar.AvatarHandler) RESULT_CANCELED(android.app.Activity.RESULT_CANCELED) StructWebView(net.iGap.module.structs.StructWebView) StickerSettingFragment(net.iGap.fragments.emoji.remove.StickerSettingFragment) AnimatedStickerItem(net.iGap.adapter.items.chat.AnimatedStickerItem) OnChatEditMessageResponse(net.iGap.observers.interfaces.OnChatEditMessageResponse) File(java.io.File) IItemAdapter(com.mikepenz.fastadapter.IItemAdapter) Gravity(android.view.Gravity) StructIGSticker(net.iGap.fragments.emoji.struct.StructIGSticker) Configuration(android.content.res.Configuration) LocationListener(net.iGap.observers.interfaces.LocationListener) LocationItem(net.iGap.adapter.items.chat.LocationItem) DbManager(net.iGap.module.accountManager.DbManager) CardToCardItem(net.iGap.adapter.items.chat.CardToCardItem) ValueAnimator(android.animation.ValueAnimator) FILE_TEXT_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.FILE_TEXT_VALUE) ImageHelper(net.iGap.helper.ImageHelper) AttachFile.request_code_pic_file(net.iGap.module.AttachFile.request_code_pic_file) IMAGE(net.iGap.proto.ProtoGlobal.RoomMessageType.IMAGE) RealmRoomMessage.makeSeenAllMessageOfRoom(net.iGap.realm.RealmRoomMessage.makeSeenAllMessageOfRoom) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) ResendMessage(net.iGap.module.ResendMessage) AttachFile(net.iGap.module.AttachFile) LOG_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.LOG_VALUE) LogWalletCardToCard(net.iGap.adapter.items.chat.LogWalletCardToCard) OnGetFavoriteMenu(net.iGap.observers.interfaces.OnGetFavoriteMenu) RealmChannelRoom(net.iGap.realm.RealmChannelRoom) AUDIO_TEXT_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.AUDIO_TEXT_VALUE) ContactItem(net.iGap.adapter.items.chat.ContactItem) LISTENED_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageStatus.LISTENED_VALUE) BottomSheetFragment(net.iGap.module.dialog.bottomsheet.BottomSheetFragment) View(android.view.View) Animation(android.view.animation.Animation) WebView(android.webkit.WebView) OnChatMessageSelectionChanged(net.iGap.observers.interfaces.OnChatMessageSelectionChanged) RealmRoomMessageContact(net.iGap.realm.RealmRoomMessageContact) StoryPagerFragment(net.iGap.story.StoryPagerFragment) ContactUtils(net.iGap.module.ContactUtils) ParentChatMoneyTransferFragment(net.iGap.fragments.chatMoneyTransfer.ParentChatMoneyTransferFragment) MessagesAdapter(net.iGap.adapter.MessagesAdapter) FILE_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.FILE_VALUE) AdapterDrBot(net.iGap.adapter.AdapterDrBot) OnUpdateUserOrRoomInfo(net.iGap.observers.interfaces.OnUpdateUserOrRoomInfo) RequestClientRoomReport(net.iGap.request.RequestClientRoomReport) HelperGetDataFromOtherApp(net.iGap.helper.HelperGetDataFromOtherApp) ObjectAnimator(android.animation.ObjectAnimator) PassCode(net.iGap.model.PassCode) StructMessageInfo(net.iGap.module.structs.StructMessageInfo) InputType(android.text.InputType) StructIGStickerGroup(net.iGap.fragments.emoji.struct.StructIGStickerGroup) ViewStubCompat(androidx.appcompat.widget.ViewStubCompat) Additional(net.iGap.module.enums.Additional) TEXT_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.TEXT_VALUE) LogWalletTopup(net.iGap.adapter.items.chat.LogWalletTopup) ViewGroup(android.view.ViewGroup) OnForwardBottomSheet(net.iGap.observers.interfaces.OnForwardBottomSheet) OnUserUpdateStatus(net.iGap.observers.interfaces.OnUserUpdateStatus) HelperLog(net.iGap.helper.HelperLog) OnChatSendMessage(net.iGap.observers.interfaces.OnChatSendMessage) List(java.util.List) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) TextView(android.widget.TextView) FragmentSettingAddStickers(net.iGap.fragments.emoji.add.FragmentSettingAddStickers) CONTACT_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageType.CONTACT_VALUE) RequestQueue(net.iGap.request.RequestQueue) RelativeLayout(android.widget.RelativeLayout) TextItem(net.iGap.adapter.items.chat.TextItem) IUpdateLogItem(net.iGap.observers.interfaces.IUpdateLogItem) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) NotNull(org.jetbrains.annotations.NotNull) OpenBottomSheetItem(net.iGap.observers.interfaces.OpenBottomSheetItem) Context(android.content.Context) AndroidUtils(net.iGap.module.AndroidUtils) SEEN_VALUE(net.iGap.proto.ProtoGlobal.RoomMessageStatus.SEEN_VALUE) KeyEvent(android.view.KeyEvent) ResourcesCompat(androidx.core.content.res.ResourcesCompat) GifWithTextItem(net.iGap.adapter.items.chat.GifWithTextItem) RequestSignalingGetConfiguration(net.iGap.request.RequestSignalingGetConfiguration) OnChatDelete(net.iGap.observers.interfaces.OnChatDelete) Intent(android.content.Intent) HashMap(java.util.HashMap) RealmStickerItem(net.iGap.realm.RealmStickerItem) SUID(net.iGap.module.SUID) ClipData(android.content.ClipData) OnUserInfoResponse(net.iGap.observers.interfaces.OnUserInfoResponse) SuppressLint(android.annotation.SuppressLint) MotionEvent(android.view.MotionEvent) AnimatorSet(android.animation.AnimatorSet) TimeItem(net.iGap.adapter.items.chat.TimeItem) RealmRoomMessage(net.iGap.realm.RealmRoomMessage) Cursor(android.database.Cursor) LogWalletBill(net.iGap.adapter.items.chat.LogWalletBill) ACTIVITY_SERVICE(android.content.Context.ACTIVITY_SERVICE) CONTACT(net.iGap.proto.ProtoGlobal.RoomMessageType.CONTACT) ToolbarItems(net.iGap.messenger.ui.toolBar.ToolbarItems) FileWriter(java.io.FileWriter) ProtoResponse(net.iGap.proto.ProtoResponse) MessageLoader(net.iGap.module.MessageLoader) LogItem(net.iGap.adapter.items.chat.LogItem) HelperString(net.iGap.helper.HelperString) ViewMaker(net.iGap.adapter.items.chat.ViewMaker) StructBottomSheet(net.iGap.module.structs.StructBottomSheet) OnFileSelectedListener(net.iGap.module.FileListerDialog.OnFileSelectedListener) ProtoGlobal(net.iGap.proto.ProtoGlobal) ImageWithTextItem(net.iGap.adapter.items.chat.ImageWithTextItem) ChannelChatRole(net.iGap.module.enums.ChannelChatRole) GROUP(net.iGap.proto.ProtoGlobal.Room.Type.GROUP) Collections(java.util.Collections) MimeTypeMap(android.webkit.MimeTypeMap) AbstractMessage(net.iGap.adapter.items.chat.AbstractMessage) RealmAttachment(net.iGap.realm.RealmAttachment) RealmQuery(io.realm.RealmQuery) BackDrawable(net.iGap.messenger.ui.toolBar.BackDrawable) CallActivity(net.iGap.activities.CallActivity) RealmString(net.iGap.realm.RealmString) HelperString(net.iGap.helper.HelperString) OnGetPermission(net.iGap.observers.interfaces.OnGetPermission) KeyEvent(android.view.KeyEvent) ActivityMain(net.iGap.activities.ActivityMain) Toolbar(net.iGap.messenger.ui.toolBar.Toolbar) EventEditText(net.iGap.module.customView.EventEditText) EditText(android.widget.EditText) AbstractMessage(net.iGap.adapter.items.chat.AbstractMessage) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) FragmentMediaContainer(net.iGap.messenger.ui.components.FragmentMediaContainer) Bundle(android.os.Bundle) Intent(android.content.Intent) IOException(java.io.IOException) RealmChannelRoom(net.iGap.realm.RealmChannelRoom) ToolbarItems(net.iGap.messenger.ui.toolBar.ToolbarItems) NotifyFrameLayout(net.iGap.libs.emojiKeyboard.NotifyFrameLayout) Nullable(androidx.annotation.Nullable)

Example 4 with NotifyFrameLayout

use of net.iGap.libs.emojiKeyboard.NotifyFrameLayout in project iGap-Android by KianIranian-STDG.

the class FragmentEditImage method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = new NotifyFrameLayout(inflater.getContext()) {

        @Override
        public boolean dispatchKeyEventPreIme(KeyEvent event) {
            if (event != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
                if (isKeyboardVisible()) {
                    showPopup(-1);
                    return true;
                }
                return false;
            }
            return super.dispatchKeyEventPreIme(event);
        }
    };
    rootView.setListener(this);
    View view = inflater.inflate(R.layout.fragment_edit_image, container, false);
    keyboardContainer = view.findViewById(R.id.fl_chat_keyboardContainer);
    paintTv = view.findViewById(R.id.txtPaintImage);
    rootView.addView(view, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT));
    return rootView;
}
Also used : KeyEvent(android.view.KeyEvent) ImageView(android.widget.ImageView) View(android.view.View) KeyboardView(net.iGap.libs.emojiKeyboard.KeyboardView) TextView(android.widget.TextView) CropImageView(com.theartofdev.edmodo.cropper.CropImageView) EmojiView(net.iGap.libs.emojiKeyboard.EmojiView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) NotifyFrameLayout(net.iGap.libs.emojiKeyboard.NotifyFrameLayout)

Example 5 with NotifyFrameLayout

use of net.iGap.libs.emojiKeyboard.NotifyFrameLayout in project iGap-Android by KianIranian-STDG.

the class StatusTextFragment method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    rootView = new NotifyFrameLayout(context) {

        @Override
        public boolean dispatchKeyEventPreIme(KeyEvent event) {
            if (event != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
                if (isKeyboardVisible() || isPopupShowing()) {
                    showPopUPView(-1);
                    return true;
                }
                return false;
            }
            return super.dispatchKeyEventPreIme(event);
        }
    };
    rootView.setListener(this);
    rootView.setClickable(true);
    random_int = (int) Math.floor(Math.random() * ((colors.length - 1) + 1));
    textLayoutRoot = new FrameLayout(context);
    textLayoutRoot.setBackgroundColor(colorCode = colors[random_int]);
    rootView.addView(textLayoutRoot, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT, Gravity.CENTER));
    addTextRootView = new FrameLayout(getContext());
    stickerBorder = new FrameLayout(getContext());
    stickerBorder.setPadding(10, 10, 10, 10);
    addTextRootView.addView(stickerBorder, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT, Gravity.CENTER, 8, 8, 8, 8));
    textTv = new TextView(getContext());
    textTv.setId(R.id.story_added_text);
    textTv.setTextColor(Color.WHITE);
    textTv.setGravity(Gravity.CENTER);
    textTv.setTypeface(ResourcesCompat.getFont(getContext(), R.font.main_font_bold));
    textTv.setTextSize(30);
    TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(textTv, 22, 30, 1, TypedValue.COMPLEX_UNIT_DIP);
    stickerBorder.addView(textTv, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, 14, 14, 14, 14));
    textLayoutRoot.addView(addTextRootView, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    addTextEditTExt = new EventEditText(context);
    addTextEditTExt.setGravity(Gravity.CENTER);
    addTextEditTExt.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
    addTextEditTExt.setBackground(null);
    addTextEditTExt.setTextColor(Color.WHITE);
    addTextEditTExt.setHint(getString(R.string.type_a_moment));
    addTextEditTExt.setTextSize(editTextSize);
    addTextEditTExt.setSingleLine(false);
    addTextEditTExt.setTypeface(ResourcesCompat.getFont(getContext(), R.font.main_font_bold));
    addTextEditTExt.setFilters(new InputFilter[] { new InputFilter.LengthFilter(501) });
    addTextEditTExt.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
    bottomPanelRootView = new LinearLayout(context);
    bottomPanelRootView.setOrientation(LinearLayout.VERTICAL);
    rootView.addView(bottomPanelRootView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT, Gravity.CENTER, 0, 0, 0, 0));
    bottomPanelRootView.addView(addTextEditTExt, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, 0, 1F, Gravity.CENTER, 5, 0, 5, 0));
    layoutRootView = new FrameLayout(context);
    bottomPanelRootView.addView(layoutRootView, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, 0, 0, 0, 8));
    bottomLyoutPannel = new LinearLayout(context);
    bottomLyoutPannel.setOrientation(LinearLayout.HORIZONTAL);
    layoutRootView.addView(bottomLyoutPannel, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.MATCH_PARENT, Gravity.LEFT | Gravity.CENTER, 16, 0, 0, 0));
    floatActionLayout = new FrameLayout(context);
    Drawable drawable = Theme.createSimpleSelectorCircleDrawable(LayoutCreator.dp(56), Theme.getInstance().getToolbarBackgroundColor(context), Theme.getInstance().getAccentColor(context));
    floatActionLayout.setBackground(drawable);
    IconView addButton = new IconView(context);
    addButton.setIcon(R.string.icon_send);
    addButton.setIconColor(Color.WHITE);
    floatActionLayout.setVisibility(View.GONE);
    floatActionLayout.addView(addButton);
    layoutRootView.addView(floatActionLayout, LayoutCreator.createFrame(52, 52, Gravity.RIGHT | Gravity.CENTER, 0, 0, 16, 0));
    palletTextView = new MaterialDesignTextView(context);
    palletTextView.setGravity(Gravity.CENTER);
    palletTextView.setBackground(context.getResources().getDrawable(R.drawable.ic_palete));
    palletTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
    palletTextView.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    palletTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 32);
    bottomLyoutPannel.addView(palletTextView, LayoutCreator.createLinear(32, 32, 0, 0, 0, 10));
    emoji = new MaterialDesignTextView(context);
    emoji.setGravity(Gravity.CENTER);
    emoji.setText(R.string.icon_emoji_smile);
    emoji.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 32);
    emoji.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    emoji.setTextColor(context.getResources().getColor(R.color.white));
    bottomLyoutPannel.addView(emoji, LayoutCreator.createLinear(30, 30, 0, 0, 12, 10));
    chatKeyBoardContainer = new FrameLayout(context);
    bottomPanelRootView.addView(chatKeyBoardContainer, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    return rootView;
}
Also used : KeyEvent(android.view.KeyEvent) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) IconView(net.iGap.messenger.ui.components.IconView) InputFilter(android.text.InputFilter) EventEditText(net.iGap.module.customView.EventEditText) FrameLayout(android.widget.FrameLayout) NotifyFrameLayout(net.iGap.libs.emojiKeyboard.NotifyFrameLayout) Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) TextView(android.widget.TextView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) LinearLayout(android.widget.LinearLayout) NotifyFrameLayout(net.iGap.libs.emojiKeyboard.NotifyFrameLayout) Nullable(androidx.annotation.Nullable)

Aggregations

KeyEvent (android.view.KeyEvent)5 TextView (android.widget.TextView)5 NotifyFrameLayout (net.iGap.libs.emojiKeyboard.NotifyFrameLayout)5 View (android.view.View)4 FrameLayout (android.widget.FrameLayout)4 ImageView (android.widget.ImageView)4 LinearLayout (android.widget.LinearLayout)4 EmojiView (net.iGap.libs.emojiKeyboard.EmojiView)4 KeyboardView (net.iGap.libs.emojiKeyboard.KeyboardView)4 MaterialDesignTextView (net.iGap.module.MaterialDesignTextView)4 EventEditText (net.iGap.module.customView.EventEditText)4 SuppressLint (android.annotation.SuppressLint)2 Drawable (android.graphics.drawable.Drawable)2 InputFilter (android.text.InputFilter)2 ProgressBar (android.widget.ProgressBar)2 Nullable (androidx.annotation.Nullable)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 Manifest (android.Manifest)1 Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1