Search in sources :

Example 21 with ParamWithAvatarType

use of net.iGap.helper.avatar.ParamWithAvatarType in project iGap-Android by KianIranian-STDG.

the class EditChannelFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    avatarHandler.getAvatar(new ParamWithAvatarType(binding.channelAvatar, viewModel.roomId).avatarType(AvatarHandler.AvatarType.ROOM).showMain());
    viewModel.onCreateFragment(this);
    HelperToolbar mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLogoShown(true).setDefaultTitle(getContext().getResources().getString(R.string.tab_edit)).setLeftIcon(R.string.icon_back).setRightIcons(R.string.icon_sent).setListener(new ToolbarListener() {

        @Override
        public void onLeftIconClickListener(View view) {
            popBackStackFragment();
        }

        @Override
        public void onRightIconClickListener(View view) {
            viewModel.setData(binding.channelNameEditText.getEditableText().toString(), binding.groupDescriptionEditText.getEditableText().toString());
            hideKeyboard();
        }
    });
    binding.toolbar.addView(mHelperToolbar.getView());
    viewModel.goToMembersPage.observe(getViewLifecycleOwner(), b -> {
        if (b != null && b) {
            showListForCustomRole(ProtoGroupGetMemberList.GroupGetMemberList.FilterRole.ALL.toString());
        }
    });
    viewModel.goToAdministratorPage.observe(getViewLifecycleOwner(), b -> {
        if (b != null && b) {
            showListForCustomRole(ProtoGroupGetMemberList.GroupGetMemberList.FilterRole.ADMIN.toString());
        }
    });
    viewModel.goToModeratorPage.observe(getViewLifecycleOwner(), aBoolean -> {
        if (aBoolean != null && aBoolean) {
            showListForCustomRole(ProtoGroupGetMemberList.GroupGetMemberList.FilterRole.MODERATOR.toString());
        }
    });
    viewModel.closePageImediatly.observe(getViewLifecycleOwner(), isClose -> {
        if (isClose == null || !isClose)
            return;
        popBackStackFragment();
    });
    viewModel.initEmoji.observe(getViewLifecycleOwner(), aBoolean -> {
    // if (aBoolean != null) {
    // emojiPopup.toggle();
    // }
    });
    viewModel.showDialogLeaveGroup.observe(getViewLifecycleOwner(), aBoolean -> {
        if (aBoolean != null && aBoolean) {
        /*groupLeft();*/
        }
    });
    viewModel.showSelectImageDialog.observe(getViewLifecycleOwner(), aBoolean -> {
        if (aBoolean != null && aBoolean) {
            startDialogSelectPicture();
        }
    });
    viewModel.showConvertChannelDialog.observe(getViewLifecycleOwner(), aBoolean -> {
        if (aBoolean != null) {
            showPopUp(aBoolean);
        }
    });
    viewModel.showDeleteChannelDialog.observe(getViewLifecycleOwner(), aBoolean -> {
        if (aBoolean != null) {
            deleteChannel(aBoolean);
        }
    });
    viewModel.goBack.observe(getViewLifecycleOwner(), aBoolean -> {
        if (aBoolean != null && aBoolean) {
            popBackStackFragment();
        }
    });
    viewModel.goToChatRoom.observe(getViewLifecycleOwner(), go -> {
        if (getActivity() instanceof ActivityMain && go != null && go) {
            ((ActivityMain) getActivity()).removeAllFragmentFromMain();
        /*new HelperFragment(getActivity().getSupportFragmentManager()).popBackStack(3);*/
        }
    });
    viewModel.onSignClickListener.observe(getViewLifecycleOwner(), isClicked -> {
        binding.signedMessage.setChecked(!binding.signedMessage.isChecked());
    });
    viewModel.onReactionMessageClickListener.observe(getViewLifecycleOwner(), isClicked -> {
        binding.rateMessage.setChecked(!binding.rateMessage.isChecked());
    });
    viewModel.getChannelAvatarUpdatedLiveData().observe(getViewLifecycleOwner(), roomId -> {
        if (roomId != null && roomId == viewModel.roomId)
            avatarHandler.getAvatar(new ParamWithAvatarType(binding.channelAvatar, viewModel.roomId).avatarType(AvatarHandler.AvatarType.ROOM).showMain());
    });
    viewModel.showChangeUsername.observe(getViewLifecycleOwner(), username -> {
        if (username != null) {
            setUsername(username);
        }
    });
// setEmojiColor();
}
Also used : ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) ActivityMain(net.iGap.activities.ActivityMain) HelperToolbar(net.iGap.helper.HelperToolbar) ParamWithAvatarType(net.iGap.helper.avatar.ParamWithAvatarType) View(android.view.View) TextView(android.widget.TextView)

Example 22 with ParamWithAvatarType

use of net.iGap.helper.avatar.ParamWithAvatarType in project iGap-Android by KianIranian-STDG.

the class SearchItamIGap method bindView.

@Override
public void bindView(final ViewHolder holder, List payloads) {
    super.bindView(holder, payloads);
    holder.txtIcon.setVisibility(View.GONE);
    if (item.getType() == ProtoClientSearchUsername.ClientSearchUsernameResponse.Result.Type.USER) {
        avatarHandler.getAvatar(new ParamWithAvatarType(holder.avatar, item.getUser().getId()).avatarType(AvatarHandler.AvatarType.USER));
        holder.name.setText(item.getUser().getDisplayName());
        holder.lastSeen.setText(item.getUser().getUsername());
    } else if (item.getType() == ProtoClientSearchUsername.ClientSearchUsernameResponse.Result.Type.ROOM) {
        avatarHandler.getAvatar(new ParamWithAvatarType(holder.avatar, item.getRoom().getId()).avatarType(AvatarHandler.AvatarType.ROOM));
        holder.name.setText(item.getRoom().getTitle());
        if (item.getRoom().getType() == ProtoGlobal.Room.Type.CHANNEL) {
            holder.lastSeen.setText(item.getRoom().getChannelRoomExtra().getPublicExtra().getUsername());
        } else if (item.getRoom().getType() == ProtoGlobal.Room.Type.GROUP) {
            holder.lastSeen.setText(item.getRoom().getGroupRoomExtra().getPublicExtra().getUsername());
        }
        Typeface typeFaceIcon = ResourcesCompat.getFont(holder.txtIcon.getContext(), R.font.font_icons);
        if (item.getRoom().getType() == ProtoGlobal.Room.Type.GROUP) {
            holder.txtIcon.setTypeface(typeFaceIcon);
            holder.txtIcon.setVisibility(View.VISIBLE);
            holder.txtIcon.setText(G.context.getString(R.string.icon_contacts));
        } else if (item.getRoom().getType() == ProtoGlobal.Room.Type.CHANNEL) {
            holder.txtIcon.setTypeface(typeFaceIcon);
            holder.txtIcon.setVisibility(View.VISIBLE);
            holder.txtIcon.setText(G.context.getString(R.string.icon_channel));
        }
    }
    holder.txtTime.setText("");
    if (HelperCalander.isPersianUnicode) {
        holder.name.setText(holder.name.getText().toString());
        holder.lastSeen.setText(HelperCalander.convertToUnicodeFarsiNumber(holder.lastSeen.getText().toString()));
        holder.txtTime.setText(HelperCalander.convertToUnicodeFarsiNumber(holder.txtTime.getText().toString()));
    }
}
Also used : Typeface(android.graphics.Typeface) ParamWithAvatarType(net.iGap.helper.avatar.ParamWithAvatarType)

Example 23 with ParamWithAvatarType

use of net.iGap.helper.avatar.ParamWithAvatarType in project iGap-Android by KianIranian-STDG.

the class BeepTunesProfileFragment method onStart.

@Override
public void onStart() {
    super.onStart();
    avatarHandler.registerChangeFromOtherAvatarHandler();
    avatarHandler.getAvatar(new ParamWithAvatarType(profileImage, AccountManager.getInstance().getCurrentUser().getId()).avatarType(AvatarHandler.AvatarType.USER).showMain());
}
Also used : ParamWithAvatarType(net.iGap.helper.avatar.ParamWithAvatarType)

Aggregations

ParamWithAvatarType (net.iGap.helper.avatar.ParamWithAvatarType)23 AvatarHandler (net.iGap.helper.avatar.AvatarHandler)10 View (android.view.View)9 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)8 HelperFragment (net.iGap.helper.HelperFragment)8 Theme (net.iGap.module.Theme)8 TextView (android.widget.TextView)7 NonNull (androidx.annotation.NonNull)7 Bundle (android.os.Bundle)6 Nullable (androidx.annotation.Nullable)6 ArrayList (java.util.ArrayList)6 List (java.util.List)6 G (net.iGap.G)6 R (net.iGap.R)6 CircleImageView (net.iGap.module.CircleImageView)6 DbManager (net.iGap.module.accountManager.DbManager)6 Gravity (android.view.Gravity)5 ViewGroup (android.view.ViewGroup)5 FrameLayout (android.widget.FrameLayout)5 Toast (android.widget.Toast)5