本文整理匯總了Java中io.github.luizgrp.sectionedrecyclerviewadapter.Section類的典型用法代碼示例。如果您正苦於以下問題:Java Section類的具體用法?Java Section怎麽用?Java Section使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Section類屬於io.github.luizgrp.sectionedrecyclerviewadapter包,在下文中一共展示了Section類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateAfterAdding
import io.github.luizgrp.sectionedrecyclerviewadapter.Section; //導入依賴的package包/類
public void updateAfterAdding(Task task){
String sectionTag = getTaskSectionTag(task);
TaskSection currentSection = (TaskSection) adapter.getSection(sectionTag);
currentSection.addTaskToList(task);
taskList.add(task);
Log.d(TAG, "Current Section is - " + currentSection.getSectionTitle());
int items = currentSection.getContentItemsTotal();
int pos = adapter.getPositionInAdapter(currentSection, 0);
int post = adapter.getItemCount();
if (currentSection.getState().equals(Section.State.EMPTY)){
currentSection.setState(Section.State.LOADED);
adapter.notifyItemInsertedInSection(currentSection,
post);
}else {
adapter.notifyItemInsertedInSection(currentSection,
items);
}
}
示例2: updateAfterDelete
import io.github.luizgrp.sectionedrecyclerviewadapter.Section; //導入依賴的package包/類
@Override
public void updateAfterDelete(Task task) {
if (editDialog != null){
editDialog.dismiss();
}
String sectionTag = getTaskSectionTag(task);
taskList.remove(task);
TaskSection currentSection = (TaskSection) adapter.getSection(sectionTag);
currentSection.removeFromList(task);
adapter.notifyItemRemovedFromSection(currentSection,
position);
if (currentSection.isSectionEmpty()){
currentSection.setState(Section.State.EMPTY);
}
}
示例3: onEvent
import io.github.luizgrp.sectionedrecyclerviewadapter.Section; //導入依賴的package包/類
@Subscribe
public void onEvent(CurrencyDeletionConfirmedEvent event) {
CurrencyRepository repo = new CurrencyRepository(getContext());
boolean success = repo.delete(event.currencyId);
if (success) {
Toast.makeText(getContext(), R.string.delete_success, Toast.LENGTH_SHORT).show();
// remove from data.
LinkedHashMap<String, Section> sectionMap = getAdapter().getSectionsMap();
for(Section section : sectionMap.values()){
CurrencySection currencySection = (CurrencySection) section;
currencySection.currencies.remove(event.itemPosition);
}
// update ui.
getAdapter().notifyItemRemoved(event.itemPosition);
}
}
示例4: createSections
import io.github.luizgrp.sectionedrecyclerviewadapter.Section; //導入依賴的package包/類
private void createSections(){
for (String segment : dayString) {
List<Task> taskList = getDayTask(segment);
if (taskList.size() != 0){
adapter.addSection(segment, new TaskSection(segment, taskList, this,
preferences));
}else {
TaskSection section = new TaskSection(segment, taskList, this,
preferences);
section.setState(Section.State.EMPTY);
adapter.addSection(segment, section);
}
}
}
示例5: onQueryTextChange
import io.github.luizgrp.sectionedrecyclerviewadapter.Section; //導入依賴的package包/類
@Override
public boolean onQueryTextChange(String query) {
// getSectionsMap requires library version 1.0.4+
for (Section section : sectionAdapter.getSectionsMap().values()) {
if (section instanceof FilterableSection) {
((FilterableSection)section).filter(query);
}
}
sectionAdapter.notifyDataSetChanged();
return true;
}
示例6: loadNews
import io.github.luizgrp.sectionedrecyclerviewadapter.Section; //導入依賴的package包/類
private void loadNews(final NewsSection section) {
int timeInMills = new Random().nextInt((7000 - 3000) + 1) + 3000;
section.setState(Section.State.LOADING);
section.setHasFooter(false);
sectionAdapter.notifyDataSetChanged();
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
int failed = new Random().nextInt((3 - 1) + 1) + 1;
if (failed == 1) {
section.setState(Section.State.FAILED);
}
else {
int arrayResource;
switch (section.getTopic()) {
case NewsSection.WORLD:
arrayResource = R.array.news_world;
break;
case NewsSection.BUSINESS:
arrayResource = R.array.news_biz;
break;
case NewsSection.TECHNOLOGY:
arrayResource = R.array.news_tech;
break;
case NewsSection.SPORTS:
arrayResource = R.array.news_sports;
break;
default:
throw new IllegalStateException("Invalid topic");
}
section.setList(getNews(arrayResource));
section.setState(Section.State.LOADED);
section.setHasFooter(true);
}
sectionAdapter.notifyDataSetChanged();
}
}, timeInMills);
}