许愿排行榜UI
This commit is contained in:
@@ -902,7 +902,9 @@
|
||||
<activity
|
||||
android:name=".treasure_box.activity.TreasureBoxActivity"
|
||||
android:theme="@style/dialog_web_view_activity" />
|
||||
|
||||
<activity
|
||||
android:name=".treasure_box.activity.BoxRankingActivity"
|
||||
android:theme="@style/room_message_activity" />
|
||||
<activity
|
||||
android:name=".treasure_box.activity.TreasureBoxHonourActivity"
|
||||
android:theme="@style/dialog_web_view_activity" />
|
||||
|
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:background="@color/color_666666">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/room_msg_height"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/shape_white_top_14dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center_horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/find_new"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="每日更新推荐"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="@dimen/dp_13"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/arrow_left"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_gravity="center_vertical"
|
||||
/>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/recent_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
@@ -0,0 +1,126 @@
|
||||
package com.yizhuan.erban.treasure_box.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.flyco.tablayout.SlidingTabLayout;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.erban.common.ViewPagerAdapter;
|
||||
import com.yizhuan.erban.decoration.view.widgets.CarMagicIndicator;
|
||||
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
||||
import com.yizhuan.erban.treasure_box.fragment.BoxRankingFragment;
|
||||
import com.yizhuan.tutu.room_chat.activity.NimRoomP2PMessageActivity;
|
||||
import com.yizhuan.tutu.room_chat.event.ClickRootViewEvent;
|
||||
import com.yizhuan.tutu.room_chat.fragment.RoomMsgAttentionFragment;
|
||||
import com.yizhuan.tutu.room_chat.fragment.RoomMsgFansListFragment;
|
||||
import com.yizhuan.tutu.room_chat.fragment.RoomMsgFriendListFragment;
|
||||
import com.yizhuan.tutu.room_chat.fragment.RoomMsgRecentListFragment;
|
||||
import com.yizhuan.tutu.room_chat.fragment.RoomNewbieListFragment;
|
||||
import com.yizhuan.xchat_android_core.home.bean.TabInfo;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
|
||||
|
||||
public class BoxRankingActivity extends BaseActivity implements CarMagicIndicator.OnItemSelectListener {
|
||||
|
||||
@BindView(R.id.view_indicator)
|
||||
SlidingTabLayout viewIndicator;
|
||||
@BindView(R.id.viewpager)
|
||||
ViewPager viewpager;
|
||||
private String[] titles = {"今日榜单", "昨日榜单"};
|
||||
private int type = AbstractSelectFriendAction.ROOM_MSG;
|
||||
public static final String KEY_PRIVATE_CHAT_ACCOUNT = "key_private_chat_account";
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent starter = new Intent(context, BoxRankingActivity.class);
|
||||
//starter.putExtra();
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
public static void startForPrivateChat(Context context, String account) {
|
||||
Intent starter = new Intent(context,BoxRankingActivity.class);
|
||||
starter.putExtra(KEY_PRIVATE_CHAT_ACCOUNT, account);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void init() {
|
||||
List<TabInfo> tabInfoList = new ArrayList<>(2);
|
||||
for (int i = 0; i < titles.length; i++) {
|
||||
tabInfoList.add(new TabInfo(i, titles[i]));
|
||||
}
|
||||
viewpager.setOffscreenPageLimit(2);
|
||||
viewpager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), getFragment(), titles));
|
||||
viewIndicator.setViewPager(viewpager, titles, this, getFragment());
|
||||
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.filter(roomEvent -> roomEvent.getEvent() == RoomEvent.KICK_OUT_ROOM)
|
||||
.subscribe(roomEvent -> finish());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_room_message);
|
||||
ButterKnife.bind(this);
|
||||
init();
|
||||
String account = getIntent().getStringExtra(KEY_PRIVATE_CHAT_ACCOUNT);
|
||||
if (!TextUtils.isEmpty(account)) {
|
||||
NimRoomP2PMessageActivity.start(this, account);
|
||||
}
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
private ArrayList<Fragment> getFragment() {
|
||||
ArrayList<Fragment> list = new ArrayList<>();
|
||||
list.add(BoxRankingFragment.newInstance(true));
|
||||
list.add(BoxRankingFragment.newInstance(true));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelect(int position) {
|
||||
viewpager.setCurrentItem(position);
|
||||
}
|
||||
|
||||
@OnClick(R.id.root_view)
|
||||
public void onViewClicked() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRootViewClicked(ClickRootViewEvent event) {
|
||||
onViewClicked();
|
||||
}
|
||||
}
|
@@ -124,7 +124,8 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
|
||||
new BoxMoreDialog(context).openDialog();
|
||||
break;
|
||||
case R.id.tv_rank:
|
||||
DialogWebViewActivity.start(context, UriProvider.getBoxRank(), false);
|
||||
// DialogWebViewActivity.start(context, UriProvider.getBoxRank(), false);
|
||||
BoxRankingActivity.start(this);
|
||||
break;
|
||||
case R.id.iv_open:
|
||||
openBox(StringUtils.toInt(mBinding.editNum.getText().toString(), 0));
|
||||
|
@@ -0,0 +1,186 @@
|
||||
package com.yizhuan.erban.treasure_box.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.bean.RoomNewbieInfo;
|
||||
import com.yizhuan.erban.avroom.presenter.RoomNewbiePresenter;
|
||||
import com.yizhuan.erban.base.BaseMvpFragment;
|
||||
import com.yizhuan.erban.module.IRoomNewbieView;
|
||||
import com.yizhuan.tutu.room_chat.activity.RoomNewbieMessageActivity;
|
||||
import com.yizhuan.tutu.room_chat.adapter.RoomNewbieListAdapter;
|
||||
import com.yizhuan.tutu.room_chat.event.SendHelloSuccessEvent;
|
||||
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 房间内私聊用的好友列表界面
|
||||
*
|
||||
* @author MadisonRong RoomNewbieListFragment
|
||||
*/
|
||||
@CreatePresenter(RoomNewbiePresenter.class)
|
||||
public class BoxRankingFragment extends BaseMvpFragment<IRoomNewbieView, RoomNewbiePresenter> implements IRoomNewbieView, BaseQuickAdapter.RequestLoadMoreListener {
|
||||
private RecyclerView recyclerView;
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private RoomNewbieListAdapter mNewbieListAdapter;
|
||||
private boolean isInRoom;
|
||||
|
||||
public static BoxRankingFragment newInstance(boolean isInRoom) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("isInRoom",isInRoom);
|
||||
BoxRankingFragment fragment = new BoxRankingFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
if (getArguments() != null) {
|
||||
isInRoom = getArguments().getBoolean("isInRoom");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRootLayoutId() {
|
||||
return R.layout.fragment_newbie_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFindViews() {
|
||||
recyclerView = mView.findViewById(R.id.recycler_view);
|
||||
swipeRefresh = mView.findViewById(R.id.swipe_refresh);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetListener() {
|
||||
swipeRefresh.setOnRefreshListener(() -> {
|
||||
mNewbieListAdapter.setEnableLoadMore(true);
|
||||
loadData(true);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate() {
|
||||
initRecyclerView();
|
||||
loadData(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新数据
|
||||
*/
|
||||
private void loadData(boolean isRefresh) {
|
||||
getMvpPresenter().loadData(isRefresh);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View.OnClickListener getLoadMoreListener() {
|
||||
return super.getLoadMoreListener();
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
recyclerView.setItemAnimator(null);
|
||||
mNewbieListAdapter = new RoomNewbieListAdapter();
|
||||
mNewbieListAdapter.setOnLoadMoreListener(this, recyclerView);
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
recyclerView.setAdapter(mNewbieListAdapter);
|
||||
mNewbieListAdapter.setRylListener(new RoomNewbieListAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onAttentionBtnClick(RoomNewbieInfo fansInfo) {
|
||||
// if (fansInfo.isHello()){
|
||||
RoomNewbieMessageActivity.start(mContext,fansInfo.getUid(),isInRoom);
|
||||
// }else {
|
||||
// SingleToastUtil.showToastShort("该用户被打招呼次数太多了,换一个吧~");
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getRoomNewbieSuccess(List<RoomNewbieInfo> list) {
|
||||
hideStatus();
|
||||
if (mNewbieListAdapter != null) {
|
||||
int page = getMvpPresenter().getPage();
|
||||
if (page <= 1) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
|
||||
if (list == null || list.size() == 0) {
|
||||
showNoData(getString(R.string.empty_newbie_list));
|
||||
} else {
|
||||
mNewbieListAdapter.setNewData(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRoomNewbieFails(String error) {
|
||||
hideStatus();
|
||||
|
||||
int page = getMvpPresenter().getPage();
|
||||
if (page <= 1) {
|
||||
showNoData(getString(R.string.empty_newbie_list));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRoomNewbieLoadMoreSuccess(List<RoomNewbieInfo> list) {
|
||||
if (ListUtils.isListEmpty(list)){
|
||||
mNewbieListAdapter.loadMoreEnd();
|
||||
return;
|
||||
}
|
||||
mNewbieListAdapter.addData(list);
|
||||
mNewbieListAdapter.loadMoreComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRoomNewbieLoadMoreFails(String error) {
|
||||
hideStatus();
|
||||
int page = getMvpPresenter().getPage();
|
||||
if (page <= 1) {
|
||||
showNoData(getString(R.string.empty_newbie_list));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReloadData() {
|
||||
super.onReloadData();
|
||||
loadData(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
loadData(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSendHelloSuccess(SendHelloSuccessEvent event) {
|
||||
loadData(true);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user