use of me.yluo.ruisiapp.listener.LoadMoreListener in project Ruisi by freedom10086.
the class FrageMessage method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
messageList = mRootView.findViewById(R.id.recycler_view);
tab1 = mRootView.findViewById(R.id.btn_1);
tab2 = mRootView.findViewById(R.id.btn_2);
tab3 = mRootView.findViewById(R.id.btn_3);
// 设置可以滑出底栏
messageList.setClipToPadding(false);
messageList.setPadding(0, 0, 0, (int) getResources().getDimension(R.dimen.bottombarHeight));
refreshLayout = mRootView.findViewById(R.id.refresh_layout);
refreshLayout.setColorSchemeResources(R.color.red_light, R.color.green_light, R.color.blue_light, R.color.orange_light);
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
messageList.setLayoutManager(layoutManager);
messageList.addItemDecoration(new MyListDivider(getActivity(), MyListDivider.VERTICAL));
messageList.addOnScrollListener(new LoadMoreListener(layoutManager, this, 8));
adapter = new MessageAdapter(getActivity(), datas);
if (!App.ISLOGIN(getActivity())) {
adapter.changeLoadMoreState(BaseAdapter.STATE_NEED_LOGIN);
}
messageList.setAdapter(adapter);
refreshLayout.setOnRefreshListener(() -> pullRefresh());
RadioGroup swictchMes = mRootView.findViewById(R.id.btn_change);
swictchMes.setOnCheckedChangeListener((radioGroup, id) -> {
int pos = 2;
if (id == R.id.btn_1) {
pos = 0;
} else if (id == R.id.btn_2) {
pos = 1;
}
if (pos != index) {
index = pos;
getData(true);
}
});
return mRootView;
}
use of me.yluo.ruisiapp.listener.LoadMoreListener in project Ruisi by freedom10086.
the class PostsActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
datas = new ArrayList<>();
setContentView(R.layout.activity_posts);
if (getIntent().getExtras() != null) {
FID = getIntent().getExtras().getInt("FID");
TITLE = getIntent().getExtras().getString("TITLE");
}
initToolBar(true, TITLE);
myToolbar = findViewById(R.id.myToolBar);
btnRefresh = findViewById(R.id.btn);
mRecyclerView = findViewById(R.id.recycler_view);
tab = findViewById(R.id.tab);
refreshLayout = findViewById(R.id.refresh_layout);
refreshLayout.setColorSchemeResources(R.color.red_light, R.color.green_light, R.color.blue_light, R.color.orange_light);
int top = DimmenUtils.dip2px(this, 60);
refreshLayout.setProgressViewOffset(true, top, top + 60);
isHideZhiding = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("setting_hide_zhidin", true);
if (getType() == PostListAdapter.TYPE_IMAGE) {
isEnableLoadMore = false;
mLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
mRecyclerView.setHasFixedSize(false);
addToolbarMenu(R.drawable.ic_column_change_24dp).setOnClickListener(this);
} else {
mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.addItemDecoration(new MyListDivider(this, MyListDivider.VERTICAL));
mRecyclerView.addOnScrollListener(new LoadMoreListener((LinearLayoutManager) mLayoutManager, this, 8));
addToolbarMenu(R.drawable.ic_edit).setOnClickListener(this);
}
tab.addTab(tab.newTab().setText("最新"));
tab.addTab(tab.newTab().setText("热门"));
tab.addTab(tab.newTab().setText("热帖"));
tab.addTab(tab.newTab().setText("精华"));
adapter = new PostListAdapter(this, datas, getType());
if (getType() == PostListAdapter.TYPE_IMAGE) {
adapter.setEnablePlaceHolder(false);
}
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(adapter);
myDB = new MyDB(this);
datas.clear();
btnRefresh.setOnClickListener(v -> refresh());
init();
// 子类实现获取数据
getData();
}
use of me.yluo.ruisiapp.listener.LoadMoreListener in project Ruisi by freedom10086.
the class FrageHotsNews method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
((RadioButton) mRootView.findViewById(R.id.btn_1)).setText("新帖");
mRootView.findViewById(R.id.btn_2).setVisibility(View.GONE);
((RadioButton) mRootView.findViewById(R.id.btn_3)).setText("热贴");
postList = mRootView.findViewById(R.id.recycler_view);
refreshLayout = mRootView.findViewById(R.id.refresh_layout);
refreshLayout.setColorSchemeResources(R.color.red_light, R.color.green_light, R.color.blue_light, R.color.orange_light);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
postList.setLayoutManager(mLayoutManager);
postList.addItemDecoration(new MyListDivider(getActivity(), MyListDivider.VERTICAL));
// 设置可以滑出底栏
postList.setClipToPadding(false);
postList.setPadding(0, 0, 0, (int) getResources().getDimension(R.dimen.bottombarHeight));
adapter = new HotNewListAdapter(getActivity(), mydataset, galleryDatas);
postList.setAdapter(adapter);
postList.addOnScrollListener(new LoadMoreListener((LinearLayoutManager) mLayoutManager, this, 10));
refreshLayout.setOnRefreshListener(this::refresh);
RadioGroup swictchMes = mRootView.findViewById(R.id.btn_change);
swictchMes.setOnCheckedChangeListener((radioGroup, id) -> {
int pos = -1;
if (id == R.id.btn_1) {
pos = TYPE_NEW;
} else {
pos = TYPE_HOT;
}
if (pos != currentType) {
currentType = pos;
refreshLayout.setRefreshing(true);
refresh();
}
});
return mRootView;
}
use of me.yluo.ruisiapp.listener.LoadMoreListener in project Ruisi by freedom10086.
the class FriendActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_friend);
initToolBar(true, "我的好友");
friends = findViewById(R.id.recycler_view);
datas = new ArrayList<>();
backUpdatas = new ArrayList<>();
totalDatas = new ArrayList<>();
adapter = new FriendAdapter(this, datas, this);
friends.setHasFixedSize(true);
LinearLayoutManager lm = new LinearLayoutManager(this);
friends.addItemDecoration(new MyListDivider(this, MyListDivider.VERTICAL));
friends.setLayoutManager(lm);
friends.addOnScrollListener(new LoadMoreListener(lm, this, 12));
friends.setAdapter(adapter);
search_input = findViewById(R.id.search_input);
search_input.setHint("查找好友");
search_card = findViewById(R.id.search_card);
final String url = "home.php?mod=space&do=friend&mobile=2";
new GetDataTask().execute(url);
search_input.setOnEditorActionListener(this);
addToolbarMenu(R.drawable.ic_search_white_24dp).setOnClickListener(this);
findViewById(R.id.btn_back).setOnClickListener(this);
findViewById(R.id.start_search).setOnClickListener(this);
search_card.setVisibility(View.INVISIBLE);
search_input.addTextChangedListener(this);
}
use of me.yluo.ruisiapp.listener.LoadMoreListener in project Ruisi by freedom10086.
the class PostActivity method initCommentList.
private void initCommentList() {
topicList = findViewById(R.id.topic_list);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
topicList.setLayoutManager(mLayoutManager);
adapter = new PostAdapter(this, this, datas);
topicList.addItemDecoration(new MyListDivider(this, MyListDivider.VERTICAL));
topicList.addOnScrollListener(new LoadMoreListener(mLayoutManager, this, 8));
topicList.setAdapter(adapter);
}
Aggregations