feat:恢复房间部分功能(小时榜、房间榜)
This commit is contained in:
@@ -17,6 +17,7 @@ import com.chwl.app.avroom.adapter.OnMicroItemClickListener
|
||||
import com.chwl.app.avroom.game.GameDelegate
|
||||
import com.chwl.app.avroom.game.OnGameStatusChangeListener
|
||||
import com.chwl.app.avroom.presenter.GameRoomPresenter
|
||||
import com.chwl.app.avroom.rank.RoomRankWidget
|
||||
import com.chwl.app.avroom.view.IGameRoomView
|
||||
import com.chwl.app.databinding.FragmentGameRoomBinding
|
||||
import com.chwl.app.ui.widget.GiftDialog.OnGiftDialogBtnClickListener
|
||||
@@ -69,6 +70,7 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
||||
AvRoomDataManager.get().mCurrentRoomInfo?.mgId
|
||||
)
|
||||
gameDelegate.setOnGameStatusChangeListener(this)
|
||||
gameBinding.rankWidget.setContentBackgroundResource(R.drawable.room_rank_widget_bg_game)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -210,5 +212,6 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
||||
|
||||
override fun initWidget() {
|
||||
super.initWidget()
|
||||
registerWidget(RoomRankWidget::class.java.simpleName, gameBinding.rankWidget)
|
||||
}
|
||||
}
|
@@ -10,7 +10,9 @@ import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.chwl.app.avroom.gameplay.RoomGameplayListWidget;
|
||||
import com.chwl.app.avroom.gameplay.RoomGameplayWidget;
|
||||
import com.chwl.app.avroom.rank.RoomRankWidget;
|
||||
import com.chwl.app.music.widget.MusicPlayerView;
|
||||
import com.chwl.app.ui.webview.DialogWebViewActivity;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.trello.rxlifecycle3.android.FragmentEvent;
|
||||
import com.chwl.app.R;
|
||||
@@ -133,6 +135,7 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
@Override
|
||||
public void initWidget() {
|
||||
super.initWidget();
|
||||
registerWidget(RoomRankWidget.class.getSimpleName(), gameBinding.rankWidget);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -586,6 +589,12 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
getMvpPresenter().cancelDragon();
|
||||
});
|
||||
break;
|
||||
case R.id.layout_hour_rank:
|
||||
DialogWebViewActivity.start(
|
||||
mContext,
|
||||
UriProvider.getRoomHourRankUrl(AvRoomDataManager.get().getRoomUid())
|
||||
);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -774,6 +783,11 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
if (AvRoomDataManager.get().mCurrentRoomInfo == null) {
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().mCurrentRoomInfo.getIsPermitRoom() == 1) {
|
||||
gameBinding.layoutHourRank.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
gameBinding.layoutHourRank.setVisibility(View.GONE);
|
||||
}
|
||||
setDragonView();
|
||||
}
|
||||
|
||||
|
@@ -14,12 +14,15 @@ import com.chwl.app.avroom.dialog.RequestUpMicDialog
|
||||
import com.chwl.app.avroom.gameplay.RoomGameplayListWidget
|
||||
import com.chwl.app.avroom.gameplay.RoomGameplayWidget
|
||||
import com.chwl.app.avroom.presenter.SingleRoomPresenter
|
||||
import com.chwl.app.avroom.rank.RoomRankWidget
|
||||
import com.chwl.app.avroom.singleroompk.SingleRoomPkFinishDialog
|
||||
import com.chwl.app.avroom.singleroompk.SingleRoomPkForceFinishDialog
|
||||
import com.chwl.app.avroom.singleroompk.SingleRoomPkReceivedDialog
|
||||
import com.chwl.app.avroom.view.ISingleRoomView
|
||||
import com.chwl.app.databinding.FragmentSingleRoomBinding
|
||||
import com.chwl.app.music.widget.MusicPlayerView
|
||||
import com.chwl.app.ui.webview.DialogWebViewActivity
|
||||
import com.chwl.core.UriProvider
|
||||
import com.chwl.core.im.custom.bean.RequestUpmicAttachment
|
||||
import com.chwl.core.im.custom.bean.RoomPKAttachment
|
||||
import com.chwl.core.manager.AvRoomDataManager
|
||||
@@ -66,6 +69,12 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
@SuppressLint("CheckResult")
|
||||
override fun initiate() {
|
||||
super.initiate()
|
||||
gameBinding.layoutHourRank.setOnClickListener {
|
||||
DialogWebViewActivity.start(
|
||||
mContext,
|
||||
UriProvider.getSingleRoomHourRankUrl(AvRoomDataManager.get().roomUid)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onReceiveRoomEvent(roomEvent: RoomEvent?) {
|
||||
@@ -135,6 +144,7 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
|
||||
override fun initWidget() {
|
||||
super.initWidget()
|
||||
registerWidget(RoomRankWidget::class.java.simpleName, gameBinding.rankWidget)
|
||||
}
|
||||
|
||||
override fun onInitMusicPlayerView(view: MusicPlayerView) {
|
||||
|
94
app/src/main/java/com/chwl/app/avroom/rank/RoomRankWidget.kt
Normal file
94
app/src/main/java/com/chwl/app/avroom/rank/RoomRankWidget.kt
Normal file
@@ -0,0 +1,94 @@
|
||||
package com.chwl.app.avroom.rank
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import com.chwl.core.support.room.FrameLayoutRoomWidget
|
||||
import com.chwl.core.support.room.RoomWidget
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.databinding.RoomRankWidgetBinding
|
||||
import com.chwl.app.ui.utils.loadAvatar
|
||||
import com.chwl.app.ui.webview.DialogWebViewActivity
|
||||
import com.chwl.core.UriProvider
|
||||
import com.chwl.core.room.bean.RoomContributeDataInfo
|
||||
import com.chwl.core.room.bean.RoomContributeUserInfo
|
||||
import com.chwl.core.room.model.RoomContributeListModel
|
||||
import com.chwl.core.support.room.RoomContext
|
||||
import com.chwl.core.support.room.RoomView
|
||||
import com.chwl.core.utils.net.RxHelper
|
||||
import com.example.lib_utils.ktx.singleClick
|
||||
|
||||
/**
|
||||
* 房间榜单入口
|
||||
*/
|
||||
class RoomRankWidget : FrameLayoutRoomWidget, RoomWidget {
|
||||
|
||||
private val binding: RoomRankWidgetBinding =
|
||||
DataBindingUtil.inflate(
|
||||
LayoutInflater.from(
|
||||
context
|
||||
), R.layout.room_rank_widget, this, true
|
||||
)
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet?,
|
||||
defStyleAttr: Int,
|
||||
defStyleRes: Int
|
||||
) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||
|
||||
init {
|
||||
this.singleClick {
|
||||
DialogWebViewActivity.start(context, UriProvider.getRoomRanking())
|
||||
refreshData()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onInitialize(roomView: RoomView, roomContext: RoomContext) {
|
||||
super.onInitialize(roomView, roomContext)
|
||||
refreshData()
|
||||
}
|
||||
|
||||
override fun onUnbindContext() {
|
||||
super.onUnbindContext()
|
||||
updateView(null)
|
||||
}
|
||||
|
||||
private fun refreshData() {
|
||||
val disposable = RoomContributeListModel.get()
|
||||
.getSingleRoomRanking(1, RoomContributeDataInfo.TYPE_ROOM_DAY_RANKING)
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.subscribe { roomContributeDataInfo: RoomContributeDataInfo ->
|
||||
updateView(roomContributeDataInfo.rankings)
|
||||
}
|
||||
getCompositeDisposable().add(disposable)
|
||||
}
|
||||
|
||||
private fun updateView(list: List<RoomContributeUserInfo>?) {
|
||||
arrayListOf(
|
||||
binding.ivRank0, binding.ivRank1, binding.ivRank2
|
||||
).forEachIndexed { index, imageView ->
|
||||
val url = list?.getOrNull(index)?.avatar
|
||||
if (url.isNullOrEmpty()) {
|
||||
imageView.isVisible = false
|
||||
} else {
|
||||
imageView.loadAvatar(url)
|
||||
imageView.isVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setContentBackgroundResource(resId: Int) {
|
||||
binding.layoutRoot.setBackgroundResource(resId)
|
||||
}
|
||||
}
|
10
app/src/main/res/drawable/room_rank_widget_bg_game.xml
Normal file
10
app/src/main/res/drawable/room_rank_widget_bg_game.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="#19ffffff" />
|
||||
<corners
|
||||
android:bottomLeftRadius="0dp"
|
||||
android:bottomRightRadius="@dimen/dp_12"
|
||||
android:topLeftRadius="0dp"
|
||||
android:topRightRadius="@dimen/dp_12" />
|
||||
</shape>
|
@@ -72,15 +72,50 @@
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_hour_rank"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/room_bg_hour_rank"
|
||||
android:onClick="@{click}"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="@dimen/dp_6"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_22"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_marginEnd="@dimen/dp_3"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/room_ic_hour_rank" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/hour_rank"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_10" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_music"
|
||||
android:layout_width="@dimen/dp_22"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:src="@drawable/room_ic_music"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.chwl.app.avroom.rank.RoomRankWidget
|
||||
android:id="@+id/rank_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/layout_left_top_menu"
|
||||
android:layout_alignParentEnd="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_dating_step"
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -30,6 +30,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.chwl.app.avroom.rank.RoomRankWidget
|
||||
android:id="@+id/rank_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="80dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@@ -41,11 +41,39 @@
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="view_pk_board,micro_view" />
|
||||
|
||||
<ImageView
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_hour_rank"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_95"
|
||||
android:background="@drawable/room_bg_hour_rank"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="@dimen/dp_6"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_22"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_marginEnd="@dimen/dp_3"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/room_ic_hour_rank" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/hour_rank"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_10" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
app:layout_constraintBottom_toBottomOf="@id/layout_hour_rank"
|
||||
app:layout_constraintStart_toEndOf="@id/layout_hour_rank"
|
||||
app:layout_constraintTop_toTopOf="@id/layout_hour_rank"
|
||||
android:id="@+id/iv_music"
|
||||
android:layout_width="@dimen/dp_22"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
@@ -53,6 +81,14 @@
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.chwl.app.avroom.rank.RoomRankWidget
|
||||
android:id="@+id/rank_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/layout_hour_rank"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/layout_hour_rank" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/vs_music_player"
|
||||
android:layout_width="0dp"
|
||||
|
56
app/src/main/res/layout/room_rank_widget.xml
Normal file
56
app/src/main/res/layout/room_rank_widget.xml
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/layout_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:background="@drawable/room_rank_widget_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingHorizontal="@dimen/dp_4"
|
||||
tools:background="@color/black">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_rank_0"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:visibility="gone"
|
||||
tools:src="@drawable/default_avatar"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_rank_1"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginStart="-12dp"
|
||||
android:visibility="gone"
|
||||
tools:src="@drawable/default_avatar"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_rank_2"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginStart="-12dp"
|
||||
android:visibility="gone"
|
||||
tools:src="@drawable/default_avatar"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/room_rank"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_10" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_9"
|
||||
android:layout_height="@dimen/dp_9"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/base_arrow_right_f1f1fa" />
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
Reference in New Issue
Block a user