當前位置: 首頁>>代碼示例>>Java>>正文


Java Section類代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:aumarbello,項目名稱:Tasks,代碼行數:21,代碼來源:TaskListFragment.java

示例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);
    }
}
 
開發者ID:aumarbello,項目名稱:Tasks,代碼行數:19,代碼來源:TaskListFragment.java

示例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);
    }
}
 
開發者ID:moneymanagerex,項目名稱:android-money-manager-ex,代碼行數:19,代碼來源:CurrencyRecyclerListFragment.java

示例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);
        }
    }
}
 
開發者ID:aumarbello,項目名稱:Tasks,代碼行數:15,代碼來源:TaskListFragment.java

示例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;
}
 
開發者ID:luizgrp,項目名稱:SectionedRecyclerViewAdapter,代碼行數:14,代碼來源:Example7Fragment.java

示例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);
}
 
開發者ID:luizgrp,項目名稱:SectionedRecyclerViewAdapter,代碼行數:43,代碼來源:Example3Fragment.java


注:本文中的io.github.luizgrp.sectionedrecyclerviewadapter.Section類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。