Search in sources :

Example 1 with CircleImageView

use of net.iGap.module.CircleImageView in project iGap-Android by KianIranian-STDG.

the class CameraStoryFragment method createView.

@Override
public View createView(Context context) {
    fragmentView = new LinearLayout(context);
    rootView = (LinearLayout) fragmentView;
    rootView.setBackgroundColor(Theme.getInstance().getRootColor(context));
    rootView.setOrientation(LinearLayout.VERTICAL);
    cameraContainer = new FrameLayout(context);
    topToolPanel = new FrameLayout(context) {

        @Override
        protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
            int cx;
            int cy;
            int cx2;
            int cy2;
            int cx3;
            int cy3;
            if (getMeasuredWidth() == AndroidUtils.dp(126)) {
                cx = getMeasuredWidth() / 2;
                cy = getMeasuredHeight() / 2;
                cx3 = cx2 = getMeasuredWidth() / 2;
                cy2 = cy + cy / 2 + AndroidUtils.dp(17);
                cy3 = cy / 2 - AndroidUtils.dp(17);
            } else {
                cx = getMeasuredWidth() / 2;
                cy = getMeasuredHeight() / 2 - AndroidUtils.dp(13);
                cx2 = cx + cx / 2 + AndroidUtils.dp(35);
                cx3 = cx / 2 - AndroidUtils.dp(40);
                cy3 = cy2 = getMeasuredHeight() / 2 - AndroidUtils.dp(13);
            }
            settingButton.layout(cx3 - settingButton.getMeasuredWidth() / 2, cy3 - settingButton.getMeasuredHeight() / 2, cx3 + settingButton.getMeasuredWidth() / 2, cy3 + settingButton.getMeasuredHeight() / 2);
            closeButton.layout(cx2 - closeButton.getMeasuredWidth() / 2, cy2 - closeButton.getMeasuredHeight() / 2, cx2 + closeButton.getMeasuredWidth() / 2, cy2 + closeButton.getMeasuredHeight() / 2);
            flashModeButton.layout(cx3 - flashModeButton.getMeasuredWidth() / 2, cy3 - flashModeButton.getMeasuredHeight() / 2, cx3 + flashModeButton.getMeasuredWidth() / 2, cy3 + flashModeButton.getMeasuredHeight() / 2);
        }
    };
    cameraView = new CameraView(getContext(), true);
    LinearLayout.LayoutParams cameraContainerLayoutParams = new LinearLayout.LayoutParams(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER);
    cameraContainerLayoutParams.weight = 1;
    cameraContainer.addView(cameraView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT));
    rootView.addView(cameraContainer, cameraContainerLayoutParams);
    closeButton = new ImageButton(context);
    closeButton.setBackground(getActivity().getResources().getDrawable(R.drawable.ic_close));
    topToolPanel.addView(closeButton, LayoutCreator.createFrame(28, 28, Gravity.RIGHT | Gravity.CENTER_VERTICAL));
    settingButton = new ImageButton(context);
    settingButton.setBackground(getActivity().getResources().getDrawable(R.drawable.ic_setting));
    // topToolPanel.addView(settingButton, LayoutCreator.createFrame(28, 28, Gravity.LEFT | Gravity.CENTER_VERTICAL));
    cameraContainer.addView(topToolPanel, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 126, Gravity.LEFT | Gravity.TOP));
    takePicture = new ImageButton(context);
    takePicture.setBackground(getActivity().getResources().getDrawable(R.drawable.ic_shutter));
    takePicture.setScaleType(ImageView.ScaleType.FIT_CENTER);
    cameraContainer.addView(takePicture, LayoutCreator.createFrame(70, 70, Gravity.BOTTOM | Gravity.CENTER, 0, 0, 0, 0));
    bottomToolPanel = new FrameLayout(context) {

        @Override
        protected void onLayout(boolean changed, int l, int t, int r, int b) {
            int top = galleryIcon != null ? getHeight() / 2 - galleryIcon.getMeasuredHeight() / 2 : getHeight() / 2;
            int left = getPaddingLeft();
            int right = galleryIcon != null ? left + galleryIcon.getMeasuredWidth() : left;
            int botttom = galleryIcon != null ? top + galleryIcon.getMeasuredHeight() : top;
            if (galleryIcon != null && galleryIcon.getVisibility() != GONE) {
                galleryIcon.layout(15, 0, galleryIcon.getMeasuredWidth(), getMeasuredHeight());
            }
            final int iconRightPlusMargin = right;
            if (bottomPanelTitle != null && bottomPanelTitle.getVisibility() != GONE) {
                top = getHeight() / 2 - bottomPanelTitle.getMeasuredHeight() / 2;
                left = getWidth() / 2 - bottomPanelTitle.getMeasuredWidth() / 2;
                right = left + bottomPanelTitle.getMeasuredWidth();
                botttom = top + bottomPanelTitle.getMeasuredHeight();
                bottomPanelTitle.layout(left, top, right, botttom);
            }
            if (switchCamera != null && switchCamera.getVisibility() != GONE) {
                top = switchCamera.getPaddingTop();
                left = (r - l) - switchCamera.getMeasuredWidth();
                right = left + switchCamera.getMeasuredWidth();
                botttom = top + getMeasuredHeight();
                switchCamera.layout(left, top, right, botttom);
            }
        }
    };
    bottomToolPanel.setBackgroundColor(Color.BLACK);
    switchCamera = new ImageView(context);
    switchCamera.setScaleType(ImageView.ScaleType.FIT_CENTER);
    switchCamera.setImageResource(cameraView.isFrontface() ? R.drawable.camera_revert1 : R.drawable.camera_revert2);
    // switchCamera.setPadding(4, 4, 4, 4);
    bottomToolPanel.addView(switchCamera, LayoutCreator.createFrame(48, 48));
    galleryIcon = new CircleImageView(context);
    // galleryIcon.setPadding(15, 15, 15, 15);
    bottomToolPanel.addView(galleryIcon, LayoutCreator.createFrame(48, 48));
    bottomPanelTitle = new TextView(context);
    bottomPanelTitle.setText(getString(R.string.status));
    bottomPanelTitle.setTypeface(ResourcesCompat.getFont(context, R.font.main_font));
    bottomPanelTitle.setTextColor(Color.WHITE);
    bottomToolPanel.addView(bottomPanelTitle, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, 0, 0, 0, 0));
    rootView.addView(bottomToolPanel, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, 80));
    return rootView;
}
Also used : CircleImageView(net.iGap.module.CircleImageView) ImageButton(android.widget.ImageButton) FrameLayout(android.widget.FrameLayout) TextView(android.widget.TextView) ImageView(android.widget.ImageView) CircleImageView(net.iGap.module.CircleImageView) LinearLayout(android.widget.LinearLayout)

Example 2 with CircleImageView

use of net.iGap.module.CircleImageView in project iGap-Android by KianIranian-STDG.

the class TabItem method init.

private void init(@Nullable AttributeSet attributeSet) {
    parseAttr(attributeSet);
    if (haveAvatarImage) {
        if (imageView == null) {
            imageView = new CircleImageView(getContext());
            imageView.setBackgroundResource(new Theme().getUserProfileTabSelector(getContext()));
            imageView.setPadding((int) getResources().getDimension(R.dimen.dp2), (int) getResources().getDimension(R.dimen.dp2), (int) getResources().getDimension(R.dimen.dp2), (int) getResources().getDimension(R.dimen.dp2));
            if (avatarHandler == null) {
                avatarHandler = new AvatarHandler();
                avatarHandler.registerChangeFromOtherAvatarHandler();
                avatarHandler.getAvatar(new ParamWithAvatarType(imageView, AccountManager.getInstance().getCurrentUser().getId()).avatarType(AvatarHandler.AvatarType.USER).showMain());
            }
        }
    } else {
        if (imageView == null)
            imageView = new AppCompatImageView(getContext());
    }
    if (textView == null)
        textView = new AppCompatTextView(getContext());
    textView.setTypeface(ResourcesCompat.getFont(getContext(), R.font.main_font_bold));
    textView.setText(text);
    int[][] states = new int[][] { // selected
    new int[] { android.R.attr.state_selected }, // none
    new int[] { -android.R.attr.state_selected } };
    int[] colors = new int[] { new Theme().getAccentColor(textView.getContext()), new Theme().getSubTitleColor(textView.getContext()) };
    ColorStateList myList = new ColorStateList(states, colors);
    textView.setTextColor(myList);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 9);
    addView(imageView);
    addView(textView);
    setOnClickListener(this);
}
Also used : CircleImageView(net.iGap.module.CircleImageView) AppCompatTextView(androidx.appcompat.widget.AppCompatTextView) Theme(net.iGap.module.Theme) ColorStateList(android.content.res.ColorStateList) AvatarHandler(net.iGap.helper.avatar.AvatarHandler) ParamWithAvatarType(net.iGap.helper.avatar.ParamWithAvatarType) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView)

Example 3 with CircleImageView

use of net.iGap.module.CircleImageView 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 4 with CircleImageView

use of net.iGap.module.CircleImageView in project iGap-Android by KianIranian-STDG.

the class JoinDialogFragment method setupView.

private void setupView(View view) {
    CircleImageView ivAvatar = view.findViewById(R.id.ivAvatar);
    TextView tvName = view.findViewById(R.id.tvName);
    TextView tvTitle = view.findViewById(R.id.tvTitle);
    TextView tvMemberCount = view.findViewById(R.id.tvMemberCount);
    TextView btnCancel = view.findViewById(R.id.btnCancel);
    TextView btnJoin = view.findViewById(R.id.btnJoin);
    String title = getString(R.string.do_you_want_to_join_to_this);
    String memberNumber = "";
    switch(mRoom.getType()) {
        case CHANNEL:
            if (HelperCalander.isPersianUnicode) {
                title += getString(R.string.channel) + " " + "عضو شوید؟";
            } else {
                title += getString(R.string.channel) + "?";
            }
            memberNumber = mRoom.getChannelRoomExtra().getParticipantsCount() + " " + G.context.getString(R.string.member_chat);
            break;
        case GROUP:
            if (HelperCalander.isPersianUnicode) {
                title += getString(R.string.group) + " " + "عضو شوید؟";
            } else {
                title += getString(R.string.group) + "?";
            }
            memberNumber = mRoom.getGroupRoomExtra().getParticipantsCount() + " " + getString(R.string.member_chat);
            break;
    }
    tvTitle.setText(title);
    tvName.setText(mRoom.getTitle());
    tvMemberCount.setText(memberNumber);
    if (getActivity() != null) {
        ((ActivityEnhanced) getActivity()).avatarHandler.getAvatar(new ParamWithAvatarType(ivAvatar, mRoom.getId()).avatarType(AvatarHandler.AvatarType.ROOM));
    }
    btnCancel.setOnClickListener(v -> {
        mListener.onCancelClicked();
        dismiss();
    });
    btnJoin.setOnClickListener(v -> {
        mListener.onJoinClicked();
        dismiss();
    });
}
Also used : CircleImageView(net.iGap.module.CircleImageView) TextView(android.widget.TextView) ParamWithAvatarType(net.iGap.helper.avatar.ParamWithAvatarType)

Example 5 with CircleImageView

use of net.iGap.module.CircleImageView in project iGap-Android by KianIranian-STDG.

the class Toolbar method onLayout.

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    int titleLeft;
    int titleTop = 0;
    int avatarTop;
    int verifyLeft = 0;
    if (backIcon != null && backIcon.getVisibility() != GONE) {
        backIcon.layout(0, 0, backIcon.getMeasuredWidth(), getMeasuredHeight());
        if (circleImageView != null)
            // 46 icon width
            titleLeft = LayoutCreator.dp(46);
        else
            // 46 icon width + 8 margin
            titleLeft = LayoutCreator.dp(54);
        if (backIcon.getDrawable() == null) {
            titleLeft = LayoutCreator.dp(16);
        }
    } else {
        titleLeft = LayoutCreator.dp(16);
    }
    if (circleImageView != null && circleImageView.getVisibility() != GONE) {
        avatarTop = getMeasuredHeight() / 2 - (circleImageView.getMeasuredHeight() / 2);
        circleImageView.layout(titleLeft, avatarTop, titleLeft + circleImageView.getMeasuredWidth(), circleImageView.getMeasuredWidth() + avatarTop);
        // 46 icon width + 46 avatar width + 8 margin.
        titleLeft += LayoutCreator.dp(54);
    }
    if (titleTextView != null && titleTextView.getVisibility() != GONE) {
        int titleTextHeight = titleTextView.getMeasuredHeight();
        if (subTitleTextView != null && subTitleTextView.getVisibility() != GONE) {
            titleTop = (getMeasuredHeight() / 2 - titleTextHeight) / 2 + LayoutCreator.dp(5);
        } else {
            titleTop = (getMeasuredHeight() - titleTextHeight) / 2;
        }
        int titleRight = titleLeft + titleTextView.getMeasuredWidth();
        if (titleLeft + titleTextView.getMeasuredWidth() > getWidth() - (items != null ? items.getMeasuredWidth() : 0)) {
            titleRight -= items != null ? items.getMeasuredWidth() : 0;
        }
        titleTextView.layout(titleLeft, titleTop, titleRight, titleTop + titleTextHeight);
        verifyLeft = titleRight + LayoutCreator.dp(5);
    }
    if (subTitleTextView != null && subTitleTextView.getVisibility() != GONE) {
        int textTop = getMeasuredHeight() / 2 + (getMeasuredHeight() / 2 - subTitleTextView.getMeasuredHeight()) / 2 - LayoutCreator.dp(4);
        subTitleTextView.layout(titleLeft, textTop, titleLeft + subTitleTextView.getMeasuredWidth(), textTop + subTitleTextView.getMeasuredHeight());
    }
    if (verifiedChannelsIcon != null && verifiedChannelsIcon.getVisibility() != GONE) {
        int verifyTop = titleTop + (titleTextView.getMeasuredHeight() / 2 - verifiedChannelsIcon.getMeasuredHeight() / 2);
        verifiedChannelsIcon.layout(verifyLeft, verifyTop, verifyLeft + verifiedChannelsIcon.getMeasuredWidth(), verifiedChannelsIcon.getMeasuredHeight() + verifyTop);
        verifyLeft += verifiedChannelsIcon.getMeasuredWidth() + LayoutCreator.dp(5);
    }
    if (muteIcon != null && muteIcon.getVisibility() != GONE) {
        int muteTop = titleTop + (titleTextView.getMeasuredHeight() / 2 - muteIcon.getMeasuredHeight() / 2);
        muteIcon.layout(verifyLeft, muteTop, verifyLeft + muteIcon.getMeasuredWidth(), muteIcon.getMeasuredHeight() + muteTop);
    }
    if (items != null) {
        int menuLeft = isSearchBoxVisible ? LayoutCreator.dp(64) : getMeasuredWidth() - items.getMeasuredWidth();
        items.layout(menuLeft, 0, menuLeft + items.getMeasuredWidth(), items.getMeasuredHeight());
    }
    int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = getChildAt(i);
        if (child.getVisibility() == GONE || child == titleTextView || child == subTitleTextView || child == items || child == backIcon || child == circleImageView || child == verifiedChannelsIcon || child == muteIcon) {
            continue;
        }
        LayoutParams lp = (LayoutParams) child.getLayoutParams();
        int width = child.getMeasuredWidth();
        int height = child.getMeasuredHeight();
        int childLeft;
        int childTop;
        int gravity = lp.gravity;
        if (gravity == -1) {
            gravity = Gravity.TOP | Gravity.LEFT;
        }
        final int absoluteGravity = gravity & Gravity.HORIZONTAL_GRAVITY_MASK;
        final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
        switch(absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
            case Gravity.CENTER_HORIZONTAL:
                childLeft = (right - left - width) / 2 + lp.leftMargin - lp.rightMargin;
                break;
            case Gravity.RIGHT:
                childLeft = right - width - lp.rightMargin;
                break;
            case Gravity.LEFT:
            default:
                childLeft = lp.leftMargin;
        }
        switch(verticalGravity) {
            case Gravity.CENTER_VERTICAL:
                childTop = (bottom - top - height) / 2 + lp.topMargin - lp.bottomMargin;
                break;
            case Gravity.BOTTOM:
                childTop = (bottom - top) - height - lp.bottomMargin;
                break;
            default:
                childTop = lp.topMargin;
        }
        child.layout(childLeft, childTop, childLeft + width, childTop + height);
    }
}
Also used : AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) ImageView(android.widget.ImageView) View(android.view.View) CircleImageView(net.iGap.module.CircleImageView) TextView(android.widget.TextView)

Aggregations

CircleImageView (net.iGap.module.CircleImageView)11 TextView (android.widget.TextView)9 View (android.view.View)6 LinearLayout (android.widget.LinearLayout)5 AppCompatImageView (androidx.appcompat.widget.AppCompatImageView)5 ImageView (android.widget.ImageView)4 FontIconTextView (net.iGap.module.FontIconTextView)4 FrameLayout (android.widget.FrameLayout)3 AppCompatTextView (androidx.appcompat.widget.AppCompatTextView)3 IconView (net.iGap.messenger.ui.components.IconView)3 MaterialDesignTextView (net.iGap.module.MaterialDesignTextView)3 ImageLoadingView (net.iGap.story.liststories.ImageLoadingView)3 ParamWithAvatarType (net.iGap.helper.avatar.ParamWithAvatarType)2 CheckBox (net.iGap.module.customView.CheckBox)2 ColorStateList (android.content.res.ColorStateList)1 GradientDrawable (android.graphics.drawable.GradientDrawable)1 InsetDrawable (android.graphics.drawable.InsetDrawable)1 LayerDrawable (android.graphics.drawable.LayerDrawable)1 DisplayMetrics (android.util.DisplayMetrics)1 TypedValue (android.util.TypedValue)1