feat:恢复房间小时榜、榜单(榜单入口换方案实现)
feat:调整音乐入口
This commit is contained in:
@@ -287,7 +287,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
// 刷新禮物列表,獲取房間專屬禮物列表
|
||||
GiftModel.get().refreshGiftList(AvRoomDataManager.get().roomUid.toString()).subscribe()
|
||||
checkFollowOwner()
|
||||
mvpPresenter?.loadRoomRank()
|
||||
GiftValueMrg.get().updateRoomGiftValue(false)
|
||||
|
||||
//先隐藏航海冒险
|
||||
@@ -496,6 +495,9 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
if (isOnMic) {
|
||||
if (musicPlayerView == null) {
|
||||
musicPlayerView = mVsMusicPlayer?.inflate() as? MusicPlayerView
|
||||
musicPlayerView?.let {
|
||||
onInitMusicPlayerView(it)
|
||||
}
|
||||
}
|
||||
musicPlayerView?.visibility = View.VISIBLE
|
||||
} else {
|
||||
@@ -618,11 +620,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
sendMsg()
|
||||
}
|
||||
|
||||
// R.id.contribute_list -> {
|
||||
// DialogWebViewActivity.start(mContext, UriProvider.getRoomRanking())
|
||||
// mvpPresenter?.loadRoomRank()
|
||||
// }
|
||||
|
||||
R.id.iv_first_charge_enter -> FirstChargeDialog.start(mContext)
|
||||
// R.id.iv_treasure_box,
|
||||
// R.id.iv_treasure_box_cp -> GoldBoxHelper.handleBoxClick(mContext)
|
||||
@@ -1058,18 +1055,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
microView.adapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun updateRoomRanks(data: List<RoomContributeUserInfo>) {
|
||||
// val avatarList = arrayListOf<ImageView?>(
|
||||
// mView.findViewById(R.id.iv_rank_0),
|
||||
// mView.findViewById(R.id.iv_rank_1),
|
||||
// mView.findViewById(R.id.iv_rank_2)
|
||||
// )
|
||||
//
|
||||
// for (i in 0 until avatarList.size) {
|
||||
// avatarList[i]?.loadAvatar(data.getOrNull(i)?.avatar)
|
||||
// }
|
||||
}
|
||||
|
||||
private fun onSendGiftBtnClick(giftId: Int = 0) {
|
||||
if (giftDialog == null) {
|
||||
GiftDialog.GIFT_DIALOG_FROM = getString(R.string.room)
|
||||
@@ -1266,4 +1251,8 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
protected open fun onEnterRoom(){
|
||||
|
||||
}
|
||||
|
||||
protected open fun onInitMusicPlayerView(view: MusicPlayerView) {
|
||||
|
||||
}
|
||||
}
|
@@ -5,8 +5,12 @@ import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
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;
|
||||
@@ -36,7 +40,6 @@ import com.chwl.app.utils.UserUtils;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.UriProvider;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.chwl.core.home.bean.BannerInfo;
|
||||
import com.chwl.core.home.event.ShareRoomEvent;
|
||||
import com.chwl.core.im.custom.bean.RoomPKAttachment;
|
||||
import com.chwl.core.im.custom.bean.RoomPkBean;
|
||||
@@ -134,6 +137,7 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
public void initWidget() {
|
||||
super.initWidget();
|
||||
registerWidget(RedPackageWidget.class.getSimpleName(), gameBinding.redPackageWidget);
|
||||
registerWidget(RoomRankWidget.class.getSimpleName(), gameBinding.rankWidget);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -587,12 +591,12 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
getMvpPresenter().cancelDragon();
|
||||
});
|
||||
break;
|
||||
// case R.id.tv_hour_rank:
|
||||
// DialogWebViewActivity.start(
|
||||
// mContext,
|
||||
// UriProvider.getRoomHourRankUrl(AvRoomDataManager.get().getRoomUid())
|
||||
// );
|
||||
// break;
|
||||
case R.id.tv_hour_rank:
|
||||
DialogWebViewActivity.start(
|
||||
mContext,
|
||||
UriProvider.getRoomHourRankUrl(AvRoomDataManager.get().getRoomUid())
|
||||
);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1048,4 +1052,10 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInitMusicPlayerView(@NonNull MusicPlayerView view) {
|
||||
super.onInitMusicPlayerView(view);
|
||||
view.linkIconView(gameBinding.ivMusic, gameBinding.ivMusic);
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@ import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.avroom.adapter.OnMicroItemClickListener
|
||||
import com.chwl.app.avroom.adapter.SingleAnchorMicroViewAdapter
|
||||
@@ -16,6 +15,7 @@ import com.chwl.app.avroom.adapter.SingleRoomPKMicroViewAdapter
|
||||
import com.chwl.app.avroom.dialog.RequestUpMicDialog
|
||||
import com.chwl.app.avroom.firstcharge.FirstChargePrizeDialog
|
||||
import com.chwl.app.avroom.presenter.SingleRoomPresenter
|
||||
import com.chwl.app.avroom.rank.RoomRankWidget
|
||||
import com.chwl.app.avroom.redpackage.RedPackageWidget
|
||||
import com.chwl.app.avroom.singleroompk.SingleRoomPkFinishDialog
|
||||
import com.chwl.app.avroom.singleroompk.SingleRoomPkForceFinishDialog
|
||||
@@ -25,6 +25,7 @@ import com.chwl.app.databinding.FragmentSingleRoomBinding
|
||||
import com.chwl.app.fansteam.FansTeamJoinActivity
|
||||
import com.chwl.app.fansteam.FansTeamJoinedActivity
|
||||
import com.chwl.app.fansteam.FansTeamViewModel
|
||||
import com.chwl.app.music.widget.MusicPlayerView
|
||||
import com.chwl.app.ui.webview.CommonWebViewActivity
|
||||
import com.chwl.app.ui.webview.DialogWebViewActivity
|
||||
import com.chwl.core.UriProvider
|
||||
@@ -38,6 +39,8 @@ import com.chwl.core.manager.RoomEvent
|
||||
import com.chwl.core.pay.event.FirstChargeEvent
|
||||
import com.chwl.core.user.bean.UserInfo
|
||||
import com.chwl.library.base.factory.CreatePresenter
|
||||
import com.example.lib_utils.ktx.singleClick
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
@@ -88,6 +91,13 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
updateFansTeamInfo(it)
|
||||
}
|
||||
}
|
||||
|
||||
gameBinding.tvHourRank.singleClick {
|
||||
DialogWebViewActivity.start(
|
||||
mContext,
|
||||
UriProvider.getRoomHourRankUrl(AvRoomDataManager.get().roomUid)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@@ -242,5 +252,11 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
override fun initWidget() {
|
||||
super.initWidget()
|
||||
registerWidget(RedPackageWidget::class.java.simpleName, gameBinding.redPackageWidget)
|
||||
registerWidget(RoomRankWidget::class.java.simpleName, gameBinding.rankWidget)
|
||||
}
|
||||
|
||||
override fun onInitMusicPlayerView(view: MusicPlayerView) {
|
||||
super.onInitMusicPlayerView(view)
|
||||
view.linkIconView(gameBinding.ivMusic, gameBinding.ivMusic)
|
||||
}
|
||||
}
|
@@ -525,20 +525,6 @@ public class BaseRoomPresenter<V extends IBaseRoomView> extends BaseMvpPresenter
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void loadRoomRank() {
|
||||
String type = AvRoomDataManager.get().isSingleRoom() ? RoomContributeDataInfo.TYPE_ROOM_WEEK_RANKING : RoomContributeDataInfo.TYPE_ROOM_DAY_RANKING;
|
||||
RoomContributeListModel.get().getSingleRoomRanking(1, type)
|
||||
.compose(bindToLifecycle())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.subscribe(roomContributeDataInfo -> {
|
||||
if (getMvpView() == null) {
|
||||
return;
|
||||
}
|
||||
getMvpView().updateRoomRanks(roomContributeDataInfo.getRankings());
|
||||
});
|
||||
}
|
||||
|
||||
/***
|
||||
* 發送房間消息
|
||||
* @param message
|
||||
|
90
app/src/main/java/com/chwl/app/avroom/rank/RoomRankWidget.kt
Normal file
90
app/src/main/java/com/chwl/app/avroom/rank/RoomRankWidget.kt
Normal file
@@ -0,0 +1,90 @@
|
||||
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.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.FrameLayoutRoomWidget
|
||||
import com.chwl.core.support.room.RoomContext
|
||||
import com.chwl.core.support.room.RoomView
|
||||
import com.chwl.core.support.room.RoomWidget
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -56,8 +56,6 @@ class RedPackageWidget : FrameLayoutRoomWidget, RoomWidget {
|
||||
), R.layout.red_package_widget, this, true
|
||||
)
|
||||
|
||||
private var compositeDisposable: CompositeDisposable? = null
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||
@@ -218,26 +216,14 @@ class RedPackageWidget : FrameLayoutRoomWidget, RoomWidget {
|
||||
getCompositeDisposable().add(disposable)
|
||||
}
|
||||
|
||||
private fun getCompositeDisposable(): CompositeDisposable {
|
||||
var disposable = compositeDisposable
|
||||
if (disposable == null) {
|
||||
disposable = CompositeDisposable()
|
||||
compositeDisposable = disposable
|
||||
}
|
||||
return disposable
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
this.dialogManager?.dismissDialog()
|
||||
this.dialogManager = null
|
||||
this.roomView = null
|
||||
}
|
||||
|
||||
override fun onUnbindContext() {
|
||||
super.onUnbindContext()
|
||||
compositeDisposable?.dispose()
|
||||
compositeDisposable = null
|
||||
loadData(null)
|
||||
}
|
||||
|
||||
|
@@ -71,6 +71,4 @@ interface IBaseRoomView : IMvpBaseView {
|
||||
|
||||
fun updateMicView()
|
||||
|
||||
fun updateRoomRanks(data: List<RoomContributeUserInfo>)
|
||||
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/room_ic_hour_rank.webp
Normal file
BIN
app/src/main/res/drawable-xxhdpi/room_ic_hour_rank.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/room_ic_music.webp
Normal file
BIN
app/src/main/res/drawable-xxhdpi/room_ic_music.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
10
app/src/main/res/drawable/room_bg_hour_rank.xml
Normal file
10
app/src/main/res/drawable/room_bg_hour_rank.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">
|
||||
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#33170ACD"
|
||||
android:startColor="#8C2B00CA" />
|
||||
<corners android:radius="11dp" />
|
||||
</shape>
|
10
app/src/main/res/drawable/room_rank_widget_bg.xml
Normal file
10
app/src/main/res/drawable/room_rank_widget_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="#19ffffff" />
|
||||
<corners
|
||||
android:bottomLeftRadius="11dp"
|
||||
android:bottomRightRadius="0dp"
|
||||
android:topLeftRadius="@dimen/dp_12"
|
||||
android:topRightRadius="0dp" />
|
||||
</shape>
|
55
app/src/main/res/layout/room_rank_widget.xml
Normal file
55
app/src/main/res/layout/room_rank_widget.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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: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="房间榜"
|
||||
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>
|
@@ -24,14 +24,13 @@
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="80dp"
|
||||
android:layout_marginTop="@dimen/dp_85"
|
||||
android:clipChildren="false">
|
||||
|
||||
<com.chwl.app.avroom.widget.MicroView
|
||||
android:id="@+id/micro_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp" />
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_room_pk_order"
|
||||
@@ -64,6 +63,41 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hour_rank"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:background="@drawable/room_bg_hour_rank"
|
||||
android:drawableStart="@drawable/room_ic_hour_rank"
|
||||
android:drawablePadding="@dimen/dp_3"
|
||||
android:onClick="@{click}"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/dp_6"
|
||||
android:text="小时榜"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_10" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_music"
|
||||
android:layout_width="@dimen/dp_22"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_alignTop="@id/tv_hour_rank"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_toEndOf="@id/tv_hour_rank"
|
||||
android:src="@drawable/room_ic_music"
|
||||
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"
|
||||
android:layout_alignTop="@id/tv_hour_rank"
|
||||
android:layout_alignParentEnd="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_dating_step"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -307,8 +341,8 @@
|
||||
android:id="@+id/vs_music_player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignTop="@id/micro_view"
|
||||
android:layout_marginTop="@dimen/dp_22"
|
||||
android:layout_below="@id/iv_music"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout="@layout/avroom_music_player_layout" />
|
||||
|
||||
<com.chwl.app.vip.view.VipBroadcastView
|
||||
|
@@ -41,13 +41,50 @@
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="view_pk_board,micro_view" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hour_rank"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_95"
|
||||
android:background="@drawable/room_bg_hour_rank"
|
||||
android:drawableStart="@drawable/room_ic_hour_rank"
|
||||
android:drawablePadding="@dimen/dp_3"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/dp_6"
|
||||
android:text="小时榜"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_10"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<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"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_hour_rank"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_hour_rank"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_hour_rank"
|
||||
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/tv_hour_rank"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_hour_rank" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_fans_team"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="85dp"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_hour_rank"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
@@ -103,12 +140,12 @@
|
||||
android:id="@+id/vs_music_player"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="85dp"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout="@layout/avroom_music_player_layout"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_music" />
|
||||
|
||||
<com.chwl.app.avroom.widget.BottomView
|
||||
android:id="@+id/bottom_view"
|
||||
|
@@ -45,9 +45,9 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
public class MusicPlayerView extends FrameLayout implements View.OnClickListener, SeekBar.OnSeekBarChangeListener {
|
||||
private LinearLayout musicFlagLayout;
|
||||
private View musicFlagLayout;
|
||||
private RelativeLayout musicBoxLayout;
|
||||
private ImageView musicFlag;
|
||||
private View musicFlag;
|
||||
private ImageView musicListMore;
|
||||
private ImageView musicPlayPause;
|
||||
private ImageView nextBtn;
|
||||
@@ -73,9 +73,6 @@ public class MusicPlayerView extends FrameLayout implements View.OnClickListener
|
||||
private void init() {
|
||||
EventBus.getDefault().register(this);
|
||||
LayoutInflater.from(getContext()).inflate(R.layout.layout_music_player_view, this, true);
|
||||
musicFlagLayout = findViewById(R.id.music_flag_layout);
|
||||
musicFlagLayout.setOnClickListener(this);
|
||||
musicFlag = findViewById(R.id.music_flag);
|
||||
musicBoxLayout = findViewById(R.id.music_box_layout);
|
||||
musicBoxLayout.setOnClickListener(this);
|
||||
musicListMore = findViewById(R.id.music_list_more);
|
||||
@@ -109,6 +106,9 @@ public class MusicPlayerView extends FrameLayout implements View.OnClickListener
|
||||
}
|
||||
|
||||
private void playFlagRotateAnim() {
|
||||
if (musicFlag == null) {
|
||||
return;
|
||||
}
|
||||
Animation operatingAnim = AnimationUtils.loadAnimation(getContext(), R.anim.rotate_quick_anim);
|
||||
LinearInterpolator lin = new LinearInterpolator();
|
||||
operatingAnim.setInterpolator(lin);
|
||||
@@ -116,41 +116,57 @@ public class MusicPlayerView extends FrameLayout implements View.OnClickListener
|
||||
}
|
||||
|
||||
private void stopFlagRotateAnim() {
|
||||
if (musicFlag == null) {
|
||||
return;
|
||||
}
|
||||
musicFlag.clearAnimation();
|
||||
}
|
||||
|
||||
private void showFlagInAnim() {
|
||||
// if (musicFlagLayout == null) {
|
||||
// return;
|
||||
// }
|
||||
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(musicBoxLayout, "translationX", 0, -UIUtil.dip2px(getContext(), 317)).setDuration(150);
|
||||
objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
objectAnimator.start();
|
||||
|
||||
ObjectAnimator objectAnimatorFlag = ObjectAnimator.ofFloat(
|
||||
musicFlagLayout,
|
||||
"translationX",
|
||||
UIUtil.dip2px(getContext(), 76),
|
||||
0)
|
||||
.setDuration(150);
|
||||
objectAnimatorFlag.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
objectAnimatorFlag.setStartDelay(150);
|
||||
objectAnimatorFlag.addListener(new AnimatorListenerAdapter() {
|
||||
objectAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
super.onAnimationStart(animation);
|
||||
layoutMusicBgClick.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
objectAnimatorFlag.start();
|
||||
objectAnimator.start();
|
||||
|
||||
// ObjectAnimator objectAnimatorFlag = ObjectAnimator.ofFloat(
|
||||
// musicFlagLayout,
|
||||
// "translationX",
|
||||
// UIUtil.dip2px(getContext(), 76),
|
||||
// 0)
|
||||
// .setDuration(150);
|
||||
// objectAnimatorFlag.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
// objectAnimatorFlag.setStartDelay(150);
|
||||
// objectAnimatorFlag.addListener(new AnimatorListenerAdapter() {
|
||||
// @Override
|
||||
// public void onAnimationStart(Animator animation) {
|
||||
// super.onAnimationStart(animation);
|
||||
// layoutMusicBgClick.setVisibility(GONE);
|
||||
// }
|
||||
// });
|
||||
// objectAnimatorFlag.start();
|
||||
}
|
||||
|
||||
private void showBoxInAnim() {
|
||||
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(
|
||||
musicFlagLayout,
|
||||
"translationX",
|
||||
0,
|
||||
UIUtil.dip2px(getContext(), 76))
|
||||
.setDuration(150);
|
||||
objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
objectAnimator.start();
|
||||
// if (musicFlagLayout == null) {
|
||||
// return;
|
||||
// }
|
||||
// ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(
|
||||
// musicFlagLayout,
|
||||
// "translationX",
|
||||
// 0,
|
||||
// UIUtil.dip2px(getContext(), 76))
|
||||
// .setDuration(150);
|
||||
// objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
// objectAnimator.start();
|
||||
|
||||
|
||||
ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(musicBoxLayout, "translationX", -UIUtil.dip2px(getContext(), 317), 0).setDuration(150);
|
||||
@@ -179,9 +195,6 @@ public class MusicPlayerView extends FrameLayout implements View.OnClickListener
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.music_flag_layout:
|
||||
showBoxInAnim();
|
||||
break;
|
||||
case R.id.layout_music_bg_click:
|
||||
showFlagInAnim();
|
||||
break;
|
||||
@@ -295,4 +308,27 @@ public class MusicPlayerView extends FrameLayout implements View.OnClickListener
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联入口View
|
||||
* @param iconView 入口View
|
||||
* @param stateView 播放状态View
|
||||
*
|
||||
*/
|
||||
public void linkIconView(View iconView, View stateView) {
|
||||
this.musicFlagLayout = iconView;
|
||||
this.musicFlag = stateView;
|
||||
this.musicFlagLayout.setOnClickListener(view -> showBoxInAnim());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisibility(int visibility) {
|
||||
super.setVisibility(visibility);
|
||||
if (musicFlagLayout != null) {
|
||||
this.musicFlagLayout.setVisibility(visibility);
|
||||
}
|
||||
if (musicFlag != null) {
|
||||
this.musicFlag.setVisibility(visibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
@@ -4,34 +4,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/music_flag_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/bg_single_room_rank_entrance"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/music_flag"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:src="@drawable/icon_music_flag" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:text="@string/room_play_music"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_music_bg_click"
|
||||
android:layout_width="match_parent"
|
||||
|
@@ -5,6 +5,7 @@ import android.util.AttributeSet
|
||||
import android.widget.FrameLayout
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.lifecycle.Observer
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
||||
/**
|
||||
* Created by Max on 2023/10/30 18:20
|
||||
@@ -33,6 +34,8 @@ abstract class FrameLayoutRoomWidget : FrameLayout, RoomWidget {
|
||||
}
|
||||
}
|
||||
|
||||
private var compositeDisposable: CompositeDisposable? = null
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||
@@ -71,10 +74,22 @@ abstract class FrameLayoutRoomWidget : FrameLayout, RoomWidget {
|
||||
/**
|
||||
* 解绑上下文:重置View状态
|
||||
*/
|
||||
open fun onUnbindContext() {}
|
||||
open fun onUnbindContext() {
|
||||
compositeDisposable?.dispose()
|
||||
compositeDisposable = null
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化(View+Context)
|
||||
*/
|
||||
open fun onInitialize(roomView: RoomView, roomContext: RoomContext) {}
|
||||
|
||||
protected fun getCompositeDisposable(): CompositeDisposable {
|
||||
var disposable = compositeDisposable
|
||||
if (disposable == null) {
|
||||
disposable = CompositeDisposable()
|
||||
compositeDisposable = disposable
|
||||
}
|
||||
return disposable
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="9dp"
|
||||
android:height="9dp"
|
||||
android:viewportWidth="9"
|
||||
android:viewportHeight="9">
|
||||
<path
|
||||
android:pathData="M2.5158,7.0939L6.5158,3.7124L7,4.2851L6.524,4.8647L2.524,1.5796L3.476,0.4204L7.476,3.7055Q7.5287,3.7488 7.5728,3.8009Q7.6205,3.8573 7.6562,3.922Q7.692,3.9866 7.7144,4.057Q7.7369,4.1273 7.7452,4.2007Q7.7536,4.2741 7.7474,4.3477Q7.7412,4.4213 7.7208,4.4923Q7.7004,4.5633 7.6665,4.629Q7.6327,4.6946 7.5866,4.7524Q7.5406,4.8102 7.4842,4.8579L3.4842,8.2394L2.5158,7.0939ZM3.75,7.6667Q3.75,7.7405 3.7356,7.813Q3.7212,7.8854 3.6929,7.9537Q3.6646,8.0219 3.6236,8.0833Q3.5826,8.1448 3.5303,8.197Q3.4781,8.2492 3.4167,8.2903Q3.3553,8.3313 3.287,8.3596Q3.2188,8.3878 3.1463,8.4023Q3.0739,8.4167 3,8.4167Q2.9261,8.4167 2.8537,8.4023Q2.7812,8.3878 2.713,8.3596Q2.6447,8.3313 2.5833,8.2903Q2.5219,8.2492 2.4697,8.197Q2.4174,8.1448 2.3764,8.0833Q2.3354,8.0219 2.3071,7.9537Q2.2788,7.8854 2.2644,7.813Q2.25,7.7405 2.25,7.6667Q2.25,7.5928 2.2644,7.5203Q2.2788,7.4479 2.3071,7.3797Q2.3354,7.3114 2.3764,7.25Q2.4174,7.1886 2.4697,7.1363Q2.5219,7.0841 2.5833,7.0431Q2.6447,7.002 2.713,6.9738Q2.7812,6.9455 2.8537,6.9311Q2.9261,6.9167 3,6.9167Q3.0739,6.9167 3.1463,6.9311Q3.2188,6.9455 3.287,6.9738Q3.3553,7.002 3.4167,7.0431Q3.4781,7.0841 3.5303,7.1363Q3.5826,7.1886 3.6236,7.25Q3.6646,7.3114 3.6929,7.3797Q3.7212,7.4479 3.7356,7.5203Q3.75,7.5928 3.75,7.6667ZM3.75,1Q3.75,1.0739 3.7356,1.1463Q3.7212,1.2188 3.6929,1.287Q3.6646,1.3553 3.6236,1.4167Q3.5826,1.4781 3.5303,1.5303Q3.4781,1.5826 3.4167,1.6236Q3.3553,1.6646 3.287,1.6929Q3.2188,1.7212 3.1463,1.7356Q3.0739,1.75 3,1.75Q2.9261,1.75 2.8537,1.7356Q2.7812,1.7212 2.713,1.6929Q2.6447,1.6646 2.5833,1.6236Q2.5219,1.5826 2.4697,1.5303Q2.4174,1.4781 2.3764,1.4167Q2.3354,1.3553 2.3071,1.287Q2.2788,1.2188 2.2644,1.1463Q2.25,1.0739 2.25,1Q2.25,0.9261 2.2644,0.8537Q2.2788,0.7812 2.3071,0.713Q2.3354,0.6447 2.3764,0.5833Q2.4174,0.5219 2.4697,0.4697Q2.5219,0.4174 2.5833,0.3764Q2.6447,0.3354 2.713,0.3071Q2.7812,0.2788 2.8537,0.2644Q2.9261,0.25 3,0.25Q3.0739,0.25 3.1463,0.2644Q3.2188,0.2788 3.287,0.3071Q3.3553,0.3354 3.4167,0.3764Q3.4781,0.4174 3.5303,0.4697Q3.5826,0.5219 3.6236,0.5833Q3.6646,0.6447 3.6929,0.713Q3.7212,0.7812 3.7356,0.8537Q3.75,0.9261 3.75,1Z"
|
||||
android:fillColor="#F1F1FA"/>
|
||||
</vector>
|
Reference in New Issue
Block a user