use of me.yokeyword.sample.demo_flow.adapter.PagerAdapter in project Fragmentation by YoKeyword.
the class RecyclerSwipeBackFragment method initView.
private void initView(View view) {
mRecy = (RecyclerView) view.findViewById(R.id.recy);
mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
_initToolbar(mToolbar);
mAdapter = new PagerAdapter(_mActivity);
LinearLayoutManager manager = new LinearLayoutManager(_mActivity);
mRecy.setLayoutManager(manager);
mRecy.setAdapter(mAdapter);
mAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(int position, View view) {
start(FirstSwipeBackFragment.newInstance());
}
});
// Init Datas
List<String> items = new ArrayList<>();
for (int i = 0; i < 20; i++) {
String item;
item = getString(R.string.favorite) + " " + i;
items.add(item);
}
mAdapter.setDatas(items);
}
use of me.yokeyword.sample.demo_flow.adapter.PagerAdapter in project Fragmentation by YoKeyword.
the class PagerChildFragment method initView.
private void initView(View view) {
mRecy = (RecyclerView) view.findViewById(R.id.recy);
mAdapter = new PagerAdapter(_mActivity);
LinearLayoutManager manager = new LinearLayoutManager(_mActivity);
mRecy.setLayoutManager(manager);
mRecy.setAdapter(mAdapter);
mAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(int position, View view) {
if (getParentFragment() instanceof DiscoverFragment) {
((DiscoverFragment) getParentFragment()).start(CycleFragment.newInstance(1));
}
}
});
mRecy.post(new Runnable() {
@Override
public void run() {
// Init Datas
List<String> items = new ArrayList<>();
for (int i = 0; i < 20; i++) {
String item;
if (mFrom == 0) {
item = getString(R.string.recommend) + " " + i;
} else if (mFrom == 1) {
item = getString(R.string.hot) + " " + i;
} else {
item = getString(R.string.favorite) + " " + i;
}
items.add(item);
}
mAdapter.setDatas(items);
}
});
}
Aggregations