当前位置: 首页>>代码示例>>Java>>正文


Java方法com.andtinder.model.CardModel.setOnCardDimissedListener代码示例

以下是Java方法com.andtinder.model.CardModel.setOnCardDimissedListener的代码示例。如果您正苦于以下问题:Java CardModel.setOnCardDimissedListener方法的具体用法?Java CardModel.setOnCardDimissedListener怎么用?Java CardModel.setOnCardDimissedListener使用的例子?那么恭喜您, 这里整理的方法代码示例例程将为您提供帮助。您也可以进一步了解该方法所在com.andtinder.model.CardModel的用法示例。

本文一共展示了CardModel.setOnCardDimissedListener的4个开源代码实例,这些例子默认根据受欢迎程度排序。您可以为喜欢的代码打CALL点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addCardFromFav

import com.andtinder.model.CardModel; //导入方法依赖的package包/类
/**
     * Add cards from queue to adapterMain
     * Used when changing from favourites to main
     */
    private void addCardFromFav(Iterator<CardModel> itr) {
        CardModel cardModel = itr.next();
        cardModel.setFavorite(false);
        if (favouritesList.size() > 0) {
            Iterator<CardModel> iter = favouritesList.iterator();
            do {
                CardModel cm = iter.next();
                if (cm.getId().equals(cardModel.getId())) {
                    cardModel.setFavorite(true);
                    break;
                }
            } while (iter.hasNext());
        }
        cardModel.setOnCardDimissedListener(new CardModel.OnCardDimissedListener() {
            @Override
            public void onLike() {
//                Log.i("Swipeable Cards", "I like the card");
                mainCardRemoval();
                ensureFull();
            }

            @Override
            public void onDislike() {
//                Log.i("Swipeable Cards", "I dislike the card");
                mainCardRemoval();
                ensureFull();
            }
        });
//        cardModel.setOnClickListener(new CardModel.OnClickListener() {
//            @Override
//            public void OnClickListener() {
//                Log.i("Swipeable Cards", "I am pressing the card");
//            }
//        });
        adapterMain.addInitial(cardModel);
    }
 
开发者ID:KonradJanica,项目:aMatch,完整代码来源:MainActivity.java


示例2: addCardFavorites

import com.andtinder.model.CardModel; //导入方法依赖的package包/类
/**
     * Add card to adapterMain and add it's listener for adding more cards
     */
    private void addCardFavorites(CardModel cardModel, boolean isInitial) {
        cardModel.setOnCardDimissedListener(new CardModel.OnCardDimissedListener() {
            @Override
            public void onLike() {
//                Log.i("Swipeable Cards", "I like the card");
                --cardCountFavorite;
                ++indexFavorite;
                ensureFavoritesFull(false);
            }

            @Override
            public void onDislike() {
//                Log.i("Swipeable Cards", "I dislike the card");
                --cardCountFavorite;
                ++indexFavorite;
                ensureFavoritesFull(false);
            }
        });
//        cardModel.setOnClickListener(new CardModel.OnClickListener() {
//            @Override
//            public void OnClickListener() {
//                Log.i("Swipeable Cards", "I am pressing the card");
//            }
//        });
        if (isInitial) {
            adapterFavorites.addInitial(cardModel);
        } else {
            adapterFavorites.add(cardModel);
        }
        ++cardCountFavorite;
    }
 
开发者ID:KonradJanica,项目:aMatch,完整代码来源:MainActivity.java


示例3: onCreate

import com.andtinder.model.CardModel; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo_swipe);

    Resources r = getResources();

    mCardContainer = (CardContainer) findViewById(R.id.swipeview);
    mCardContainer.setOrientation(Orientations.Orientation.Disordered);

    SimpleCardStackAdapter adapter = new SimpleCardStackAdapter(this);

    int[] imgIds = {R.drawable.lolcat1,R.drawable.loldog1,R.drawable.lolcat2,R.drawable.loldog2,R.drawable.lolcat3,R.drawable.loldog3};

    for (int i = 0; i < 20; i++) {
        final int imgIdx = imgIds[(int)(Math.random()*((float)imgIds.length))];
        CardModel card = new CardModel("Option " + (i+1), "Swipe left to like, right to not", r.getDrawable(imgIdx));
        card.setOnCardDimissedListener(new CardModel.OnCardDimissedListener() {
            @Override
            public void onLike() {

                //this is the total like counter for our privacy-enhanced "randomized response" tracking later in onPause()
                mLikeCount++;

                //this is typical event tracked, but shared with the server in a secure, non-unique identified manner
                MeasureHelper.track()
                        .screen("/vote/cat/like/" + imgIdx)
                        .title("Vote")
                        .variable(1, "option", imgIdx + "")
                        .with(getMeasurer());
            }

            @Override
            public void onDislike() {

                //this is typical event tracked, but shared with the server in a secure, non-unique identified manner
                MeasureHelper.track()
                        .screen("/vote/cat/dislike" + imgIdx)
                        .title("Vote")
                        .variable(1, "option", imgIdx + "")
                        .with(getMeasurer());
            }
        });

        adapter.add(card);
    }

    mCardContainer.setAdapter(adapter);

    mLikeCount = 0;

    new ConsentUI().showConsentDialog(this);


}
 
开发者ID:cleaninsights,项目:cleaninsights-android-sdk,完整代码来源:DemoActivity.java


示例4: addCard

import com.andtinder.model.CardModel; //导入方法依赖的package包/类
/**
     * Add card to adapterMain and add it's listener for adding more cards
     */
    private void addCard(Iterator<Question> itr, boolean isInitial) {
        Question q = itr.next();
        CardModel cardModel = new CardModel(q.company, q.questionText, q.companyImgURL,
                q.pageNumber, q.dateText + q.location,
                q.id, q.questionTextLineCount);
        if (favouritesList.size() > 0) {
            Iterator<CardModel> iter = favouritesList.iterator();
            do {
                CardModel cm = iter.next();
                if (cm.getId().equals(cardModel.getId())) {
                    cardModel.setFavorite(true);
                    break;
                }
            } while (iter.hasNext());
        }
        cardModel.setOnCardDimissedListener(new CardModel.OnCardDimissedListener() {
            @Override
            public void onLike() {
//                Log.i("Swipeable Cards", "I like the card");
                mainCardRemoval();
                ensureFull();
            }

            @Override
            public void onDislike() {
//                Log.i("Swipeable Cards", "I dislike the card");
                mainCardRemoval();
                ensureFull();
            }
        });
//        cardModel.setOnClickListener(new CardModel.OnClickListener() {
//            @Override
//            public void OnClickListener() {
//                Log.i("Swipeable Cards", "I am pressing the card");
//            }
//        });
        if (isInitial) {
            adapterMain.addInitial(cardModel);
        } else {
            adapterMain.add(cardModel);
        }
        ++cardCountMain;
        itr.remove();
        questionsCardQueue.add(cardModel);
    }
 
开发者ID:KonradJanica,项目:aMatch,完整代码来源:MainActivity.java



注:本文示例均筛选自Github平台上各路大神开发的开源项目,代码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。