Search in sources :

Example 1 with RoomListCell

use of net.iGap.adapter.items.cells.RoomListCell in project iGap-Android by KianIranian-STDG.

the class RoomListAdapter method onCreateViewHolder.

@NotNull
@Override
public ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType) {
    RoomListCell roomListCell = new RoomListCell(parent.getContext());
    roomListCell.setLayoutParams(LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 72));
    return new ViewHolder(roomListCell);
}
Also used : RoomListCell(net.iGap.adapter.items.cells.RoomListCell) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with RoomListCell

use of net.iGap.adapter.items.cells.RoomListCell in project iGap-Android by KianIranian-STDG.

the class MainFragment method onViewCreated.

@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    HelperTracker.sendTracker(HelperTracker.TRACKER_ROOM_PAGE);
    getEventManager().addObserver(EventManager.CALL_STATE_CHANGED, this);
    getEventManager().addObserver(EventManager.EMOJI_LOADED, this);
    getEventManager().addObserver(EventManager.ROOM_LIST_CHANGED, this);
    getEventManager().addObserver(EventManager.CONNECTION_STATE_CHANGED, this);
    roomListAdapter.setCallBack(new RoomListAdapter.OnMainFragmentCallBack() {

        @Override
        public void onClick(RoomListCell roomListCell, RealmRoom realmRoom, int adapterPosition) {
            onItemClick(roomListCell, realmRoom, adapterPosition);
        }

        @Override
        public boolean onLongClick(RoomListCell roomListCell, RealmRoom realmRoom, int position) {
            if (!inMultiSelectMode && FragmentChat.mForwardMessages == null && !HelperGetDataFromOtherApp.hasSharedData) {
                enableMultiSelect();
                updateSelectedRoom(realmRoom, position);
                createActionMode();
                multiSelectCounter.setNumber(selectedRoom.size(), selectedRoom.size() != 1);
                toolbar.showActionToolbar();
                BackDrawable backDrawable = new BackDrawable(true);
                backDrawable.setRotation(1, true);
                backDrawable.setRotatedColor(Theme.getInstance().getPrimaryTextColor(getContext()));
                toolbar.setBackIcon(backDrawable);
                AnimatorSet animatorSet = new AnimatorSet();
                ArrayList<Animator> animators = new ArrayList<>();
                for (int a = 0; a < actionModeViews.size(); a++) {
                    View view = actionModeViews.get(a);
                    view.setPivotY(Toolbar.getCurrentActionBarHeight() / 2);
                    animators.add(ObjectAnimator.ofFloat(view, View.SCALE_Y, 0.1f, 1.0f));
                }
                animatorSet.playTogether(animators);
                animatorSet.setDuration(180);
                animatorSet.start();
            }
            return true;
        }

        @Override
        public void needShowLoadProgress(boolean show) {
            loadingProgress.setVisibility(show ? View.VISIBLE : View.GONE);
        }

        @Override
        public void needShowEmptyView(boolean show) {
            emptyView.setVisibility(show ? View.VISIBLE : View.GONE);
        }

        @Override
        public void needCheckMultiSelect() {
            disableMultiSelect();
        }
    });
    G.onNotifyTime = () -> G.handler.post(() -> {
        if (recyclerView != null) {
            if (recyclerView.getAdapter() != null) {
                recyclerView.getAdapter().notifyDataSetChanged();
            }
        }
    });
    setForwardMessage(true);
    checkHasSharedData(true);
    checkMultiSelectState();
}
Also used : RoomListAdapter(net.iGap.adapter.RoomListAdapter) RoomListCell(net.iGap.adapter.items.cells.RoomListCell) ArrayList(java.util.ArrayList) BackDrawable(net.iGap.messenger.ui.toolBar.BackDrawable) AnimatorSet(android.animation.AnimatorSet) RealmRoom(net.iGap.realm.RealmRoom) ImageView(android.widget.ImageView) NumberTextView(net.iGap.messenger.ui.toolBar.NumberTextView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) IconView(net.iGap.messenger.ui.components.IconView) SuppressLint(android.annotation.SuppressLint)

Aggregations

RoomListCell (net.iGap.adapter.items.cells.RoomListCell)2 AnimatorSet (android.animation.AnimatorSet)1 SuppressLint (android.annotation.SuppressLint)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 CircleImageView (de.hdodenhof.circleimageview.CircleImageView)1 ArrayList (java.util.ArrayList)1 RoomListAdapter (net.iGap.adapter.RoomListAdapter)1 IconView (net.iGap.messenger.ui.components.IconView)1 BackDrawable (net.iGap.messenger.ui.toolBar.BackDrawable)1 NumberTextView (net.iGap.messenger.ui.toolBar.NumberTextView)1 RealmRoom (net.iGap.realm.RealmRoom)1 NotNull (org.jetbrains.annotations.NotNull)1