Search in sources :

Example 1 with IconView

use of net.iGap.messenger.ui.components.IconView in project iGap-Android by KianIranian-STDG.

the class MyStatusStoryListFragment method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    if (getContext() == null)
        return super.onCreateView(inflater, container, savedInstanceState);
    Toolbar myStoryToolbar = new Toolbar(getContext());
    myStoryToolbar.setTitle(getString(R.string.my_status));
    myStoryToolbar.setBackIcon(new BackDrawable(false));
    myStoryToolbar.setListener(i -> {
        switch(i) {
            case -1:
                requireActivity().onBackPressed();
                break;
        }
    });
    FrameLayout rootView = new FrameLayout(new ContextThemeWrapper(context, R.style.IGapRootViewStyle));
    rootView.addView(myStoryToolbar, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.TOP));
    recyclerListView = new RecyclerListView(getContext());
    adapter = new ListAdapter();
    recyclerListView.setAdapter(adapter);
    recyclerListView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
    recyclerListView.setClipToPadding(false);
    recyclerListView.setVisibility(View.GONE);
    recyclerListView.setPadding(0, 0, 0, LayoutCreator.dp(30));
    rootView.addView(recyclerListView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT, Gravity.TOP, 0, LayoutCreator.getDimen(R.dimen.toolbar_height), 0, 0));
    progressBar = new ProgressBar(context);
    progressBar.setVisibility(View.GONE);
    rootView.addView(progressBar, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    actionButtonsRootView = new LinearLayout(context);
    actionButtonsRootView.setOrientation(LinearLayout.VERTICAL);
    rootView.addView(actionButtonsRootView, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isAppRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM, 16, 0, 16, 16));
    customStatusActionLayout = new FrameLayout(context);
    Drawable customStatusDrawable = Theme.createSimpleSelectorCircleDrawable(LayoutCreator.dp(56), Theme.getInstance().getToolbarBackgroundColor(context), Theme.getInstance().getAccentColor(context));
    customStatusActionLayout.setBackground(customStatusDrawable);
    IconView customStatusAddButton = new IconView(context);
    customStatusAddButton.setIcon(R.string.icon_edit);
    customStatusAddButton.setIconColor(Color.WHITE);
    customStatusActionLayout.addView(customStatusAddButton);
    actionButtonsRootView.addView(customStatusActionLayout, LayoutCreator.createLinear(42, 42, Gravity.CENTER, 0, 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_camera);
    addButton.setIconColor(Color.WHITE);
    floatActionLayout.addView(addButton);
    actionButtonsRootView.addView(floatActionLayout, LayoutCreator.createLinear(52, 52, Gravity.CENTER, 0, 10, 0, 0));
    return rootView;
}
Also used : IconView(net.iGap.messenger.ui.components.IconView) ContextThemeWrapper(android.view.ContextThemeWrapper) FrameLayout(android.widget.FrameLayout) Drawable(android.graphics.drawable.Drawable) BackDrawable(net.iGap.messenger.ui.toolBar.BackDrawable) BackDrawable(net.iGap.messenger.ui.toolBar.BackDrawable) RecyclerListView(net.iGap.module.customView.RecyclerListView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout) Toolbar(net.iGap.messenger.ui.toolBar.Toolbar) Nullable(androidx.annotation.Nullable)

Example 2 with IconView

use of net.iGap.messenger.ui.components.IconView in project iGap-Android by KianIranian-STDG.

the class StoryFragment method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    if (getContext() == null)
        return super.onCreateView(inflater, container, savedInstanceState);
    Toolbar storyToolbar = new Toolbar(getContext());
    storyToolbar.setTitle(isAppRtl ? R.string.logo_igap_fa : R.string.logo_igap_en);
    ToolbarItems toolbarItems = storyToolbar.createToolbarItems();
    toolbarItems.addItemWithWidth(codeScannerTag, R.string.icon_QR_code, 54);
    storyToolbar.setListener(i -> {
        switch(i) {
            case codeScannerTag:
                onCodeScannerClickListener();
                break;
        }
    });
    FrameLayout rootView = new FrameLayout(new ContextThemeWrapper(context, R.style.IGapRootViewStyle));
    rootView.addView(storyToolbar, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.TOP));
    swipeRefreshLayout = new SwipeRefreshLayout(context);
    swipeRefreshLayout.setRefreshing(false);
    rootView.addView(swipeRefreshLayout, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT, Gravity.TOP, 0, LayoutCreator.getDimen(R.dimen.toolbar_height), 0, 0));
    recyclerListView = new RecyclerListView(getContext());
    adapter = new ListAdapter();
    recyclerListView.setAdapter(adapter);
    recyclerListView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
    recyclerListView.setClipToPadding(false);
    recyclerListView.setPadding(0, 0, 0, LayoutCreator.dp(30));
    swipeRefreshLayout.addView(recyclerListView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT, Gravity.CENTER, 0, 0, 0, 0));
    progressBar = new ProgressBar(context);
    progressBar.setVisibility(View.GONE);
    rootView.addView(progressBar, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    actionButtonsRootView = new LinearLayout(context);
    actionButtonsRootView.setOrientation(LinearLayout.VERTICAL);
    rootView.addView(actionButtonsRootView, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isAppRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM, 16, 0, 16, 16));
    customStatusActionLayout = new FrameLayout(context);
    Drawable customStatusDrawable = Theme.createSimpleSelectorCircleDrawable(LayoutCreator.dp(56), Theme.getInstance().getToolbarBackgroundColor(context), Theme.getInstance().getAccentColor(context));
    customStatusActionLayout.setBackground(customStatusDrawable);
    IconView customStatusAddButton = new IconView(context);
    customStatusAddButton.setIcon(R.string.icon_edit);
    customStatusAddButton.setIconColor(Color.WHITE);
    customStatusActionLayout.addView(customStatusAddButton);
    actionButtonsRootView.addView(customStatusActionLayout, LayoutCreator.createLinear(42, 42, Gravity.CENTER, 0, 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_camera);
    addButton.setIconColor(Color.WHITE);
    floatActionLayout.addView(addButton);
    actionButtonsRootView.addView(floatActionLayout, LayoutCreator.createLinear(52, 52, Gravity.CENTER, 0, 10, 0, 0));
    return rootView;
}
Also used : IconView(net.iGap.messenger.ui.components.IconView) ContextThemeWrapper(android.view.ContextThemeWrapper) FrameLayout(android.widget.FrameLayout) ToolbarItems(net.iGap.messenger.ui.toolBar.ToolbarItems) Drawable(android.graphics.drawable.Drawable) RecyclerListView(net.iGap.module.customView.RecyclerListView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) SwipeRefreshLayout(androidx.swiperefreshlayout.widget.SwipeRefreshLayout) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout) Toolbar(net.iGap.messenger.ui.toolBar.Toolbar) Nullable(androidx.annotation.Nullable)

Example 3 with IconView

use of net.iGap.messenger.ui.components.IconView in project iGap-Android by KianIranian-STDG.

the class MainFragment method muteNotification.

private void muteNotification() {
    if (selectedRoom.size() > 0) {
        long roomId = selectedRoom.get(0);
        boolean mute = getMessageDataStorage().getRoom(roomId).mute;
        FrameLayout frameLayout = new FrameLayout(context);
        frameLayout.setBackground(ContextCompat.getDrawable(context, R.drawable.drawable_rounded_corners));
        IconView iconView = new IconView(context);
        iconView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
        if (mute)
            iconView.setIcon(R.string.icon_speaker);
        else
            iconView.setIcon(R.string.icon_mute);
        iconView.setIconColor(Theme.getInstance().getPrimaryTextIconColor(context));
        frameLayout.addView(iconView, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, isAppRtl ? Gravity.RIGHT : Gravity.LEFT, 20, 16, 20, 20));
        TextView textView = new TextView(context);
        textView.setTypeface(ResourcesCompat.getFont(context, R.font.main_font));
        if (mute)
            textView.setText(R.string.unmuted);
        else
            textView.setText(R.string.muted);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
        textView.setTextColor(Theme.getInstance().getTitleTextColor(context));
        frameLayout.addView(textView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT, isAppRtl ? Gravity.RIGHT : Gravity.LEFT, isAppRtl ? 5 : 50, 15, isAppRtl ? 50 : 5, 15));
        Animation fadeIn = new AlphaAnimation(0, 1);
        fadeIn.setDuration(1000);
        iconView.setAnimation(fadeIn);
        Snackbar snackbar = Snackbar.make(requireView(), "", Snackbar.LENGTH_LONG);
        Snackbar.SnackbarLayout layout = (Snackbar.SnackbarLayout) snackbar.getView();
        layout.setBackgroundColor(Color.TRANSPARENT);
        layout.addView(frameLayout, 0);
        snackbar.show();
        for (int i = 0; i < selectedRoom.size(); i++) {
            roomId = selectedRoom.get(i);
            mute = getMessageDataStorage().getRoom(roomId).mute;
            getRoomController().clientMuteRoom(roomId, !mute);
        }
    }
    disableMultiSelect();
}
Also used : IconView(net.iGap.messenger.ui.components.IconView) FrameLayout(android.widget.FrameLayout) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) NumberTextView(net.iGap.messenger.ui.toolBar.NumberTextView) TextView(android.widget.TextView) AlphaAnimation(android.view.animation.AlphaAnimation) SuppressLint(android.annotation.SuppressLint) Snackbar(com.google.android.material.snackbar.Snackbar)

Example 4 with IconView

use of net.iGap.messenger.ui.components.IconView in project iGap-Android by KianIranian-STDG.

the class StoryCell method initView.

public void initView(Context context, boolean needDivider, CircleStatus status, ImageLoadingView.Status imageLoadingStatus, IconClicked iconClicked, long createTime) {
    removeAllViews();
    if (G.themeColor == Theme.DARK) {
        setBackground(Theme.getSelectorDrawable(Theme.getInstance().getDividerColor(context)));
    } else {
        setBackgroundColor(Color.WHITE);
    }
    this.status = status;
    this.needDivider = needDivider;
    this.iconClicked = iconClicked;
    this.context = context;
    setWillNotDraw(!needDivider);
    View view;
    switch(this.status) {
        case CIRCLE_IMAGE:
            circleImage = new CircleImageView(getContext());
            circleImage.setLayoutParams(LayoutCreator.createFrame(56, 56, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, isRtl ? 0 : padding, 8, isRtl ? padding : 0, 8));
            view = circleImage;
            break;
        case LOADING_CIRCLE_IMAGE:
            circleImageLoading = new ImageLoadingView(context);
            circleImageLoading.setStatus(imageLoadingStatus);
            circleImageLoading.setLayoutParams(LayoutCreator.createFrame(72, 72, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, isRtl ? 0 : 8, 8, isRtl ? 8 : 0, 8));
            view = circleImageLoading;
            break;
        default:
            throw new IllegalStateException("Unexpected value: " + this.status);
    }
    addView(view);
    addIcon = new MaterialDesignTextView(context);
    addIcon.setText(R.string.icon_add_whit_circle);
    addIcon.setTextColor(getResources().getColor(R.color.green));
    addIcon.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    addIcon.setGravity(isRtl ? Gravity.LEFT : Gravity.RIGHT);
    addView(addIcon, LayoutCreator.createFrame(18, 18, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM, isRtl ? 0 : padding, 8, isRtl ? padding : 0, 8));
    topViewRootView = new LinearLayout(context);
    topViewRootView.setOrientation(LinearLayout.HORIZONTAL);
    topViewRootView.setGravity(Gravity.CENTER);
    addView(topViewRootView, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, isRtl ? padding : ((padding * 2) + 56), 11.5f, isRtl ? ((padding * 2) + 56) : padding, 0));
    channelIconTv = new FontIconTextView(getContext());
    setTextSize(channelIconTv, R.dimen.dp14);
    channelIconTv.setText(R.string.icon_channel);
    channelIconTv.setTextColor(Theme.getInstance().getAccentColor(channelIconTv.getContext()));
    channelIconTv.setVisibility(GONE);
    topViewRootView.addView(channelIconTv, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    topText = new TextView(context);
    topText.setSingleLine();
    topText.setTypeface(ResourcesCompat.getFont(getContext(), R.font.main_font_bold));
    ViewMaker.setTextSize(topText, R.dimen.dp15);
    topText.setSingleLine(true);
    topText.setEllipsize(TextUtils.TruncateAt.END);
    topText.setTextColor(Theme.getInstance().getSendMessageTextColor(topText.getContext()));
    topText.setGravity((isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
    topViewRootView.addView(topText, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, !isRtl && roomId != 0 && userId != AccountManager.getInstance().getCurrentUser().getId() ? 4 : 0, 0, isRtl && roomId != 0 && userId != AccountManager.getInstance().getCurrentUser().getId() ? 4 : 0, 0));
    verifyIconTv = new FontIconTextView(getContext());
    verifyIconTv.setTextColor(getContext().getResources().getColor(R.color.verify_color));
    verifyIconTv.setText(R.string.icon_blue_badge);
    setTextSize(verifyIconTv, R.dimen.standardTextSize);
    verifyIconTv.setVisibility(GONE);
    topViewRootView.addView(verifyIconTv, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, !isRtl && roomId != 0 && userId != AccountManager.getInstance().getCurrentUser().getId() ? 4 : 0, 0, isRtl && roomId != 0 && userId != AccountManager.getInstance().getCurrentUser().getId() ? 4 : 0, 0));
    middleText = new TextView(context);
    middleText.setSingleLine();
    middleText.setTypeface(ResourcesCompat.getFont(getContext(), R.font.main_font_bold));
    ViewMaker.setTextSize(middleText, R.dimen.dp15);
    middleText.setSingleLine(true);
    middleText.setEllipsize(TextUtils.TruncateAt.END);
    middleText.setTextColor(Theme.getInstance().getPrimaryTextColor(context));
    middleText.setGravity((isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    middleText.setVisibility(GONE);
    addView(middleText, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, isRtl ? padding : ((padding * 2) + 56), 0, isRtl ? ((padding * 2) + 56) : padding, 0));
    bottomText = new TextView(context);
    bottomText.setSingleLine();
    ViewMaker.setTypeFace(bottomText);
    ViewMaker.setTextSize(bottomText, R.dimen.dp13);
    bottomText.setGravity((isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
    bottomText.setTextColor(Color.GRAY);
    addView(bottomText, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, isRtl ? padding : ((padding * 2) + 56), 34.5f, isRtl ? ((padding * 2) + 56) : padding, 0));
    icon = new IconView(getContext());
    icon.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    icon.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
    addView(icon, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, padding, 0, padding, 0));
    icon2 = new IconView(getContext());
    icon2.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    icon2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
    addView(icon2, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, isRtl ? (padding + 30) : padding, 0, isRtl ? padding : (30 + padding), 0));
    LinearLayout iconsRootView = new LinearLayout(getContext());
    iconsRootView.setOrientation(LinearLayout.HORIZONTAL);
    iconsRootView.setGravity(Gravity.CENTER);
    addView(iconsRootView, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, isRtl ? 0 : 8, 8, isRtl ? 8 : 0, 8));
    uploadIcon = new MaterialDesignTextView(getContext());
    uploadIcon.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    uploadIcon.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 23);
    uploadIcon.setText(R.string.icon_upload);
    uploadIcon.setVisibility(GONE);
    uploadIcon.setTextColor(Theme.getInstance().getSendMessageTextColor(uploadIcon.getContext()));
    uploadIcon.setGravity(Gravity.CENTER);
    uploadIcon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if ((circleImageLoading.getStatus() == ImageLoadingView.Status.FAILED && isFromMyStatus && !isRoom) || (circleImageLoading.getStatus() == ImageLoadingView.Status.FAILED && isFromMyStatus && isRoom && mode == 1)) {
                deleteIcon.setVisibility(GONE);
                uploadIcon.setVisibility(GONE);
                middleText.setTextColor(Theme.getInstance().getTitleTextColor(context));
                middleText.setText(context.getString(R.string.story_sending));
                circleImageLoading.setStatus(ImageLoadingView.Status.LOADING);
                StoryObject realmStoryProto;
                if (fileToken != null) {
                    realmStoryProto = MessageDataStorage.getInstance(AccountManager.selectedAccount).getStoryWithFileToken(fileToken);
                } else {
                    realmStoryProto = MessageDataStorage.getInstance(AccountManager.selectedAccount).getStoryWithUploadId(uploadId);
                }
                if (realmStoryProto != null && realmStoryProto.fileToken != null) {
                    MessageDataStorage.getInstance(AccountManager.selectedAccount).updateStoryStatus(realmStoryProto.id, MessageObject.STATUS_SENDING);
                    List<ProtoStoryUserAddNew.StoryAddRequest> storyAddRequests = new ArrayList<>();
                    ProtoStoryUserAddNew.StoryAddRequest.Builder storyAddRequest = ProtoStoryUserAddNew.StoryAddRequest.newBuilder();
                    storyAddRequest.setToken(realmStoryProto.fileToken);
                    storyAddRequest.setCaption(realmStoryProto.caption);
                    storyAddRequests.add(storyAddRequest.build());
                    if (isRoom) {
                        MessageController.getInstance(AccountManager.selectedAccount).addMyRoomStory(storyAddRequests, roomId);
                    } else {
                        MessageController.getInstance(AccountManager.selectedAccount).addMyStory(storyAddRequests);
                    }
                } else if (realmStoryProto != null && !Uploader.getInstance().isCompressingOrUploading(String.valueOf(realmStoryProto.id))) {
                    MessageDataStorage.getInstance(AccountManager.selectedAccount).updateStoryStatus(realmStoryProto.id, MessageObject.STATUS_SENDING);
                    HttpUploader.isStoryUploading = true;
                    Uploader.getInstance().upload(UploadObject.createForStory(realmStoryProto.id, realmStoryProto.attachmentObject.filePath, null, realmStoryProto.caption, ProtoGlobal.RoomMessageType.STORY));
                }
                EventManager.getInstance(AccountManager.selectedAccount).postEvent(EventManager.STORY_SENDING);
            } else {
                deleteStory.deleteStory(StoryCell.this, storyId, roomId, isRoom);
            }
        }
    });
    deleteIcon = new MaterialDesignTextView(getContext());
    deleteIcon.setTypeface(ResourcesCompat.getFont(context, R.font.font_icons));
    deleteIcon.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 23);
    deleteIcon.setText(R.string.icon_other_horizontal_dots);
    deleteIcon.setVisibility(GONE);
    deleteIcon.setTextColor(Theme.getInstance().getSendMessageTextColor(deleteIcon.getContext()));
    deleteIcon.setGravity(Gravity.CENTER);
    deleteIcon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            deleteStory.deleteStory(StoryCell.this, storyId, roomId, isRoom);
        }
    });
    iconsRootView.addView(uploadIcon, LayoutCreator.createLinear(72, 72, Gravity.CENTER_VERTICAL));
    iconsRootView.addView(deleteIcon, LayoutCreator.createLinear(72, 72, Gravity.CENTER_VERTICAL));
    if (status == CircleStatus.LOADING_CIRCLE_IMAGE) {
        setOnClickListener(v -> {
            deleteStory.onStoryClick(this);
        });
        circleImageLoading.setOnClickListener(v -> {
            deleteStory.onStoryClick(this);
        });
    }
}
Also used : IconView(net.iGap.messenger.ui.components.IconView) MainStoryObject(net.iGap.story.MainStoryObject) StoryObject(net.iGap.story.StoryObject) FontIconTextView(net.iGap.module.FontIconTextView) View(android.view.View) FontIconTextView(net.iGap.module.FontIconTextView) TextView(android.widget.TextView) ImageLoadingView(net.iGap.story.liststories.ImageLoadingView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) IconView(net.iGap.messenger.ui.components.IconView) CircleImageView(net.iGap.module.CircleImageView) CircleImageView(net.iGap.module.CircleImageView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) ImageLoadingView(net.iGap.story.liststories.ImageLoadingView) FontIconTextView(net.iGap.module.FontIconTextView) TextView(android.widget.TextView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) List(java.util.List) ArrayList(java.util.ArrayList) ProtoStoryUserAddNew(net.iGap.proto.ProtoStoryUserAddNew) LinearLayout(android.widget.LinearLayout)

Example 5 with IconView

use of net.iGap.messenger.ui.components.IconView 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

IconView (net.iGap.messenger.ui.components.IconView)7 FrameLayout (android.widget.FrameLayout)5 LinearLayout (android.widget.LinearLayout)5 TextView (android.widget.TextView)5 Drawable (android.graphics.drawable.Drawable)4 ProgressBar (android.widget.ProgressBar)3 Nullable (androidx.annotation.Nullable)3 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)3 SuppressLint (android.annotation.SuppressLint)2 ContextThemeWrapper (android.view.ContextThemeWrapper)2 View (android.view.View)2 BackDrawable (net.iGap.messenger.ui.toolBar.BackDrawable)2 NumberTextView (net.iGap.messenger.ui.toolBar.NumberTextView)2 Toolbar (net.iGap.messenger.ui.toolBar.Toolbar)2 CircleImageView (net.iGap.module.CircleImageView)2 FontIconTextView (net.iGap.module.FontIconTextView)2 MaterialDesignTextView (net.iGap.module.MaterialDesignTextView)2 RecyclerListView (net.iGap.module.customView.RecyclerListView)2 Intent (android.content.Intent)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1