package com.chad.baserecyclerviewadapterhelper.data; import com.chad.baserecyclerviewadapterhelper.entity.MultipleItem; import com.chad.baserecyclerviewadapterhelper.entity.MySection; import com.chad.baserecyclerviewadapterhelper.entity.Status; import com.chad.baserecyclerviewadapterhelper.entity.Video; import java.util.ArrayList; import java.util.List; /** * https://github.com/CymChad/BaseRecyclerViewAdapterHelper */ public class DataServer { private static final String HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK = "https://avatars1.githubusercontent.com/u/7698209?v=3&s=460"; private static final String CYM_CHAD = "CymChad"; private DataServer() { } public static List<Status> getSampleData(int lenth) { List<Status> list = new ArrayList<>(); for (int i = 0; i < lenth; i++) { Status status = new Status(); status.setUserName("Chad" + i); status.setCreatedAt("04/05/" + i); status.setRetweet(i % 2 == 0); status.setUserAvatar("https://avatars1.githubusercontent.com/u/7698209?v=3&s=460"); status.setText("BaseRecyclerViewAdpaterHelper https://www.recyclerview.org"); list.add(status); } return list; } public static List<Status> addData(List list, int dataSize) { for (int i = 0; i < dataSize; i++) { Status status = new Status(); status.setUserName("Chad" + i); status.setCreatedAt("04/05/" + i); status.setRetweet(i % 2 == 0); status.setUserAvatar("https://avatars1.githubusercontent.com/u/7698209?v=3&s=460"); status.setText("Powerful and flexible RecyclerAdapter https://github.com/CymChad/BaseRecyclerViewAdapterHelper"); list.add(status); } return list; } public static List<MySection> getSampleData() { List<MySection> list = new ArrayList<>(); list.add(new MySection(true, "Section 1", true)); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(true, "Section 2", false)); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(true, "Section 3", false)); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(true, "Section 4", false)); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(true, "Section 5", false)); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); list.add(new MySection(new Video(HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK, CYM_CHAD))); return list; } public static List<String> getStrData() { List<String> list = new ArrayList<>(); for (int i = 0; i < 20; i++) { String str = HTTPS_AVATARS1_GITHUBUSERCONTENT_COM_LINK; if (i % 2 == 0) { str = CYM_CHAD; } list.add(str); } return list; } public static List<MultipleItem> getMultipleItemData() { List<MultipleItem> list = new ArrayList<>(); for (int i = 0; i <= 4; i++) { list.add(new MultipleItem(MultipleItem.IMG, MultipleItem.IMG_SPAN_SIZE)); list.add(new MultipleItem(MultipleItem.TEXT, MultipleItem.TEXT_SPAN_SIZE, CYM_CHAD)); list.add(new MultipleItem(MultipleItem.IMG_TEXT, MultipleItem.IMG_TEXT_SPAN_SIZE)); list.add(new MultipleItem(MultipleItem.IMG_TEXT, MultipleItem.IMG_TEXT_SPAN_SIZE_MIN)); list.add(new MultipleItem(MultipleItem.IMG_TEXT, MultipleItem.IMG_TEXT_SPAN_SIZE_MIN)); } return list; } // public static List<MultipleItem> getMultipleChildView() { // List<MultipleItem> list = new ArrayList<>(); // for (int i = 0; i <= 4; i++) { // list.add(new ClickEntity(ClickEntity.CLICK_ITEM_VIEW, MultipleItem.TEXT_SPAN_SIZE, CYM_CHAD)); // list.add(new MultipleItem(MultipleItem.IMG, MultipleItem.BIG_IMG_SPAN_SIZE)); // list.add(new MultipleItem(MultipleItem.IMG, MultipleItem.IMG_SPAN_SIZE)); // list.add(new MultipleItem(MultipleItem.IMG, MultipleItem.IMG_SPAN_SIZE)); // list.add(new MultipleItem(MultipleItem.IMG, MultipleItem.IMG_SPAN_SIZE)); // } // // return list; // } }