Search in sources :

Example 1 with Ad

use of com.jude.dome.entites.Ad in project EasyRecyclerView by Jude95.

the class DataProvider method getAdList.

public static List<Ad> getAdList() {
    ArrayList<Ad> arr = new ArrayList<>();
    arr.add(new Ad("http://i2.hdslb.com/u_user/e97a1632329cac1fa6ab3362e7233a08.jpg", "http://www.bilibili.com/topic/v2/1004.html"));
    arr.add(new Ad("http://i1.hdslb.com/u_user/80fcc32d0b5d3565377847bd9dd06dc3.jpg", "http://www.bilibili.com/topic/1003.html"));
    arr.add(new Ad("http://i2.hdslb.com/u_user/f19f0e44328a4190a48acf503c737c50.png", "http://yoo.bilibili.com/html/activity/cq2015/index.html"));
    arr.add(new Ad("http://i1.hdslb.com/u_user/7ee1aeadc8257f43fa6b806717c9c398.png", "http://www.bilibili.com/html/activity-acsociety.html"));
    return arr;
}
Also used : Ad(com.jude.dome.entites.Ad) ArrayList(java.util.ArrayList)

Example 2 with Ad

use of com.jude.dome.entites.Ad in project EasyRecyclerView by Jude95.

the class DataProvider method getPersonWithAds.

public static List<Object> getPersonWithAds(int page) {
    ArrayList<Object> arrAll = new ArrayList<>();
    List<Ad> arrAd = getAdList();
    int index = 0;
    for (Person person : getPersonList(page)) {
        arrAll.add(person);
        // 按比例混合广告
        if (Math.random() < 0.2) {
            arrAll.add(arrAd.get(index % arrAd.size()));
            index++;
        }
    }
    return arrAll;
}
Also used : Ad(com.jude.dome.entites.Ad) ArrayList(java.util.ArrayList) Person(com.jude.dome.entites.Person)

Aggregations

Ad (com.jude.dome.entites.Ad)2 ArrayList (java.util.ArrayList)2 Person (com.jude.dome.entites.Person)1