当前位置: 首页>>代码示例>>Java>>正文


Java SectionedRecyclerViewAdapter.addSection方法代码示例

本文整理汇总了Java中io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter.addSection方法的典型用法代码示例。如果您正苦于以下问题:Java SectionedRecyclerViewAdapter.addSection方法的具体用法?Java SectionedRecyclerViewAdapter.addSection怎么用?Java SectionedRecyclerViewAdapter.addSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter的用法示例。


在下文中一共展示了SectionedRecyclerViewAdapter.addSection方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_pager_schedules, container, false);
    if (day.getSchedules().isEmpty()) return view;

    SectionedRecyclerViewAdapter sectionAdapter = new SectionedRecyclerViewAdapter();

    for (Map.Entry<String, List<Class>> entry : day.getSchedules().entrySet())
        sectionAdapter.addSection(new ClassSection(entry.getKey(), new ArrayList<>(entry.getValue())));

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(sectionAdapter);

    return view;
}
 
开发者ID:linklux,项目名称:android-schedules,代码行数:17,代码来源:DayViewPagerFragment.java

示例2: onCreateView

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_session, container, false);

    sectionAdapter = new SectionedRecyclerViewAdapter();


    for(char alphabet = 'A'; alphabet <= 'Z';alphabet++) {
        List<String> contacts = getContactsWithLetter(alphabet);

        if (contacts.size() > 0) {
            sectionAdapter.addSection(new ContactsSection(String.valueOf(alphabet), contacts));
        }
    }

    //RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
    //recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    //recyclerView.setAdapter(sectionAdapter);

    return view;
}
 
开发者ID:fllodrab,项目名称:MeasureAppS,代码行数:23,代码来源:Session.java

示例3: showSessionLastSession

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
private void showSessionLastSession(Intent intent) throws JSONException {
    JSONObject jsonNotes = new JSONObject(intent.getStringExtra("notes"));

    // Create an instance of SectionedRecyclerViewAdapter
    SectionedRecyclerViewAdapter sectionAdapter = new SectionedRecyclerViewAdapter();

    //EXAMPLE
    List<String> messages = Arrays.asList(jsonNotes.getString("rankingTitle"), jsonNotes.getString("app1"), jsonNotes.getString("app2"), jsonNotes.getString("app3"), jsonNotes.getString("app4"));

    // Create your sections with the list of data you got from your API
    MySection data1Section = new MySection("Última Comparación", messages);

    // Add your Sections
    sectionAdapter.addSection(data1Section);

    // Set up your RecyclerView with the SectionedRecyclerViewAdapter
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.sessionList);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(sectionAdapter);
}
 
开发者ID:fllodrab,项目名称:MeasureAppS,代码行数:21,代码来源:MainActivity.java

示例4: onCreateView

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_ex2, container, false);

    sectionAdapter = new SectionedRecyclerViewAdapter();

    sectionAdapter.addSection(new NewsSection(NewsSection.WORLD));
    sectionAdapter.addSection(new NewsSection(NewsSection.BUSINESS));
    sectionAdapter.addSection(new NewsSection(NewsSection.TECHNOLOGY));
    sectionAdapter.addSection(new NewsSection(NewsSection.SPORTS));

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(sectionAdapter);

    return view;
}
 
开发者ID:luizgrp,项目名称:SectionedRecyclerViewAdapter,代码行数:19,代码来源:Example2Fragment.java

示例5: onCreateView

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_ex7, container, false);

    sectionAdapter = new SectionedRecyclerViewAdapter();

    for(char alphabet = 'A'; alphabet <= 'Z';alphabet++) {
        List<String> contacts = getContactsWithLetter(alphabet);

        if (contacts.size() > 0) {
            ContactsSection contactsSection = new ContactsSection(String.valueOf(alphabet), contacts);
            sectionAdapter.addSection(contactsSection);
        }
    }

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(sectionAdapter);

    return view;
}
 
开发者ID:luizgrp,项目名称:SectionedRecyclerViewAdapter,代码行数:23,代码来源:Example7Fragment.java

示例6: onCreateView

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_ex1, container, false);

    sectionAdapter = new SectionedRecyclerViewAdapter();


    for(char alphabet = 'A'; alphabet <= 'Z';alphabet++) {
        List<String> contacts = getContactsWithLetter(alphabet);

        if (contacts.size() > 0) {
            sectionAdapter.addSection(new ContactsSection(String.valueOf(alphabet), contacts));
        }
    }

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(sectionAdapter);

    return view;
}
 
开发者ID:luizgrp,项目名称:SectionedRecyclerViewAdapter,代码行数:23,代码来源:Example1Fragment.java

示例7: onCreateView

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_ex4, container, false);

    sectionAdapter = new SectionedRecyclerViewAdapter();


    for(char alphabet = 'A'; alphabet <= 'Z';alphabet++) {
        List<String> contacts = getContactsWithLetter(alphabet);

        if (contacts.size() > 0) {
            sectionAdapter.addSection(new ExpandableContactsSection(String.valueOf(alphabet), contacts));
        }
    }

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(sectionAdapter);

    return view;
}
 
开发者ID:luizgrp,项目名称:SectionedRecyclerViewAdapter,代码行数:23,代码来源:Example4Fragment.java

示例8: onCreateView

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_pager_schedules, container, false);
    if (mClasses.isEmpty()) return view;

    SectionedRecyclerViewAdapter sectionAdapter = new SectionedRecyclerViewAdapter();
    List<Class> classes = new ArrayList<>();

    Date dateLimit = DateUtil.getWeekStart(mClasses.get(0).getTimeStart(), displayWeeks);
    String curDay = DateUtil.getScheduleDay(mClasses.get(0).getTimeStart());

    int i = 0;
    while (i < mClasses.size() - 1 && mClasses.get(i).getTimeStart().before(dateLimit)) {
        Class cls = mClasses.get(i);
        String day = DateUtil.getScheduleDay(cls.getTimeStart());

        if (!day.equals(curDay)) {
            sectionAdapter.addSection(new ClassSection(curDay, new ArrayList<>(classes)));
            classes.clear();

            curDay = day;
        }

        classes.add(cls);
        i++;
    }

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(sectionAdapter);

    return view;
}
 
开发者ID:linklux,项目名称:android-schedules,代码行数:34,代码来源:ScheduleViewPagerFragment.java

示例9: onCreateView

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_ex3, container, false);

    sectionAdapter = new SectionedRecyclerViewAdapter();

    NewsSection worldNews = new NewsSection(NewsSection.WORLD);
    NewsSection bizNews = new NewsSection(NewsSection.BUSINESS);
    NewsSection techNews = new NewsSection(NewsSection.TECHNOLOGY);
    NewsSection sportsNews = new NewsSection(NewsSection.SPORTS);

    sectionAdapter.addSection(worldNews);
    sectionAdapter.addSection(bizNews);
    sectionAdapter.addSection(techNews);
    sectionAdapter.addSection(sportsNews);

    loadNews(worldNews);
    loadNews(bizNews);
    loadNews(techNews);
    loadNews(sportsNews);

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(sectionAdapter);

    return view;
}
 
开发者ID:luizgrp,项目名称:SectionedRecyclerViewAdapter,代码行数:29,代码来源:Example3Fragment.java

示例10: onCreateView

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_ex6, container, false);

    sectionAdapter = new SectionedRecyclerViewAdapter();

    sectionAdapter.addSection(new ExpandableMovieSection(getString(R.string.top_rated_movies_topic), getTopRatedMoviesList()));
    sectionAdapter.addSection(new ExpandableMovieSection(getString(R.string.most_popular_movies_topic), getMostPopularMoviesList()));

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);

    GridLayoutManager glm = new GridLayoutManager(getContext(), 2);
    glm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            switch(sectionAdapter.getSectionItemViewType(position)) {
                case SectionedRecyclerViewAdapter.VIEW_TYPE_HEADER:
                    return 2;
                default:
                    return 1;
            }
        }
    });
    recyclerView.setLayoutManager(glm);
    recyclerView.setAdapter(sectionAdapter);

    return view;
}
 
开发者ID:luizgrp,项目名称:SectionedRecyclerViewAdapter,代码行数:30,代码来源:Example6Fragment.java

示例11: onCreateView

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_ex5, container, false);

    sectionAdapter = new SectionedRecyclerViewAdapter();

    sectionAdapter.addSection(new MovieSection(getString(R.string.top_rated_movies_topic), getTopRatedMoviesList()));
    sectionAdapter.addSection(new MovieSection(getString(R.string.most_popular_movies_topic), getMostPopularMoviesList()));

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);

    GridLayoutManager glm = new GridLayoutManager(getContext(), 2);
    glm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            switch(sectionAdapter.getSectionItemViewType(position)) {
                case SectionedRecyclerViewAdapter.VIEW_TYPE_HEADER:
                    return 2;
                default:
                    return 1;
            }
        }
    });
    recyclerView.setLayoutManager(glm);
    recyclerView.setAdapter(sectionAdapter);

    return view;
}
 
开发者ID:luizgrp,项目名称:SectionedRecyclerViewAdapter,代码行数:30,代码来源:Example5Fragment.java

示例12: loadData

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
private void loadData(SectionedRecyclerViewAdapter adapter) {
        CurrencyService service = new CurrencyService(getActivity());

        adapter.removeAllSections();

//        List<Currency> currencies = new ArrayList<>();
        //for (Currency currency : service.getUsedCurrencies()) currencies.put(currency.getCode(), currency);
        adapter.addSection(new CurrencySection(getString(R.string.active_currencies), service.getUsedCurrencies()));

//        currencies = new ArrayList<>();
//        for (Currency currency : service.getUnusedCurrencies()) currencies.put(currency.getCode(), currency);
        adapter.addSection(new CurrencySection(getString(R.string.inactive_currencies), service.getUnusedCurrencies()));

    }
 
开发者ID:moneymanagerex,项目名称:android-money-manager-ex,代码行数:15,代码来源:CurrencyRecyclerListFragment.java

示例13: setupAlbums

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入方法依赖的package包/类
static void setupAlbums(final Activity activity, String[] veryPaths, RecyclerView recyclerView, final SectionedRecyclerViewAdapter sectionedRecyclerViewAdapter) {

        for (String path : veryPaths) {

            String[] mediaUrls = MediaFromAlbums.listMedia(path);

            if (mediaUrls.length != 0) {

                final int gridNumber = Preferences.resolveGrid(activity);

                GridLayoutManager glm = new GridLayoutManager(activity, gridNumber);
                glm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
                    @Override
                    public int getSpanSize(int position) {
                        switch (sectionedRecyclerViewAdapter.getSectionItemViewType(position)) {
                            case SectionedRecyclerViewAdapter.VIEW_TYPE_HEADER:
                                return gridNumber;
                            default:
                                return 1;
                        }
                    }
                });

                recyclerView.setLayoutManager(glm);

                HeaderRecyclerViewSection headerRecyclerViewSection = new HeaderRecyclerViewSection(activity, path, mediaUrls, sectionedRecyclerViewAdapter, gridNumber);

                sectionedRecyclerViewAdapter.addSection(headerRecyclerViewSection);

            }

        }

    }
 
开发者ID:enricocid,项目名称:Gallery-example,代码行数:35,代码来源:AlbumsUtils.java


注:本文中的io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter.addSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。