[Modify]热门推荐修改
This commit is contained in:
@@ -19,6 +19,7 @@ import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.databinding.FragmentHomeBinding
|
||||
import com.yizhuan.erban.home.HomeViewModel
|
||||
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.webview.CommonWebViewActivity
|
||||
@@ -54,7 +55,21 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
onGetHomeTagSuccess(it)
|
||||
}
|
||||
}
|
||||
homeViewModel.bannerLiveData.observe(this) {
|
||||
it?.let {
|
||||
BannerHelper.setBanner(binding.rollView, it) { _, _ ->
|
||||
//首页_banner
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SIX),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
homeViewModel.getTagInfo()
|
||||
homeViewModel.getBannerInfo()
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
|
@@ -43,47 +43,12 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
|
||||
//是否需要刷新接口进行屏蔽房间操作
|
||||
private var isShield = false
|
||||
|
||||
private var mRecommendBanner: BannerViewPager<HomeTabMapInfo>? = null
|
||||
|
||||
override fun init() {
|
||||
mRecommendBanner = view?.findViewById(R.id.mRecommendBanner)
|
||||
initRefreshView()
|
||||
initChatTab()
|
||||
initHotRoomTab()
|
||||
showGameGuide()
|
||||
|
||||
homeViewModel.tabHomeLiveData.observe(this) {
|
||||
it?.let {
|
||||
if (ListUtils.isListEmpty(it)) {
|
||||
mRecommendBanner?.visibility = View.GONE
|
||||
return@observe
|
||||
} else {
|
||||
mRecommendBanner?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
val roomsList: List<HomeTabMapInfo> = ArrayList(it)
|
||||
|
||||
for (i in roomsList.indices) {
|
||||
roomsList[i].itemType = HomeTabMapInfo.TYPE_NORMAL //对原始数据设置type
|
||||
}
|
||||
refreshRoomData(roomsList)
|
||||
}
|
||||
}
|
||||
|
||||
homeViewModel.bannerLiveData.observe(this) {
|
||||
it?.let {
|
||||
BannerHelper.setBanner(binding.rollView, it) { _, _ ->
|
||||
//首页_banner
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SIX),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.ivGameGuide.setOnClickListener {
|
||||
//首页_扩列聊天-创建游戏房
|
||||
ReportManager.get().reportEvent(
|
||||
@@ -174,52 +139,6 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新数据
|
||||
*/
|
||||
private fun refreshRoomData(roomList: List<HomeTabMapInfo>) {
|
||||
mRecommendBanner?.adapter = HomeTopAdapter()
|
||||
mRecommendBanner?.post {
|
||||
val width =
|
||||
UIUtil.getScreenWidth(mContext) - UIUtil.dip2px(mContext, 10.0) * 3
|
||||
val revealWidth = width / 3
|
||||
val bannerLayoutParams = mRecommendBanner?.layoutParams
|
||||
bannerLayoutParams?.height = revealWidth + UIUtil.dip2px(mContext, 32.0)
|
||||
mRecommendBanner?.layoutParams = bannerLayoutParams
|
||||
setupBanner(
|
||||
revealWidth,
|
||||
revealWidth,
|
||||
roomList
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupBanner(
|
||||
leftRevealWidth: Int,
|
||||
rightRevealWidth: Int,
|
||||
list: List<HomeTabMapInfo>
|
||||
) {
|
||||
mRecommendBanner?.apply {
|
||||
setLifecycleRegistry(lifecycle)
|
||||
setPageMargin(UIUtil.dip2px(mContext, 10.0))
|
||||
setScrollDuration(800)
|
||||
setRevealWidth(leftRevealWidth, rightRevealWidth)
|
||||
setOnPageClickListener { _: View?, position: Int ->
|
||||
//首页_热门房间
|
||||
val map = HashMap<String, Any>(3)
|
||||
map[IReportConstants.HOMEPAGE_TYPE] = IReportConstants.FIVE
|
||||
map[IReportConstants.MODULE] = IReportConstants.PEKO_HOMEPAGE
|
||||
ReportManager.get().reportEvent(IReportConstants.MODULE_HOMEPAGE_CLICK, map)
|
||||
AVRoomActivity.startForFromType(
|
||||
mContext,
|
||||
list[position].roomUid.toLong(),
|
||||
AVRoomActivity.FROM_TYPE_RECOMMEND
|
||||
)
|
||||
}
|
||||
create(list)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLazyLoad() {
|
||||
super.onLazyLoad()
|
||||
loadData()
|
||||
@@ -234,8 +153,6 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
|
||||
}
|
||||
|
||||
private fun loadData() {
|
||||
homeViewModel.getBannerInfo()
|
||||
homeViewModel.getHomeTabName()
|
||||
homeViewModel.getHomePlayV2()
|
||||
homeViewModel.getHotRoom()
|
||||
}
|
||||
|
@@ -123,7 +123,7 @@ public class RollPagerView extends RelativeLayout implements OnPageChangeListene
|
||||
mViewPager.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
addView(mViewPager);
|
||||
type.recycle();
|
||||
initHint(new ColorPointHintView(getContext(), Color.parseColor("#E3AC42"), Color.parseColor("#88ffffff")));
|
||||
initHint(new ColorPointHintView(getContext(), Color.parseColor("#9168FA"), Color.parseColor("#99B3B3C3")));
|
||||
//手势处理
|
||||
mGestureDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() {
|
||||
@Override
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/bg_accompany.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_accompany.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
app/src/main/res/drawable-xhdpi/bg_heartbeat.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_heartbeat.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
@@ -3,6 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@color/bg_normal_1c1b22">
|
||||
|
||||
<View
|
||||
@@ -22,24 +23,25 @@
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="40dp"
|
||||
android:paddingBottom="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_12"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
<com.coorchice.library.SuperTextView
|
||||
android:id="@+id/iv_search"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_36"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_80ffffff_r16"
|
||||
android:drawablePadding="@dimen/dp_8"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="@dimen/dp_13"
|
||||
android:paddingEnd="0dp"
|
||||
android:text="@string/search_id_room"
|
||||
android:textColor="@color/color_B8B7C7"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:drawablePadding="@dimen/dp_8"
|
||||
app:solid="@color/color_FAFBFC"
|
||||
app:corner="@dimen/dp_16"
|
||||
app:drawableStartCompat="@drawable/ic_home_search" />
|
||||
|
||||
<ImageView
|
||||
@@ -64,6 +66,110 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:paddingStart="@dimen/dp_14"
|
||||
android:paddingEnd="@dimen/dp_14"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_heartbeat"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="90dp"
|
||||
android:background="@drawable/bg_heartbeat"
|
||||
app:layout_constraintEnd_toStartOf="@+id/iv_accompany"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_heartbeat"
|
||||
android:text="@string/heartbeat_love"
|
||||
android:textSize="@dimen/sp_18"
|
||||
android:textColor="@color/color_white"
|
||||
android:includeFontPadding="false"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_heartbeat"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:text="@string/level_goddess_gathering_place"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textColor="@color/white_transparent_80"
|
||||
android:includeFontPadding="false"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_heartbeat"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_heartbeat"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_accompany"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="90dp"
|
||||
android:background="@drawable/bg_accompany"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_heartbeat"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_accompany"
|
||||
android:text="@string/accompany_and_make_friends"
|
||||
android:textSize="@dimen/sp_18"
|
||||
android:textColor="@color/color_white"
|
||||
android:includeFontPadding="false"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_accompany"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:text="@string/interesting_people_are_here"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textColor="@color/white_transparent_80"
|
||||
android:includeFontPadding="false"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_accompany"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_heartbeat"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.yizhuan.erban.ui.widget.viewpager.ScrollViewPager
|
||||
android:id="@+id/roll_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:layout_marginBottom="@dimen/dp_2"
|
||||
android:visibility="gone"
|
||||
app:rollviewpager_hint_mode="number"
|
||||
app:rollviewpager_hint_gravity="center"
|
||||
app:rollviewpager_hint_paddingBottom="8dp"
|
||||
app:rollviewpager_hint_color="@color/color_9168FA"
|
||||
tools:visibility="visible"
|
||||
app:layout_constraintDimensionRatio="345:80"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator
|
||||
android:id="@+id/magic_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -27,40 +27,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.zhpan.bannerview.BannerViewPager
|
||||
android:id="@+id/mRecommendBanner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="140dp"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_15"
|
||||
app:bvp_can_loop="true"
|
||||
app:bvp_auto_play="true"
|
||||
app:bvp_indicator_visibility="gone"
|
||||
app:bvp_page_style="multi_page_scale" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.yizhuan.erban.ui.widget.viewpager.ScrollViewPager
|
||||
android:id="@+id/roll_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:visibility="gone"
|
||||
app:rollviewpager_hint_gravity="left"
|
||||
app:rollviewpager_hint_paddingBottom="8dp"
|
||||
tools:visibility="gone"
|
||||
app:layout_constraintDimensionRatio="690:160"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@@ -677,5 +677,6 @@
|
||||
<color name="color_F5F6FA">#F5F6FA</color>
|
||||
<color name="color_1abbbccf">#1abbbccf</color>
|
||||
<color name="color_B8B7C7">#B8B7C7</color>
|
||||
<color name="color_FAFBFC">#FAFBFC</color>
|
||||
|
||||
</resources>
|
||||
|
@@ -5117,5 +5117,9 @@
|
||||
<string name="set_login_password_tip">為了方便您下次登錄,請先設置登錄密碼</string>
|
||||
<string name="last_login">上次登錄</string>
|
||||
<string name="finish">完成</string>
|
||||
<string name="heartbeat_love">心動戀愛</string>
|
||||
<string name="level_goddess_gathering_place">顏值女神聚集地</string>
|
||||
<string name="accompany_and_make_friends">陪伴交友</string>
|
||||
<string name="interesting_people_are_here">有趣的人都在這</string>
|
||||
|
||||
</resources>
|
Reference in New Issue
Block a user