Search in sources :

Example 1 with SwipeDecor

use of com.mindorks.placeholderview.SwipeDecor in project Grupp by tmoronta1208.

the class VenueVoteSwipeActivity method loadSwipeView.

public void loadSwipeView(final List<Venue> venueVoteList) {
    mSwipeView.getBuilder().setDisplayViewCount(3).setSwipeDecor(new SwipeDecor().setPaddingTop(20).setRelativeScale(0.01f).setSwipeInMsgLayoutId(R.layout.card_swipe_in_msg_view).setSwipeOutMsgLayoutId(R.layout.card_swipe_out_msg_view));
    mSwipeView.addItemRemoveListener(new ItemRemovedListener() {

        @Override
        public void onItemRemoved(int count) {
            Log.d(TAG, "item removed");
            if (count == 0) {
                // currentEvent.setVenue_map(venueHashMap);
                String id = currentEvent.getEvent_id();
                EventGuest currentGuest = currentEvent.getEvent_guest_map().get(CurrentUser.userID);
                currentGuest.setVoted(true);
                CurrentUserPost.getInstance().postEventGuest(eventID, CurrentUser.userID, currentGuest);
                Intent eventIntent = new Intent(VenueVoteSwipeActivity.this, EventActivity.class);
                eventIntent.putExtra("eventID", eventID);
                eventIntent.putExtra("eventType", eventType);
                startActivity(eventIntent);
                finish();
            }
        }
    });
    for (Venue venue : venueVoteList) {
        mSwipeView.addView(new VenueCardView(mContext, venue, mSwipeView, eventID));
    }
    findViewById(R.id.rejectBtn).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mSwipeView.doSwipe(false);
        }
    });
    findViewById(R.id.acceptBtn).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mSwipeView.doSwipe(true);
        }
    });
}
Also used : SwipeDecor(com.mindorks.placeholderview.SwipeDecor) EventGuest(com.example.c4q.capstone.database.events.EventGuest) Venue(com.example.c4q.capstone.database.events.Venue) Intent(android.content.Intent) SwipePlaceHolderView(com.mindorks.placeholderview.SwipePlaceHolderView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ItemRemovedListener(com.mindorks.placeholderview.listeners.ItemRemovedListener)

Example 2 with SwipeDecor

use of com.mindorks.placeholderview.SwipeDecor in project android-mvvm-architecture by MindorksOpenSource.

the class MainActivity method setupCardContainerView.

private void setupCardContainerView() {
    int screenWidth = ScreenUtils.getScreenWidth(this);
    int screenHeight = ScreenUtils.getScreenHeight(this);
    mCardsContainerView.getBuilder().setDisplayViewCount(3).setHeightSwipeDistFactor(10).setWidthSwipeDistFactor(5).setSwipeDecor(new SwipeDecor().setViewWidth((int) (0.90 * screenWidth)).setViewHeight((int) (0.75 * screenHeight)).setPaddingTop(20).setSwipeRotationAngle(10).setRelativeScale(0.01f));
    mCardsContainerView.addItemRemoveListener(count -> {
        if (count == 0) {
            // reload the contents again after 1 sec delay
            new Handler(getMainLooper()).postDelayed(() -> {
                // Reload once all the cards are removed
                mMainViewModel.loadQuestionCards();
            }, 800);
        } else {
            mMainViewModel.removeQuestionCard();
        }
    });
}
Also used : SwipeDecor(com.mindorks.placeholderview.SwipeDecor) Handler(android.os.Handler)

Example 3 with SwipeDecor

use of com.mindorks.placeholderview.SwipeDecor in project android-mvp-architecture by MindorksOpenSource.

the class MainActivity method setupCardContainerView.

private void setupCardContainerView() {
    int screenWidth = ScreenUtils.getScreenWidth(this);
    int screenHeight = ScreenUtils.getScreenHeight(this);
    mCardsContainerView.getBuilder().setDisplayViewCount(3).setHeightSwipeDistFactor(10).setWidthSwipeDistFactor(5).setSwipeDecor(new SwipeDecor().setViewWidth((int) (0.90 * screenWidth)).setViewHeight((int) (0.75 * screenHeight)).setPaddingTop(20).setSwipeRotationAngle(10).setRelativeScale(0.01f));
    mCardsContainerView.addItemRemoveListener(new ItemRemovedListener() {

        @Override
        public void onItemRemoved(int count) {
            if (count == 0) {
                // reload the contents again after 1 sec delay
                new Handler(getMainLooper()).postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        mPresenter.onCardExhausted();
                    }
                }, 800);
            }
        }
    });
}
Also used : SwipeDecor(com.mindorks.placeholderview.SwipeDecor) Handler(android.os.Handler) ItemRemovedListener(com.mindorks.placeholderview.listeners.ItemRemovedListener)

Aggregations

SwipeDecor (com.mindorks.placeholderview.SwipeDecor)3 Handler (android.os.Handler)2 ItemRemovedListener (com.mindorks.placeholderview.listeners.ItemRemovedListener)2 Intent (android.content.Intent)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 EventGuest (com.example.c4q.capstone.database.events.EventGuest)1 Venue (com.example.c4q.capstone.database.events.Venue)1 SwipePlaceHolderView (com.mindorks.placeholderview.SwipePlaceHolderView)1