[Modify]优质陪伴页面修改
This commit is contained in:
@@ -10,6 +10,7 @@ import com.yizhuan.xchat_android_core.home.bean.HomeTabMapInfo
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeTagInfo
|
||||
import com.yizhuan.xchat_android_core.home.model.HomeModel
|
||||
import com.yizhuan.xchat_android_core.room.bean.AnchorInfo
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
@@ -52,6 +53,9 @@ class HomeViewModel : BaseViewModel() {
|
||||
private val _homeHotRoomLiveData = MutableLiveData<List<HomeRoomInfo>?>()
|
||||
val homeHotRoomLiveData: LiveData<List<HomeRoomInfo>?> = _homeHotRoomLiveData
|
||||
|
||||
private val _newFriendLiveData = MutableLiveData<ListResult<UserInfo>>()
|
||||
val newFriendLiveData: LiveData<ListResult<UserInfo>> = _newFriendLiveData
|
||||
|
||||
fun getHomeTabName() {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
@@ -185,4 +189,16 @@ class HomeViewModel : BaseViewModel() {
|
||||
)
|
||||
}
|
||||
|
||||
fun getNewFriendList(gender: Int? = null) {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_newFriendLiveData.value = ListResult.failed(1)
|
||||
},
|
||||
block = {
|
||||
val result = HomeModel.getNewFriendList(gender)
|
||||
_newFriendLiveData.value = ListResult.success(result, 1)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
package com.yizhuan.erban.home.adapter
|
||||
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
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.yizhuan.erban.R
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity
|
||||
import com.yizhuan.erban.ui.user.activity.UserInfoActivity
|
||||
import com.yizhuan.erban.ui.utils.loadAvatar
|
||||
import com.yizhuan.erban.ui.utils.loadFromAssets
|
||||
import com.yizhuan.erban.vip.util.VipHelper
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
|
||||
import com.yizhuan.xchat_android_core.utils.StarUtils
|
||||
import com.yizhuan.xchat_android_core.utils.ifNullOrEmpty
|
||||
import java.util.*
|
||||
|
||||
class RoomNewFriendsAdapter :
|
||||
BaseQuickAdapter<UserInfo, BaseViewHolder>(R.layout.item_room_new_friends) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: UserInfo) {
|
||||
helper.getView<ImageView>(R.id.iv_avatar).loadAvatar(item.avatar)
|
||||
helper.setText(R.id.tv_desc, item.userDesc.ifNullOrEmpty { "我是个默认签名" })
|
||||
.setText(
|
||||
R.id.tv_age,
|
||||
((CurrentTimeUtils.getCurrentTime() - item.birth) / 1000 / 60 / 60 / 24 / 365).toString()
|
||||
)
|
||||
//设置星座
|
||||
val star = StarUtils.getConstellation(Date(item.birth))
|
||||
helper.setGone(R.id.tv_constellation, star != null)
|
||||
.setText(R.id.tv_constellation, star)
|
||||
helper.setBackgroundRes(
|
||||
R.id.ll_gender_age,
|
||||
if (item.gender == 1) R.drawable.shape_65d3f7_corner else R.drawable.shape_ff9cce_corner
|
||||
)
|
||||
helper.setImageResource(
|
||||
R.id.iv_gender,
|
||||
if (item.gender == 1) R.drawable.ic_home_man else R.drawable.ic_home_woman
|
||||
)
|
||||
val tvOnlineText = helper.getView<TextView>(R.id.tv_online_text)
|
||||
val ivTalk = helper.getView<AppCompatImageView>(R.id.iv_talk)
|
||||
val svgaLiving = helper.getView<SVGAImageView>(R.id.svga_living)
|
||||
val llOnline = helper.getView<View>(R.id.ll_online)
|
||||
val viewOnline = helper.getView<View>(R.id.view_online)
|
||||
|
||||
if (item.inRoomUid != 0L) {
|
||||
ivTalk.isVisible = false
|
||||
svgaLiving.isVisible = true
|
||||
viewOnline.isVisible = true
|
||||
svgaLiving.loadFromAssets("svga/home_living.svga")
|
||||
tvOnlineText.text = "直播中"
|
||||
llOnline.setOnClickListener {
|
||||
AVRoomActivity.start(mContext, item.inRoomUid)
|
||||
}
|
||||
} else {
|
||||
ivTalk.isVisible = true
|
||||
svgaLiving.isVisible = false
|
||||
viewOnline.isVisible = false
|
||||
tvOnlineText.text = "和TA聊"
|
||||
llOnline.setOnClickListener {
|
||||
NimP2PMessageActivity.start(mContext, item.uid.toString())
|
||||
}
|
||||
}
|
||||
|
||||
helper.getView<View>(R.id.iv_avatar).setOnClickListener {
|
||||
UserInfoActivity.Companion.start(mContext, item.uid)
|
||||
}
|
||||
|
||||
val tvNickname = helper.getView<TextView>(R.id.tv_nickname)
|
||||
tvNickname.text = item.nick
|
||||
VipHelper.loadVipNickColor(tvNickname, item.userVipInfoVO, "#282828")
|
||||
VipHelper.loadVipIcon(helper.getView(R.id.iv_vip_icon), item.userVipInfoVO)
|
||||
}
|
||||
|
||||
override fun onViewAttachedToWindow(holder: BaseViewHolder) {
|
||||
super.onViewAttachedToWindow(holder)
|
||||
val svgaLiving = holder.getView<SVGAImageView>(R.id.svga_living)
|
||||
svgaLiving?.loadFromAssets("svga/home_living.svga")
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -3,31 +3,27 @@ package com.yizhuan.erban.home.fragment
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.application.IReportConstants
|
||||
import com.yizhuan.erban.application.ReportManager
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.avroom.dialog.CreateRoomDialog
|
||||
import com.yizhuan.erban.base.BaseActivity
|
||||
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.databinding.FragmentAccompanyBinding
|
||||
import com.yizhuan.erban.databinding.FragmentRecommendBinding
|
||||
import com.yizhuan.erban.home.HomeViewModel
|
||||
import com.yizhuan.erban.home.adapter.HomeChatAdapter
|
||||
import com.yizhuan.erban.home.adapter.HomeHotAdapter
|
||||
import com.yizhuan.erban.home.adapter.HomeTopAdapter
|
||||
import com.yizhuan.erban.home.helper.BannerHelper
|
||||
import com.yizhuan.erban.home.adapter.RoomNewFriendsAdapter
|
||||
import com.yizhuan.erban.home.helper.OpenRoomHelper
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeTabMapInfo
|
||||
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent
|
||||
import com.yizhuan.xchat_android_core.room.event.RoomShieldEvent
|
||||
import com.yizhuan.xchat_android_core.user.UserModel
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||
import com.yizhuan.xchat_android_core.user.event.LoginUserInfoUpdateEvent
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils
|
||||
import com.zhpan.bannerview.BannerViewPager
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -37,10 +33,12 @@ import org.greenrobot.eventbus.ThreadMode
|
||||
*/
|
||||
class AccompanyFragment : BaseViewBindingFragment<FragmentAccompanyBinding>() {
|
||||
private lateinit var charAdapter: HomeChatAdapter
|
||||
private lateinit var roomHotAdapter: HomeHotAdapter
|
||||
private lateinit var roomNewFriendsAdapter: RoomNewFriendsAdapter
|
||||
|
||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||
|
||||
private lateinit var rvDelegate: RVDelegate<UserInfo>
|
||||
|
||||
//是否需要刷新接口进行屏蔽房间操作
|
||||
private var isShield = false
|
||||
|
||||
@@ -117,26 +115,15 @@ class AccompanyFragment : BaseViewBindingFragment<FragmentAccompanyBinding>() {
|
||||
}
|
||||
|
||||
private fun initHotRoomTab() {
|
||||
roomHotAdapter = HomeHotAdapter()
|
||||
roomHotAdapter.onItemClickListener =
|
||||
BaseQuickAdapter.OnItemClickListener { _: BaseQuickAdapter<*, *>?, _: View?, position: Int ->
|
||||
val homePlayInfo: HomeRoomInfo? = roomHotAdapter.getItem(position)
|
||||
if (homePlayInfo != null) {
|
||||
//首页_房间派对
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.TEN),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
AVRoomActivity.start(mContext, homePlayInfo.uid)
|
||||
}
|
||||
}
|
||||
binding.mRecyclerRoom.adapter = roomHotAdapter
|
||||
homeViewModel.homeHotRoomLiveData.observe(this) {
|
||||
it?.let {
|
||||
roomHotAdapter.setNewData(it)
|
||||
}
|
||||
roomNewFriendsAdapter = RoomNewFriendsAdapter()
|
||||
rvDelegate = RVDelegate.Builder<UserInfo>()
|
||||
.setAdapter(roomNewFriendsAdapter)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setEmptyView(EmptyViewHelper.createEmptyTextView(context, "暂无新朋友"))
|
||||
.setLayoutManager(LinearLayoutManager(mContext))
|
||||
.build()
|
||||
homeViewModel.newFriendLiveData.observe(this) {
|
||||
rvDelegate.loadData(it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +142,7 @@ class AccompanyFragment : BaseViewBindingFragment<FragmentAccompanyBinding>() {
|
||||
|
||||
private fun loadData() {
|
||||
homeViewModel.getHomePlayV2()
|
||||
homeViewModel.getHotRoom()
|
||||
homeViewModel.getNewFriendList()
|
||||
}
|
||||
|
||||
private fun showGameGuide(){
|
||||
|
@@ -17,6 +17,8 @@ import com.yizhuan.erban.home.adapter.PartyMagicIndicatorAdapter
|
||||
import com.yizhuan.erban.home.helper.BannerHelper
|
||||
import com.yizhuan.erban.home.helper.OpenRoomHelper
|
||||
import com.yizhuan.erban.ui.search.SearchActivity
|
||||
import com.yizhuan.erban.ui.user.adapter.MainIndicatorAdapter
|
||||
import com.yizhuan.erban.ui.user.adapter.UserInfoIndicatorAdapter
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.ViewPagerHelper
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
@@ -29,7 +31,7 @@ import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
* Peko首页
|
||||
*/
|
||||
class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClickListener,
|
||||
PartyMagicIndicatorAdapter.OnItemSelectListener {
|
||||
MainIndicatorAdapter.OnItemSelectListener {
|
||||
|
||||
private val mFragments = mutableListOf<Class<out Fragment>>()
|
||||
private val mTabInfoList = mutableListOf<HomeTagInfo>()
|
||||
@@ -128,8 +130,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
commonNavigator.setTitleWrapContent(false)
|
||||
commonNavigator.titleMargin = ScreenUtil.dip2px(2.0F)
|
||||
commonNavigator.setTitleGravity(Gravity.CENTER_VERTICAL)
|
||||
val magicIndicatorAdapter = PartyMagicIndicatorAdapter(mTabInfoList.map { it.name })
|
||||
magicIndicatorAdapter.textSize = 14
|
||||
val magicIndicatorAdapter = MainIndicatorAdapter(context, mTabInfoList.map { it.name })
|
||||
magicIndicatorAdapter.setOnItemSelectListener(this)
|
||||
commonNavigator.adapter = magicIndicatorAdapter
|
||||
binding.magicIndicator.navigator = commonNavigator
|
||||
|
@@ -0,0 +1,105 @@
|
||||
package com.yizhuan.erban.ui.user.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.widget.XRecyclerView.ScaleTransitionPagerTitleView;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.indicators.GradientLinePagerIndicator;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MainIndicatorAdapter extends CommonNavigatorAdapter {
|
||||
private final Context mContext;
|
||||
private final List<? extends CharSequence> mTitleList;
|
||||
|
||||
private int textSize = 16;
|
||||
private float minScale = 0.88f;
|
||||
private boolean showIndicator = true;
|
||||
private OnItemSelectListener mOnItemSelectListener;
|
||||
|
||||
public MainIndicatorAdapter(Context context, List<? extends CharSequence> charSequences) {
|
||||
this.mContext = context;
|
||||
this.mTitleList = charSequences;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mTitleList == null ? 0 : mTitleList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPagerTitleView getTitleView(Context context, final int i) {
|
||||
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context, true);
|
||||
scaleTransitionPagerTitleView.setNormalColor(ContextCompat.getColor(context, R.color.color_767585));
|
||||
scaleTransitionPagerTitleView.setSelectedColor(ContextCompat.getColor(context, R.color.color_1F1A4E));
|
||||
scaleTransitionPagerTitleView.setMinScale(minScale);
|
||||
scaleTransitionPagerTitleView.setTextSize(textSize);
|
||||
int padding = UIUtil.dip2px(context, 12);
|
||||
scaleTransitionPagerTitleView.setPadding(padding, 0, padding, 0);
|
||||
scaleTransitionPagerTitleView.setText(mTitleList.get(i));
|
||||
scaleTransitionPagerTitleView.setOnClickListener(view -> {
|
||||
if (mOnItemSelectListener != null) {
|
||||
mOnItemSelectListener.onItemSelect(i, scaleTransitionPagerTitleView);
|
||||
}
|
||||
|
||||
});
|
||||
return scaleTransitionPagerTitleView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPagerIndicator getIndicator(Context context) {
|
||||
if (!showIndicator) return null;
|
||||
GradientLinePagerIndicator indicator = new GradientLinePagerIndicator(context);
|
||||
indicator.setMode(LinePagerIndicator.MODE_WRAP_CONTENT);
|
||||
indicator.setLineHeight(UIUtil.dip2px(mContext, 8));
|
||||
indicator.setRoundRadius(UIUtil.dip2px(mContext, 5));
|
||||
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
lp.gravity = Gravity.END;
|
||||
lp.bottomMargin = UIUtil.dip2px(mContext, 0);
|
||||
indicator.setLayoutParams(lp);
|
||||
return indicator;
|
||||
}
|
||||
|
||||
public int getTextSize() {
|
||||
return textSize;
|
||||
}
|
||||
|
||||
public void setTextSize(int textSize) {
|
||||
this.textSize = textSize;
|
||||
}
|
||||
|
||||
public float getMinScale() {
|
||||
return minScale;
|
||||
}
|
||||
|
||||
public void setMinScale(float minScale) {
|
||||
this.minScale = minScale;
|
||||
}
|
||||
|
||||
public boolean isShowIndicator() {
|
||||
return showIndicator;
|
||||
}
|
||||
|
||||
public void setShowIndicator(boolean showIndicator) {
|
||||
this.showIndicator = showIndicator;
|
||||
}
|
||||
|
||||
public void setOnItemSelectListener(OnItemSelectListener onItemSelectListener) {
|
||||
mOnItemSelectListener = onItemSelectListener;
|
||||
}
|
||||
|
||||
public interface OnItemSelectListener {
|
||||
void onItemSelect(int position, TextView view);
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-xhdpi/ic_home_man.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_home_man.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 438 B |
BIN
app/src/main/res/drawable-xhdpi/ic_home_woman.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_home_woman.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 433 B |
BIN
app/src/main/res/drawable-xhdpi/ic_new_friends_msg.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_new_friends_msg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 979 B |
10
app/src/main/res/drawable/bg_f5f6fa_anomaly.xml
Normal file
10
app/src/main/res/drawable/bg_f5f6fa_anomaly.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#fff5f6fa" />
|
||||
<corners
|
||||
android:bottomLeftRadius="100dp"
|
||||
android:bottomRightRadius="100dp"
|
||||
android:topLeftRadius="0dp"
|
||||
android:topRightRadius="100dp" />
|
||||
</shape>
|
5
app/src/main/res/drawable/shape_65d3f7_corner.xml
Normal file
5
app/src/main/res/drawable/shape_65d3f7_corner.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="100dp" />
|
||||
<solid android:color="#65D3F7" />
|
||||
</shape>
|
5
app/src/main/res/drawable/shape_f6f7f9_corner.xml
Normal file
5
app/src/main/res/drawable/shape_f6f7f9_corner.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="100dp" />
|
||||
<solid android:color="#F6F7F9" />
|
||||
</shape>
|
5
app/src/main/res/drawable/shape_ff9cce_corner.xml
Normal file
5
app/src/main/res/drawable/shape_ff9cce_corner.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="100dp" />
|
||||
<solid android:color="#FF9CCE" />
|
||||
</shape>
|
8
app/src/main/res/drawable/shape_home_online.xml
Normal file
8
app/src/main/res/drawable/shape_home_online.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/white" />
|
||||
<solid android:color="#ff6ce19a" />
|
||||
</shape>
|
10
app/src/main/res/drawable/shape_room_new_friends_bg.xml
Normal file
10
app/src/main/res/drawable/shape_room_new_friends_bg.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#ffffffff" />
|
||||
|
||||
<corners android:radius="14dp" />
|
||||
|
||||
</shape>
|
||||
|
@@ -87,14 +87,12 @@
|
||||
</LinearLayout>
|
||||
|
||||
<com.yizhuan.xchat_android_library.common.widget.VpRecyclerView
|
||||
android:id="@+id/mRecyclerRoom"
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:spanCount="2"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" />
|
||||
android:scrollbars="none" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
164
app/src/main/res/layout/item_room_new_friends.xml
Normal file
164
app/src/main/res/layout/item_room_new_friends.xml
Normal file
@@ -0,0 +1,164 @@
|
||||
<?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="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_8">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/shape_room_new_friends_bg"
|
||||
app:layout_constraintDimensionRatio="335:93"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_marginStart="@dimen/dp_14"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_online"
|
||||
android:layout_width="@dimen/dp_11"
|
||||
android:layout_height="@dimen/dp_11"
|
||||
android:layout_marginBottom="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:background="@drawable/shape_home_online"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_avatar" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_nickname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg"
|
||||
tools:text="余生点唱歌曲" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_gender_age"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="@drawable/shape_ff9cce_corner"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_nickname"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_nickname"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_nickname">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gender"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:src="@drawable/ic_home_woman" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_age"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_11"
|
||||
tools:text="22" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_vip_icon"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginStart="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_nickname"
|
||||
app:layout_constraintStart_toEndOf="@id/ll_gender_age"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_nickname" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_constellation"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:background="@drawable/shape_f6f7f9_corner"
|
||||
android:gravity="center"
|
||||
android:textColor="#ffb3b5c4"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_nickname"
|
||||
tools:text="巨蟹座" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_24"
|
||||
android:layout_marginTop="6dp"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:text="一起来玩呀"
|
||||
android:textColor="@color/color_8A8CAB"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:paddingStart="@dimen/dp_10"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
android:paddingTop="@dimen/dp_6"
|
||||
android:paddingBottom="@dimen/dp_6"
|
||||
android:background="@drawable/bg_f5f6fa_anomaly"
|
||||
app:layout_constraintEnd_toStartOf="@id/ll_online"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_constellation" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_online"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_14"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_talk"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:src="@drawable/ic_new_friends_msg"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_living"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_online_text"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="直播中"
|
||||
android:textColor="#ffbdbfd0"
|
||||
android:textSize="@dimen/sp_11" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -678,5 +678,6 @@
|
||||
<color name="color_1abbbccf">#1abbbccf</color>
|
||||
<color name="color_B8B7C7">#B8B7C7</color>
|
||||
<color name="color_FAFBFC">#FAFBFC</color>
|
||||
<color name="color_767585">#767585</color>
|
||||
|
||||
</resources>
|
||||
|
@@ -226,6 +226,11 @@ object HomeModel : BaseModel() {
|
||||
api.apiHomePlayV2()
|
||||
}
|
||||
|
||||
suspend fun getNewFriendList(gender: Int?): List<UserInfo>? =
|
||||
launchRequest {
|
||||
api.getNewFriendList(gender)
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
/**
|
||||
* 提交反馈
|
||||
@@ -488,6 +493,14 @@ object HomeModel : BaseModel() {
|
||||
@Query("pageSize") pageSize: Int?
|
||||
): ServiceResult<List<DiamondGiveHistoryInfo>>
|
||||
|
||||
/**
|
||||
* 发现新朋友
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/home/newFriend")
|
||||
suspend fun getNewFriendList(@Query("gender") gender: Int?): ServiceResult<List<UserInfo>>
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -311,6 +311,8 @@ public class UserInfo implements Serializable {
|
||||
@Setter
|
||||
private List<String> labels;
|
||||
|
||||
private long inRoomUid;
|
||||
|
||||
public UserInfo() {
|
||||
|
||||
}
|
||||
@@ -616,6 +618,14 @@ public class UserInfo implements Serializable {
|
||||
this.userHeadwear = userHeadwear;
|
||||
}
|
||||
|
||||
public long getInRoomUid() {
|
||||
return inRoomUid;
|
||||
}
|
||||
|
||||
public void setInRoomUid(long inRoomUid) {
|
||||
this.inRoomUid = inRoomUid;
|
||||
}
|
||||
|
||||
public Map<String, Object> toMap(@Nullable Map<String, Object> map, UserInfo userInfo) {
|
||||
if (map == null) {
|
||||
map = new HashMap<>();
|
||||
|
@@ -54,16 +54,11 @@ class VpRecyclerView(context: Context, attrs: AttributeSet?) : RecyclerView(cont
|
||||
//return true如果视图可以按指定的方向滚动,否则为false。
|
||||
//既然是上下滑动,此时,父控件就不能有 事件 true停止
|
||||
parent.requestDisallowInterceptTouchEvent(true)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> parent.requestDisallowInterceptTouchEvent(false)
|
||||
}
|
||||
|
||||
|
||||
return super.dispatchTouchEvent(ev)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user