feat:调整首页部分类命名与目录结构、删除部分无用类
This commit is contained in:
@@ -40,7 +40,6 @@ import com.nnbc123.app.application.ActivityStackManager;
|
|||||||
import com.nnbc123.app.avroom.activity.AVRoomActivity;
|
import com.nnbc123.app.avroom.activity.AVRoomActivity;
|
||||||
import com.nnbc123.app.avroom.newuserchargegift.NewUserChargeGiftDialog;
|
import com.nnbc123.app.avroom.newuserchargegift.NewUserChargeGiftDialog;
|
||||||
import com.nnbc123.app.base.BaseMvpActivity;
|
import com.nnbc123.app.base.BaseMvpActivity;
|
||||||
import com.nnbc123.app.common.widget.CircleImageView;
|
|
||||||
import com.nnbc123.app.common.widget.DragLayout;
|
import com.nnbc123.app.common.widget.DragLayout;
|
||||||
import com.nnbc123.app.community.dynamic.view.DynamicDetailActivity;
|
import com.nnbc123.app.community.dynamic.view.DynamicDetailActivity;
|
||||||
import com.nnbc123.app.community.publish.view.PublishActivity;
|
import com.nnbc123.app.community.publish.view.PublishActivity;
|
||||||
@@ -49,7 +48,7 @@ import com.nnbc123.app.family.view.activity.FamilyHomeActivity;
|
|||||||
import com.nnbc123.app.home.HomeViewModel;
|
import com.nnbc123.app.home.HomeViewModel;
|
||||||
import com.nnbc123.app.home.dialog.NewUserHelloDialog;
|
import com.nnbc123.app.home.dialog.NewUserHelloDialog;
|
||||||
import com.nnbc123.app.home.dialog.ProtocolUpdateDialog;
|
import com.nnbc123.app.home.dialog.ProtocolUpdateDialog;
|
||||||
import com.nnbc123.app.home.fragment.HomeFragment;
|
import com.nnbc123.app.home.fragment.home.HomeFragment;
|
||||||
import com.nnbc123.app.home.fragment.MeFragment;
|
import com.nnbc123.app.home.fragment.MeFragment;
|
||||||
import com.nnbc123.app.home.fragment.MsgFragment;
|
import com.nnbc123.app.home.fragment.MsgFragment;
|
||||||
import com.nnbc123.app.home.fragment.PmModeFragment;
|
import com.nnbc123.app.home.fragment.PmModeFragment;
|
||||||
@@ -73,7 +72,6 @@ import com.nnbc123.app.ui.patriarch.help.PmDialogShowMrg;
|
|||||||
import com.nnbc123.app.ui.utils.ImageLoadUtils;
|
import com.nnbc123.app.ui.utils.ImageLoadUtils;
|
||||||
import com.nnbc123.app.ui.utils.ImageLoadUtilsV2;
|
import com.nnbc123.app.ui.utils.ImageLoadUtilsV2;
|
||||||
import com.nnbc123.app.ui.webview.CommonWebViewActivity;
|
import com.nnbc123.app.ui.webview.CommonWebViewActivity;
|
||||||
import com.nnbc123.app.ui.widget.LivingIconView;
|
|
||||||
import com.nnbc123.app.ui.widget.MainTabLayout;
|
import com.nnbc123.app.ui.widget.MainTabLayout;
|
||||||
import com.nnbc123.app.utils.CleanLeakUtils;
|
import com.nnbc123.app.utils.CleanLeakUtils;
|
||||||
import com.nnbc123.app.utils.PushMessageHandler;
|
import com.nnbc123.app.utils.PushMessageHandler;
|
||||||
|
@@ -1,41 +0,0 @@
|
|||||||
package com.nnbc123.app.home.adapter
|
|
||||||
|
|
||||||
import android.widget.ImageView
|
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
|
||||||
import com.chad.library.adapter.base.BaseViewHolder
|
|
||||||
import com.nnbc123.app.R
|
|
||||||
import com.nnbc123.app.avroom.activity.AVRoomActivity
|
|
||||||
import com.nnbc123.app.ui.utils.load
|
|
||||||
import com.nnbc123.core.room.bean.HomeLiveTopInfo
|
|
||||||
import com.nnbc123.core.statistic.StatisticManager
|
|
||||||
import com.nnbc123.core.statistic.protocol.StatisticsProtocol
|
|
||||||
|
|
||||||
|
|
||||||
class HomeLiveTopAdapter :
|
|
||||||
BaseQuickAdapter<HomeLiveTopInfo.SingleRoom, BaseViewHolder>(R.layout.item_home_live_top) {
|
|
||||||
|
|
||||||
private var onceLookStatus: Boolean = false
|
|
||||||
|
|
||||||
fun setOnceLookStatus(onceLookStatus: Boolean) {
|
|
||||||
this.onceLookStatus = onceLookStatus
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun convert(helper: BaseViewHolder, item: HomeLiveTopInfo.SingleRoom) {
|
|
||||||
helper.apply {
|
|
||||||
getView<ImageView>(R.id.iv_room_image).load(item.avatar)
|
|
||||||
setText(R.id.tv_room_title, item.title)
|
|
||||||
setGone(R.id.iv_room_tag, item.isRecommend && onceLookStatus)
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.itemView.setOnClickListener {
|
|
||||||
AVRoomActivity.start(mContext, item.uid)
|
|
||||||
StatisticManager.Instance().onEvent(
|
|
||||||
StatisticsProtocol.EVENT_RECENT_CARD_CLICK,
|
|
||||||
"最近在看卡片点击",
|
|
||||||
mapOf("room_id" to item.erbanNo)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,91 +0,0 @@
|
|||||||
package com.nnbc123.app.home.adapter;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
|
||||||
import com.chad.library.adapter.base.BaseViewHolder;
|
|
||||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
|
||||||
import com.nnbc123.app.R;
|
|
||||||
import com.nnbc123.app.avroom.activity.AVRoomActivity;
|
|
||||||
import com.nnbc123.app.ui.utils.ImageLoadUtils;
|
|
||||||
import com.nnbc123.core.home.bean.HomeTabMapInfo;
|
|
||||||
import com.nnbc123.core.statistic.StatisticManager;
|
|
||||||
import com.nnbc123.core.statistic.protocol.StatisticsProtocol;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> 首页热门adapter </p>
|
|
||||||
*
|
|
||||||
* @author Administrator
|
|
||||||
* @date 2017/11/16
|
|
||||||
*/
|
|
||||||
public class HomeRoomFragmentAdapter extends BaseMultiItemQuickAdapter<HomeTabMapInfo, BaseViewHolder> {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验跳转房间的频率
|
|
||||||
*/
|
|
||||||
public HomeRoomFragmentAdapter(Context context) {
|
|
||||||
super(null);
|
|
||||||
addItemType(HomeTabMapInfo.TYPE_NORMAL, R.layout.item_home_tab_map);
|
|
||||||
addItemType(HomeTabMapInfo.TYPE_EMPTY, R.layout.item_erban_grid_empty);
|
|
||||||
this.mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void convert(@NonNull BaseViewHolder helper, HomeTabMapInfo item) {
|
|
||||||
if (item == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (helper.getItemViewType()) {
|
|
||||||
|
|
||||||
case HomeTabMapInfo.TYPE_NORMAL:
|
|
||||||
helper.itemView.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_TJ_ROOM_SUCCESS, "首页_进入推荐房间");
|
|
||||||
AVRoomActivity.startForFromType(mContext, item.getRoomUid(), AVRoomActivity.FROM_TYPE_RECOMMEND);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
helper.setText(R.id.tv_online_number, item.getOnlineNum() + "")
|
|
||||||
.setText(R.id.tv_title, item.getTitle());
|
|
||||||
|
|
||||||
|
|
||||||
//注意这里有三个标签,展示优先级 PK中>自定义>房间标签
|
|
||||||
helper.setGone(R.id.tv_tag_in_pk, item.isCrossPking());
|
|
||||||
|
|
||||||
helper.setGone(R.id.tv_tag_content, !TextUtils.isEmpty(item.getIconContent()) && !item.isCrossPking())
|
|
||||||
.setText(R.id.tv_tag_content, item.getIconContent());
|
|
||||||
|
|
||||||
ImageView mIvTabLabel = helper.getView(R.id.iv_tab_label);
|
|
||||||
if (!TextUtils.isEmpty(item.getTagPict()) && !item.isCrossPking() && TextUtils.isEmpty(item.getIconContent())) {
|
|
||||||
mIvTabLabel.setVisibility(View.VISIBLE);
|
|
||||||
ImageLoadUtils.loadAvatarBig(item.getTagPict(), mIvTabLabel);
|
|
||||||
} else {
|
|
||||||
mIvTabLabel.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageView ivCover = helper.getView(R.id.iv_cover);
|
|
||||||
if (!TextUtils.isEmpty(item.getAvatar())) {
|
|
||||||
ImageLoadUtils.loadAvatarBig(item.getAvatar(), ivCover, R.drawable.default_cover);
|
|
||||||
} else {
|
|
||||||
GlideApp.with(mContext)
|
|
||||||
.load(R.drawable.default_cover)
|
|
||||||
.placeholder(R.drawable.default_cover)
|
|
||||||
.into(ivCover);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HomeTabMapInfo.TYPE_EMPTY:
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,51 +0,0 @@
|
|||||||
package com.nnbc123.app.home.adapter
|
|
||||||
|
|
||||||
import android.widget.ImageView
|
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
|
||||||
import com.chad.library.adapter.base.BaseViewHolder
|
|
||||||
import com.opensource.svgaplayer.SVGAImageView
|
|
||||||
import com.nnbc123.app.R
|
|
||||||
import com.nnbc123.app.avroom.activity.AVRoomActivity
|
|
||||||
import com.nnbc123.core.home.bean.HomeRoomInfo
|
|
||||||
import com.nnbc123.app.ui.utils.load
|
|
||||||
import com.nnbc123.app.ui.utils.loadFromAssets
|
|
||||||
import com.nnbc123.core.statistic.StatisticManager
|
|
||||||
import com.nnbc123.core.statistic.protocol.StatisticsProtocol
|
|
||||||
import com.nnbc123.core.utils.TextUtils
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create by lvzebiao @2019/11/13
|
|
||||||
* 人气主播更多
|
|
||||||
*/
|
|
||||||
class MoreSingleAnchorAdapter :
|
|
||||||
BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.item_home_single_anchor_more) {
|
|
||||||
|
|
||||||
override fun convert(helper: BaseViewHolder, item: HomeRoomInfo) {
|
|
||||||
|
|
||||||
val ivPking = helper.getView<SVGAImageView>(R.id.iv_pking)
|
|
||||||
val ivTag = helper.getView<ImageView>(R.id.iv_tag)
|
|
||||||
ivPking.isVisible = item.isCrossPking
|
|
||||||
ivTag.isVisible = !TextUtils.isEmptyText(item.tagPict) && !item.isCrossPking
|
|
||||||
if (item.isCrossPking) {
|
|
||||||
ivPking.loadFromAssets("svga/single_room_pking.svga")
|
|
||||||
} else {
|
|
||||||
ivTag.load(item.tagPict)
|
|
||||||
}
|
|
||||||
helper.setText(R.id.tv_online_num, item.onlineNum.toString())
|
|
||||||
.setText(R.id.tv_nickname, item.nick)
|
|
||||||
.setText(R.id.tv_room_name, item.title)
|
|
||||||
.setImageResource(
|
|
||||||
R.id.iv_gender,
|
|
||||||
if (item.gender == 1) R.drawable.ic_gender_male else R.drawable.ic_gender_female
|
|
||||||
)
|
|
||||||
helper.getView<ImageView>(R.id.iv_room_avatar)
|
|
||||||
.load(item.avatar, 12f, R.drawable.default_cover)
|
|
||||||
|
|
||||||
helper.itemView.setOnClickListener {
|
|
||||||
StatisticManager.Instance()
|
|
||||||
.onEvent(StatisticsProtocol.EVENT_ZB_TAB_ROOM_SUCCESS, "直播tab进入房间成功")
|
|
||||||
AVRoomActivity.start(mContext, item.uid)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,192 +0,0 @@
|
|||||||
package com.nnbc123.app.home.fragment;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import com.nnbc123.core.home.bean.HomeTabMapInfo;
|
|
||||||
import com.nnbc123.core.home.event.RefreshHomeDataEvent;
|
|
||||||
import com.nnbc123.core.home.model.GameHomeModel;
|
|
||||||
import com.nnbc123.core.utils.net.RxHelper;
|
|
||||||
import com.nnbc123.app.R;
|
|
||||||
import com.nnbc123.app.base.BaseFragment;
|
|
||||||
import com.nnbc123.app.home.adapter.HomeRoomFragmentAdapter;
|
|
||||||
import com.nnbc123.library.utils.ListUtils;
|
|
||||||
import com.trello.rxlifecycle3.android.FragmentEvent;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class HomeTabHomeFragment extends BaseFragment {
|
|
||||||
public static final int ROWS = 3;
|
|
||||||
private static final Comparator<HomeTabMapInfo> comp = (o1, o2) -> {
|
|
||||||
int seq = o1.getSeq() - o2.getSeq();
|
|
||||||
return Integer.compare(seq, 0);
|
|
||||||
};
|
|
||||||
private RecyclerView recyclerView;
|
|
||||||
private HomeRoomFragmentAdapter mHomeRoomAdapter;
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public static HomeTabHomeFragment newInstance() {
|
|
||||||
HomeTabHomeFragment fragment = new HomeTabHomeFragment();
|
|
||||||
return fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRootLayoutId() {
|
|
||||||
return R.layout.fragment_home_room_tab;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFindViews() {
|
|
||||||
super.onFindViews();
|
|
||||||
recyclerView = mView.findViewById(R.id.recycler_view);
|
|
||||||
initRecyclerView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求数据
|
|
||||||
*/
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
private void getData() {
|
|
||||||
GameHomeModel.get()
|
|
||||||
.getHomeTabHome()
|
|
||||||
.compose(RxHelper.handleSchedulers())
|
|
||||||
.compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
|
|
||||||
.subscribe((serviceResult, throwable) -> {
|
|
||||||
if (throwable == null) {
|
|
||||||
if (ListUtils.isListEmpty(serviceResult)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<HomeTabMapInfo> roomsList = new ArrayList<>(serviceResult);//未处理的数
|
|
||||||
List<HomeTabMapInfo> randomList = new ArrayList<>();//不是置顶的
|
|
||||||
List<HomeTabMapInfo> finalList = new ArrayList<>();//最终的6条数据
|
|
||||||
|
|
||||||
for (int i = 0; i < roomsList.size(); i++) {
|
|
||||||
roomsList.get(i).setItemType(HomeTabMapInfo.TYPE_NORMAL);//对原始数据设置type
|
|
||||||
}
|
|
||||||
for (int i = 0; i < roomsList.size(); i++) {
|
|
||||||
if (roomsList.get(i).isIsTop()) {
|
|
||||||
finalList.add(roomsList.get(i));
|
|
||||||
} else {
|
|
||||||
randomList.add(roomsList.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sortSeqRoom(finalList);
|
|
||||||
refreshRoomData(finalList, randomList);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 刷新数据
|
|
||||||
*/
|
|
||||||
private void refreshRoomData(List<HomeTabMapInfo> finalList, List<HomeTabMapInfo> randomList) {
|
|
||||||
List<HomeTabMapInfo> finalList1 = new ArrayList<>(finalList);//最终的6条数据
|
|
||||||
List<HomeTabMapInfo> randomList1 = new ArrayList<>(randomList);//不是置顶的
|
|
||||||
mHomeRoomAdapter.setNewData(getConvertData(finalList1, randomList1));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initRecyclerView() {
|
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false));
|
|
||||||
recyclerView.setItemAnimator(null);
|
|
||||||
mHomeRoomAdapter = new HomeRoomFragmentAdapter(getContext());
|
|
||||||
mHomeRoomAdapter.setEnableLoadMore(false);
|
|
||||||
mHomeRoomAdapter.setEnableLoadMore(false);
|
|
||||||
recyclerView.setAdapter(mHomeRoomAdapter);
|
|
||||||
|
|
||||||
View emptyView = getLayoutInflater().inflate(R.layout.layout_home_room_empty, null);
|
|
||||||
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
||||||
emptyView.setLayoutParams(lp);
|
|
||||||
mHomeRoomAdapter.setEmptyView(emptyView);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转化房间数组,不足6的加上虚位以待
|
|
||||||
*
|
|
||||||
* @param
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private List<HomeTabMapInfo> getConvertData(List<HomeTabMapInfo> finalList, List<HomeTabMapInfo> randomList) {
|
|
||||||
List<HomeTabMapInfo> finalList1 = new ArrayList<>(finalList);//最终的6条数据
|
|
||||||
List<HomeTabMapInfo> randomList1 = new ArrayList<>(randomList);//不是置顶的
|
|
||||||
int ROOM_COUNT = 6;//首页显示6条数据
|
|
||||||
randomList1 = randomList(randomList1);
|
|
||||||
finalList1.addAll(randomList1);
|
|
||||||
|
|
||||||
if (finalList1.size() >= ROOM_COUNT) {
|
|
||||||
finalList1 = finalList1.subList(0, ROOM_COUNT);
|
|
||||||
} else {
|
|
||||||
while (finalList1.size() < ROOM_COUNT) {
|
|
||||||
HomeTabMapInfo info = new HomeTabMapInfo();
|
|
||||||
info.setItemType(HomeTabMapInfo.TYPE_EMPTY);
|
|
||||||
finalList1.add(info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return finalList1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* **************************** 排序 ***********************************
|
|
||||||
*/
|
|
||||||
private void sortSeqRoom(List<HomeTabMapInfo> list) {
|
|
||||||
if (list.size() == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Collections.sort(list, comp);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<HomeTabMapInfo> randomList(List<HomeTabMapInfo> sourceList) {
|
|
||||||
if (sourceList == null || sourceList.size() == 0) {
|
|
||||||
return sourceList;
|
|
||||||
}
|
|
||||||
ArrayList randomList = new ArrayList(sourceList.size());
|
|
||||||
do {
|
|
||||||
int randomIndex = Math.abs(new Random().nextInt(sourceList.size()));
|
|
||||||
randomList.add(sourceList.remove(randomIndex));
|
|
||||||
} while (sourceList.size() > 0);
|
|
||||||
return randomList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initiate() {
|
|
||||||
getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
EventBus.getDefault().register(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
EventBus.getDefault().unregister(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
public void onRefreshHomeDataEvent(RefreshHomeDataEvent event) {
|
|
||||||
if (isResumed()) getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,185 +0,0 @@
|
|||||||
package com.nnbc123.app.home.fragment
|
|
||||||
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.Gravity
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import androidx.fragment.app.activityViewModels
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import androidx.viewpager.widget.ViewPager
|
|
||||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
|
||||||
import com.scwang.smartrefresh.layout.internal.ProgressDrawable
|
|
||||||
import com.nnbc123.app.R
|
|
||||||
import com.nnbc123.app.avroom.adapter.RoomVPAdapter
|
|
||||||
import com.nnbc123.app.base.BaseViewBindingFragment
|
|
||||||
import com.nnbc123.app.databinding.FragmentLiveBinding
|
|
||||||
import com.nnbc123.app.home.HomeViewModel
|
|
||||||
import com.nnbc123.app.home.adapter.HomeLiveTopAdapter
|
|
||||||
import com.nnbc123.app.home.adapter.PartyMagicIndicatorAdapter
|
|
||||||
import com.nnbc123.app.ui.utils.RVDelegate
|
|
||||||
import com.nnbc123.app.ui.widget.magicindicator.ViewPagerHelper
|
|
||||||
import com.nnbc123.app.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
|
||||||
import com.nnbc123.core.home.event.RefreshHomeDataEvent
|
|
||||||
import com.nnbc123.core.room.bean.HomeLiveTopInfo
|
|
||||||
import com.nnbc123.core.room.bean.SingleRoomSortInfo
|
|
||||||
import com.nnbc123.core.statistic.StatisticManager
|
|
||||||
import com.nnbc123.core.statistic.protocol.StatisticsProtocol
|
|
||||||
import com.nnbc123.core.utils.CurrentTimeUtils
|
|
||||||
import org.greenrobot.eventbus.EventBus
|
|
||||||
import org.greenrobot.eventbus.Subscribe
|
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 音萌首页
|
|
||||||
*/
|
|
||||||
class LiveFragment : BaseViewBindingFragment<FragmentLiveBinding>(),
|
|
||||||
PartyMagicIndicatorAdapter.OnItemSelectListener {
|
|
||||||
|
|
||||||
private val mFragments: ArrayList<Fragment> = ArrayList()
|
|
||||||
private val mTabInfoList: ArrayList<String> = ArrayList()
|
|
||||||
private var currentIndex = 0
|
|
||||||
private var lastLoadDataTime = 0L
|
|
||||||
|
|
||||||
private lateinit var mAdapter: HomeLiveTopAdapter
|
|
||||||
private lateinit var rvDelegate: RVDelegate<HomeLiveTopInfo.SingleRoom>
|
|
||||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun newInstance(): LiveFragment {
|
|
||||||
val args = Bundle()
|
|
||||||
val fragment = LiveFragment()
|
|
||||||
fragment.arguments = args
|
|
||||||
return fragment
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun init() {
|
|
||||||
mAdapter = HomeLiveTopAdapter()
|
|
||||||
rvDelegate = RVDelegate.Builder<HomeLiveTopInfo.SingleRoom>()
|
|
||||||
.setAdapter(mAdapter)
|
|
||||||
.setLayoutManager(LinearLayoutManager(mContext, RecyclerView.HORIZONTAL, false))
|
|
||||||
.setRecyclerView(binding.recyclerView)
|
|
||||||
.build()
|
|
||||||
initRefreshView()
|
|
||||||
homeViewModel.singleRoomSortInfoLiveData.observe(
|
|
||||||
viewLifecycleOwner
|
|
||||||
) {
|
|
||||||
if (it.isSuccess) {
|
|
||||||
it.data?.let { date -> onGetSingleRoomSortInfoSuccess(date) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
homeViewModel.homeLiveTopInfoLiveData.observe(viewLifecycleOwner) {
|
|
||||||
it?.let {
|
|
||||||
mAdapter.setOnceLookStatus(it.onceLookStatus)
|
|
||||||
rvDelegate.loadData(it.singleRoomList, true)
|
|
||||||
binding.tvTitle.text = if (it.onceLookStatus) "曾经看过的人" else "Top热播"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.viewPager.addOnPageChangeListener(object : ViewPager.SimpleOnPageChangeListener() {
|
|
||||||
override fun onPageSelected(position: Int) {
|
|
||||||
super.onPageSelected(position)
|
|
||||||
StatisticManager.Instance().onEvent(
|
|
||||||
StatisticsProtocol.EVENT_GEBO_TAB_CLICK,
|
|
||||||
"个播页二级tab分类点击",
|
|
||||||
mapOf("tab_name" to mTabInfoList.getOrElse(position) { "未知tab" })
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
loadData()
|
|
||||||
StatisticManager.Instance().onEvent(
|
|
||||||
StatisticsProtocol.EVENT_RECENT_CARD_SHOW, "最近在看卡片曝光"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun onGetSingleRoomSortInfoSuccess(info: List<SingleRoomSortInfo>) {
|
|
||||||
var changed = false
|
|
||||||
val oldTabInfoList: List<CharSequence> = ArrayList<CharSequence>(mTabInfoList)
|
|
||||||
for (tagInfo in info) {
|
|
||||||
if (!oldTabInfoList.contains(tagInfo.sortName)) {
|
|
||||||
changed = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//只有HomeTagInfo发生改变才刷新数据
|
|
||||||
if (changed) {
|
|
||||||
mTabInfoList.clear()
|
|
||||||
mFragments.clear()
|
|
||||||
for (tagInfo in info) {
|
|
||||||
mTabInfoList.add(tagInfo.sortName)
|
|
||||||
val fragment = RoomSingleFragment.newInstance(tagInfo.id)
|
|
||||||
mFragments.add(fragment)
|
|
||||||
}
|
|
||||||
val commonNavigator = CommonNavigator(context)
|
|
||||||
commonNavigator.setTitleWrapContent(false)
|
|
||||||
commonNavigator.titleMargin = ScreenUtil.dip2px(2.0F)
|
|
||||||
commonNavigator.setTitleGravity(Gravity.CENTER_VERTICAL)
|
|
||||||
val magicIndicatorAdapter = PartyMagicIndicatorAdapter(mTabInfoList)
|
|
||||||
magicIndicatorAdapter.textSize = 14
|
|
||||||
magicIndicatorAdapter.setOnItemSelectListener(this)
|
|
||||||
commonNavigator.adapter = magicIndicatorAdapter
|
|
||||||
binding.magicIndicator.navigator = commonNavigator
|
|
||||||
binding.viewPager.offscreenPageLimit = 2
|
|
||||||
binding.viewPager.adapter = RoomVPAdapter(
|
|
||||||
childFragmentManager,
|
|
||||||
mFragments
|
|
||||||
)
|
|
||||||
ViewPagerHelper.bind(binding.magicIndicator, binding.viewPager)
|
|
||||||
onItemSelect(currentIndex, null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initRefreshView() {
|
|
||||||
binding.refreshLayout.setOnRefreshListener {
|
|
||||||
binding.refreshLayout.finishRefresh()
|
|
||||||
EventBus.getDefault().post(RefreshHomeDataEvent())
|
|
||||||
}
|
|
||||||
binding.refreshLayout.isEnableLoadmore = false
|
|
||||||
binding.refreshLayout.isEnableOverScrollBounce = false
|
|
||||||
val themeColor = requireContext().resources.getColor(R.color.color_666666)
|
|
||||||
binding.refreshHeader.lastUpdateText.setTextColor(themeColor)
|
|
||||||
binding.refreshHeader.titleText.setTextColor(themeColor)
|
|
||||||
binding.refreshHeader.setBackgroundColor(Color.TRANSPARENT)
|
|
||||||
val progressDrawable = ProgressDrawable()
|
|
||||||
progressDrawable.setColor(themeColor)
|
|
||||||
binding.refreshHeader.progressView.setImageDrawable(progressDrawable)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemSelect(position: Int, view: TextView?) {
|
|
||||||
currentIndex = position
|
|
||||||
binding.viewPager.currentItem = currentIndex
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
fun onRefreshHomeDataEvent(event: RefreshHomeDataEvent?) {
|
|
||||||
if (isResumed) {
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun loadData() {
|
|
||||||
if (CurrentTimeUtils.getCurrentTime() - lastLoadDataTime < 15 * 1000) return
|
|
||||||
lastLoadDataTime = CurrentTimeUtils.getCurrentTime()
|
|
||||||
homeViewModel.requestSingleRoomSortList()
|
|
||||||
homeViewModel.requestHomeLiveTopInfo()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
EventBus.getDefault().register(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
EventBus.getDefault().unregister(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@@ -1,86 +0,0 @@
|
|||||||
package com.nnbc123.app.home.fragment
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import androidx.fragment.app.viewModels
|
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
|
||||||
import com.nnbc123.app.base.BaseViewBindingFragment
|
|
||||||
import com.nnbc123.app.common.EmptyViewHelper
|
|
||||||
import com.nnbc123.app.databinding.FragmentRoomSingleBinding
|
|
||||||
import com.nnbc123.app.home.RoomSingleViewModel
|
|
||||||
import com.nnbc123.app.home.adapter.MoreSingleAnchorAdapter
|
|
||||||
import com.nnbc123.app.ui.utils.RVDelegate
|
|
||||||
import com.nnbc123.core.home.bean.HomeRoomInfo
|
|
||||||
import com.nnbc123.core.home.event.RefreshHomeDataEvent
|
|
||||||
import com.nnbc123.core.utils.CurrentTimeUtils
|
|
||||||
import org.greenrobot.eventbus.EventBus
|
|
||||||
import org.greenrobot.eventbus.Subscribe
|
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
|
||||||
|
|
||||||
|
|
||||||
class RoomSingleFragment : BaseViewBindingFragment<FragmentRoomSingleBinding>() {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun newInstance(id: Long?): RoomSingleFragment {
|
|
||||||
val args = Bundle()
|
|
||||||
if (id != null) {
|
|
||||||
args.putLong("id", id)
|
|
||||||
}
|
|
||||||
val fragment = RoomSingleFragment()
|
|
||||||
fragment.arguments = args
|
|
||||||
return fragment
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private lateinit var adapter: MoreSingleAnchorAdapter
|
|
||||||
private lateinit var rvDelegate: RVDelegate<HomeRoomInfo>
|
|
||||||
|
|
||||||
private val pageSize = Int.MAX_VALUE
|
|
||||||
private val roomSingleViewModel: RoomSingleViewModel by viewModels()
|
|
||||||
|
|
||||||
private var lastLoadDataTime = 0L
|
|
||||||
|
|
||||||
private val id: Long? by lazy { requireArguments().getLong("id") }
|
|
||||||
|
|
||||||
override fun init() {
|
|
||||||
adapter = MoreSingleAnchorAdapter()
|
|
||||||
rvDelegate = RVDelegate.Builder<HomeRoomInfo>()
|
|
||||||
.setAdapter(adapter)
|
|
||||||
.setRecyclerView(binding.recyclerView)
|
|
||||||
.setRefreshLayout(binding.refreshLayout)
|
|
||||||
.setEmptyView(EmptyViewHelper.createEmptyView(context, "暂无房间"))
|
|
||||||
.setLayoutManager(GridLayoutManager(mContext, 2))
|
|
||||||
.setPageSize(pageSize)
|
|
||||||
.build()
|
|
||||||
binding.refreshLayout.setOnRefreshListener { loadData(true) }
|
|
||||||
roomSingleViewModel.singleAnchorMoreLiveData.observe(this) {
|
|
||||||
rvDelegate.loadData(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
loadData(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun loadData(isForce: Boolean) {
|
|
||||||
if (!isForce && CurrentTimeUtils.getCurrentTime() - lastLoadDataTime < 15 * 1000) return
|
|
||||||
lastLoadDataTime = CurrentTimeUtils.getCurrentTime()
|
|
||||||
binding.refreshLayout.isRefreshing = true
|
|
||||||
roomSingleViewModel.getMoreSingleAnchorList(id)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
EventBus.getDefault().register(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
EventBus.getDefault().unregister(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
fun onRefreshHomeDataEvent(event: RefreshHomeDataEvent?) {
|
|
||||||
if (isResumed) loadData(false)
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,4 +1,4 @@
|
|||||||
package com.nnbc123.app.home.fragment
|
package com.nnbc123.app.home.fragment.home
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
@@ -23,7 +23,7 @@ import com.nnbc123.library.annatation.ActLayoutRes
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
@ActLayoutRes(R.layout.home_friends_fragment)
|
@ActLayoutRes(R.layout.home_friends_fragment)
|
||||||
class HomeFriendsFragment : BaseBindingFragment<HomeFriendsFragmentBinding>() {
|
class FriendsFragment : BaseBindingFragment<HomeFriendsFragmentBinding>() {
|
||||||
|
|
||||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ class HomeFriendsFragment : BaseBindingFragment<HomeFriendsFragmentBinding>() {
|
|||||||
}
|
}
|
||||||
childFragmentManager
|
childFragmentManager
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(R.id.fragment_container_view, HomeFriendsListFragment())
|
.replace(R.id.fragment_container_view, FriendsListFragment())
|
||||||
.commitAllowingStateLoss()
|
.commitAllowingStateLoss()
|
||||||
}
|
}
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package com.nnbc123.app.home.fragment
|
package com.nnbc123.app.home.fragment.home
|
||||||
|
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
@@ -18,7 +18,7 @@ import com.nnbc123.library.annatation.ActLayoutRes
|
|||||||
* Desc:
|
* Desc:
|
||||||
**/
|
**/
|
||||||
@ActLayoutRes(R.layout.home_friends_list_fragment)
|
@ActLayoutRes(R.layout.home_friends_list_fragment)
|
||||||
class HomeFriendsListFragment : BaseBindingFragment<HomeFriendsListFragmentBinding>() {
|
class FriendsListFragment : BaseBindingFragment<HomeFriendsListFragmentBinding>() {
|
||||||
private val adapter = HomeFriendsUserAdapter()
|
private val adapter = HomeFriendsUserAdapter()
|
||||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||||
override fun initiate() {
|
override fun initiate() {
|
@@ -1,4 +1,4 @@
|
|||||||
package com.nnbc123.app.home.fragment
|
package com.nnbc123.app.home.fragment.home
|
||||||
|
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
@@ -59,7 +59,7 @@ class HomeFragment : BaseBindingFragment<HomeFragmentBinding>() {
|
|||||||
|
|
||||||
private fun initTab() {
|
private fun initTab() {
|
||||||
val tagList = arrayListOf("派对", "交友")
|
val tagList = arrayListOf("派对", "交友")
|
||||||
val fragmentList = listOf(HomePartyFragment(), HomeFriendsFragment())
|
val fragmentList = listOf(PartyFragment(), FriendsFragment())
|
||||||
val commonNavigator = CommonNavigator(context)
|
val commonNavigator = CommonNavigator(context)
|
||||||
commonNavigator.setTitleWrapContent(true)
|
commonNavigator.setTitleWrapContent(true)
|
||||||
commonNavigator.setTitleGravity(Gravity.CENTER_VERTICAL)
|
commonNavigator.setTitleGravity(Gravity.CENTER_VERTICAL)
|
@@ -1,4 +1,4 @@
|
|||||||
package com.nnbc123.app.home.fragment
|
package com.nnbc123.app.home.fragment.home
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
@@ -31,7 +31,7 @@ import org.greenrobot.eventbus.ThreadMode
|
|||||||
* Desc:派对
|
* Desc:派对
|
||||||
**/
|
**/
|
||||||
@ActLayoutRes(R.layout.home_party_fragment)
|
@ActLayoutRes(R.layout.home_party_fragment)
|
||||||
class HomePartyFragment : BaseBindingFragment<HomePartyFragmentBinding>() {
|
class PartyFragment : BaseBindingFragment<HomePartyFragmentBinding>() {
|
||||||
|
|
||||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ class HomePartyFragment : BaseBindingFragment<HomePartyFragmentBinding>() {
|
|||||||
}
|
}
|
||||||
childFragmentManager
|
childFragmentManager
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(R.id.fragment_container_view, HomePartyHotRoomFragment())
|
.replace(R.id.fragment_container_view, PartyHotRoomFragment())
|
||||||
.commitAllowingStateLoss()
|
.commitAllowingStateLoss()
|
||||||
}
|
}
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package com.nnbc123.app.home.fragment
|
package com.nnbc123.app.home.fragment.home
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@@ -26,7 +26,7 @@ import org.greenrobot.eventbus.ThreadMode
|
|||||||
* Desc:
|
* Desc:
|
||||||
**/
|
**/
|
||||||
@ActLayoutRes(R.layout.home_party_room_fragment)
|
@ActLayoutRes(R.layout.home_party_room_fragment)
|
||||||
class HomePartyHotRoomFragment : BaseBindingFragment<HomePartyRoomFragmentBinding>() {
|
class PartyHotRoomFragment : BaseBindingFragment<HomePartyRoomFragmentBinding>() {
|
||||||
private val adapter = HomePartyRoomAdapter()
|
private val adapter = HomePartyRoomAdapter()
|
||||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||||
override fun initiate() {
|
override fun initiate() {
|
@@ -96,9 +96,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginStart="@dimen/dp_18"
|
android:layout_marginStart="@dimen/dp_18"
|
||||||
android:text="发现新朋友"
|
android:text="玩伴推荐"
|
||||||
android:textColor="#2B2D33"
|
android:textColor="#2B2D33"
|
||||||
android:textSize="@dimen/dp_16"
|
android:textSize="@dimen/dp_16"
|
||||||
|
android:textStyle="bold"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
@@ -1,56 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginStart="6dp"
|
|
||||||
android:layout_marginEnd="6dp"
|
|
||||||
tools:layout_height="150dp">
|
|
||||||
|
|
||||||
<com.makeramen.roundedimageview.RoundedImageView
|
|
||||||
android:id="@+id/iv_room_image"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginStart="2dp"
|
|
||||||
android:layout_marginTop="1dp"
|
|
||||||
android:src="@drawable/default_cover"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/tv_room_title"
|
|
||||||
app:layout_constraintDimensionRatio="1:1"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:riv_corner_radius="8dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/iv_room_tag"
|
|
||||||
android:layout_width="26dp"
|
|
||||||
android:layout_height="13dp"
|
|
||||||
android:background="@drawable/home_live_bg_recommend"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:text="推荐"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="8sp"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_room_title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="center"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="10dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/iv_room_image"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/iv_room_image"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_room_image"
|
|
||||||
tools:text="余生点余生点唱歌曲交友房间唱歌曲交友房间" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -1,129 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content"
|
|
||||||
android:layout_margin="6dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:layout_width="180dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_room_avatar"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintDimensionRatio="1:1"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_tag"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="@dimen/dp_18"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:src="@drawable/tag_101" />
|
|
||||||
|
|
||||||
<com.opensource.svgaplayer.SVGAImageView
|
|
||||||
android:id="@+id/iv_pking"
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="20dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/view_bg_bottom"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:background="@drawable/bg_single_anchor_more_bottom"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintDimensionRatio="334:110"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_room_name"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/dp_8"
|
|
||||||
android:layout_marginEnd="@dimen/dp_8"
|
|
||||||
android:layout_marginBottom="@dimen/dp_8"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:lines="1"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/sp_12"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
tools:text="交友厅官方交友厅交友厅官方交友厅" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_nickname"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="@dimen/dp_3"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:lines="1"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/sp_12"
|
|
||||||
app:layout_constrainedWidth="true"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/tv_room_name"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/iv_gender"
|
|
||||||
app:layout_constraintHorizontal_bias="0"
|
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/tv_room_name"
|
|
||||||
tools:text="交友厅官方交友厅交友厅官方交友厅" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_gender"
|
|
||||||
android:layout_width="14dp"
|
|
||||||
android:layout_height="14dp"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:src="@drawable/ic_gender_male"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/tv_nickname"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/tv_nickname"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/tv_nickname" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/ll_online"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:layout_marginEnd="6dp"
|
|
||||||
android:background="@drawable/shape_black_t40_12"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="@dimen/dp_10"
|
|
||||||
android:layout_height="@dimen/dp_10"
|
|
||||||
android:layout_marginLeft="@dimen/dp_7"
|
|
||||||
android:layout_marginTop="@dimen/dp_5"
|
|
||||||
android:layout_marginBottom="@dimen/dp_5"
|
|
||||||
android:src="@drawable/ic_singer_hot" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_online_num"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/dp_3"
|
|
||||||
android:layout_marginRight="@dimen/dp_10"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/sp_12"
|
|
||||||
tools:text="231人在聊" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -1,116 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout 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/ll_container"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="4dp"
|
|
||||||
android:layout_marginEnd="4dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:layout_width="100dp">
|
|
||||||
|
|
||||||
<com.nnbc123.app.ui.widget.SquareLayout
|
|
||||||
android:id="@+id/square_layout"
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
<com.makeramen.roundedimageview.RoundedImageView
|
|
||||||
android:id="@+id/iv_cover"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:src="@drawable/default_cover"
|
|
||||||
app:riv_corner_radius_bottom_left="12dp"
|
|
||||||
app:riv_corner_radius_bottom_right="12dp"
|
|
||||||
app:riv_corner_radius_top_left="12dp"
|
|
||||||
app:riv_corner_radius_top_right="12dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_online_number"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginStart="2dp"
|
|
||||||
android:layout_marginBottom="2dp"
|
|
||||||
android:background="@drawable/shape_item_room_online_member"
|
|
||||||
android:drawableStart="@drawable/ic_home_online_tag"
|
|
||||||
android:gravity="center"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:paddingStart="4dp"
|
|
||||||
android:paddingEnd="4dp"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="10sp"
|
|
||||||
tools:text="100" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_tab_label"
|
|
||||||
android:layout_width="43dp"
|
|
||||||
android:layout_height="18dp"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@mipmap/ic_bg_home_room_tag"
|
|
||||||
android:visibility="invisible"
|
|
||||||
tools:visibility="gone" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_tag_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="18dp"
|
|
||||||
android:background="@drawable/shape_home_room_tag"
|
|
||||||
android:gravity="center"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:maxLength="5"
|
|
||||||
android:paddingStart="10dp"
|
|
||||||
android:paddingEnd="10dp"
|
|
||||||
android:text="我是"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="11dp"
|
|
||||||
android:visibility="invisible"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_tag_in_pk"
|
|
||||||
android:layout_width="46dp"
|
|
||||||
android:layout_height="18dp"
|
|
||||||
android:background="@drawable/bg_room_pk_tag"
|
|
||||||
android:gravity="center"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:text="PK中"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="11dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
</com.nnbc123.app.ui.widget.SquareLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:background="@drawable/shape_room_title_bg"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintDimensionRatio="200:68"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/dp_8"
|
|
||||||
android:layout_marginEnd="@dimen/dp_8"
|
|
||||||
android:layout_marginBottom="4dp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="center"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="12dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
tools:text="房间名称房间名称房间名称" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
Reference in New Issue
Block a user