Skip to content

Instantly share code, notes, and snippets.

Created September 23, 2015 06:23
Show Gist options
  • Save anonymous/2f6c4e4bde3cb4e16dab to your computer and use it in GitHub Desktop.
Save anonymous/2f6c4e4bde3cb4e16dab to your computer and use it in GitHub Desktop.
/**
* Created by : pratama - set.mnemonix@gmail.com
* Date : 9/23/15
* Project : SimpleSectionRecyclerView
*/
public class MainActivityPresenter {
private Context context;
private MainActivityInterfaces view;
private List<SectionModel> listSection;
public MainActivityPresenter(Context context, MainActivityInterfaces view) {
this.context = context;
this.view = view;
}
public void loadData() {
view.showLoading();
listSection = new ArrayList<>();
SectionModel sectionModel = new SectionModel();
sectionModel.setText("Section 1");
List<ItemModel> item1 = new ArrayList<>();
item1.add(new ItemModel("item 1"));
item1.add(new ItemModel("item 2"));
item1.add(new ItemModel("item 3"));
item1.add(new ItemModel("item 4"));
sectionModel.setListItem(item1);
SectionModel sectionModel2 = new SectionModel();
sectionModel2.setText("Section 2");
List<ItemModel> item2 = new ArrayList<>();
item2.add(new ItemModel("item 1"));
item2.add(new ItemModel("item 2"));
item2.add(new ItemModel("item 3"));
item2.add(new ItemModel("item 4"));
sectionModel2.setListItem(item2);
listSection.add(sectionModel);
listSection.add(sectionModel2);
view.showData(listSection);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment