use of me.yluo.ruisiapp.widget.MyListDivider 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.widget.MyListDivider 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.widget.MyListDivider in project Ruisi by freedom10086.
the class UserDetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_detail);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.transparent));
}
toolbarLayout = findViewById(R.id.toolbar_layout);
infoList = findViewById(R.id.recycler_view);
CircleImageView imageView = findViewById(R.id.user_detail_img_avatar);
layout = findViewById(R.id.main_window);
progressView = findViewById(R.id.grade_progress);
progresText = findViewById(R.id.progress_text);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(v -> fab_click());
ViewCompat.setTransitionName(imageView, NAME_IMG_AVATAR);
username = getIntent().getStringExtra("loginName");
imageUrl = getIntent().getStringExtra("avatarUrl");
Picasso.with(this).load(imageUrl).placeholder(R.drawable.image_placeholder).into(imageView);
toolbarLayout.setTitle(username);
Toolbar mToolbar = findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
adapter = new SimpleListAdapter(ListType.INFO, this, datas);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
infoList.setLayoutManager(layoutManager);
infoList.addItemDecoration(new MyListDivider(this, MyListDivider.VERTICAL));
infoList.setAdapter(adapter);
userUid = getIntent().getStringExtra("uid");
if (TextUtils.isEmpty(userUid)) {
userUid = GetId.getId("uid=", imageUrl);
}
// 如果是自己
if (userUid.equals(App.getUid(this))) {
fab.setImageResource(R.drawable.ic_close_24dp);
imageView.setOnClickListener(view -> {
final String[] items = { "修改密码" };
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setTitle("操作");
alertBuilder.setItems(items, (arg0, index) -> {
if (index == 0) {
startActivity(new Intent(UserDetailActivity.this, ChangePasswordActivity.class));
}
});
AlertDialog d = alertBuilder.create();
d.show();
});
}
loadData(UrlUtils.getUserHomeUrl(userUid, false));
}
use of me.yluo.ruisiapp.widget.MyListDivider 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.widget.MyListDivider 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);
}
Aggregations