本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
}));
}
示例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()));
}