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


Java SectionedRecyclerViewAdapter类代码示例

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


SectionedRecyclerViewAdapter类属于io.github.luizgrp.sectionedrecyclerviewadapter包,在下文中一共展示了SectionedRecyclerViewAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onCreate

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstance){
    super.onCreate(savedInstance);
    setHasOptionsMenu(true);
    setRetainInstance(true);
    ((App)getActivity().getApplication()).getComponent().inject(this);
    adapter = new SectionedRecyclerViewAdapter();
    task = new Task();

    taskList = calenderPresenter.getNormalTasks();
    Log.d(TAG, "Reading from database");

    int numberOfDaysPref = preferences.getDaysSection();

    todayCalender = Calendar.getInstance();
    taskCalender = Calendar.getInstance();

    int currentDay = todayCalender.get(Calendar.DAY_OF_WEEK);
    switch (numberOfDaysPref){
        case 0:
            daysSectionValue = 3;
            break;
        case 1:
            daysSectionValue = 5;
            break;
        case 2:
            daysSectionValue = 7;
            break;
    }
    getTaskList = new GetTaskList(numberOfDaysPref, taskList);
    populateDayStrings();
}
 
开发者ID:aumarbello,项目名称:Tasks,代码行数:33,代码来源:TaskListFragment.java

示例10: HeaderRecyclerViewSection

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入依赖的package包/类
HeaderRecyclerViewSection(Activity activity, String title, String[] mUrls, SectionedRecyclerViewAdapter sectionedRecyclerViewAdapter, int gridNumber) {
    super(R.layout.header_layout, R.layout.media_item);

    this.title = title;
    this.mUrls = mUrls;
    this.activity = activity;
    this.sectionedRecyclerViewAdapter = sectionedRecyclerViewAdapter;
    this.gridNumber = gridNumber;
}
 
开发者ID:enricocid,项目名称:Gallery-example,代码行数:10,代码来源:HeaderRecyclerViewSection.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_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

示例12: 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

示例13: 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

示例14: initializeList

import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter; //导入依赖的package包/类
private void initializeList() {
    Context context = getActivity();

    RecyclerView recyclerView = getRecyclerView();
    if (recyclerView == null) return;

    // Layout manager
    recyclerView.setLayoutManager(new LinearLayoutManager(context));

    // Adapter
    final SectionedRecyclerViewAdapter adapter = new SectionedRecyclerViewAdapter();
    // load data
    loadData(adapter);

    recyclerView.setAdapter(adapter);

    // Separator
    recyclerView.addItemDecoration(new DividerItemDecoration(context, LinearLayoutManager.VERTICAL));

    // Behaviours. List click listener.
    recyclerView.addOnItemTouchListener(new RecyclerItemClickListener(getContext(), new RecyclerItemClickListener.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            Currency currency = getCurrencyAtPosition(position);
            int id = currency.getCurrencyId();
            String name = currency.getName();
            EventBus.getDefault().post(new ListItemClickedEvent(id, name, view));
        }
    }));
}
 
开发者ID:moneymanagerex,项目名称:android-money-manager-ex,代码行数:31,代码来源:CurrencyRecyclerListFragment.java

示例15: 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


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