feat:调整配置入口按钮显示逻辑
This commit is contained in:
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
@@ -14,8 +15,13 @@ import com.chwl.app.avroom.headline.RoomHeadlineWidget;
|
|||||||
import com.chwl.app.avroom.online.RoomOnlineWidget;
|
import com.chwl.app.avroom.online.RoomOnlineWidget;
|
||||||
import com.chwl.app.avroom.rank.RoomRankNumberWidget;
|
import com.chwl.app.avroom.rank.RoomRankNumberWidget;
|
||||||
import com.chwl.app.music.widget.MusicPlayerView;
|
import com.chwl.app.music.widget.MusicPlayerView;
|
||||||
|
import com.chwl.app.ui.utils.ImageLoadUtils;
|
||||||
import com.chwl.app.ui.webview.DialogWebViewActivity;
|
import com.chwl.app.ui.webview.DialogWebViewActivity;
|
||||||
|
import com.chwl.core.room.bean.RightBottomIconConfig;
|
||||||
|
import com.chwl.core.room.bean.RoomIcon;
|
||||||
|
import com.chwl.core.room.core.RoomDataService;
|
||||||
import com.chwl.core.room.pk.event.PKDataUpdateEvent;
|
import com.chwl.core.room.pk.event.PKDataUpdateEvent;
|
||||||
|
import com.chwl.core.support.room.AudioRoomContext;
|
||||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||||
import com.trello.rxlifecycle3.android.FragmentEvent;
|
import com.trello.rxlifecycle3.android.FragmentEvent;
|
||||||
import com.chwl.app.R;
|
import com.chwl.app.R;
|
||||||
@@ -79,6 +85,7 @@ import io.reactivex.Single;
|
|||||||
import io.reactivex.SingleObserver;
|
import io.reactivex.SingleObserver;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.functions.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 轰趴房间
|
* 轰趴房间
|
||||||
@@ -101,6 +108,8 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
private PKMicQueueDialog pkMicQueueDialog;
|
private PKMicQueueDialog pkMicQueueDialog;
|
||||||
private Disposable roomPkOrderDisposable;
|
private Disposable roomPkOrderDisposable;
|
||||||
|
|
||||||
|
private boolean hasBaishunGames;
|
||||||
|
|
||||||
public static HomePartyRoomFragment newInstance() {
|
public static HomePartyRoomFragment newInstance() {
|
||||||
HomePartyRoomFragment roomFragment = new HomePartyRoomFragment();
|
HomePartyRoomFragment roomFragment = new HomePartyRoomFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
@@ -149,6 +158,28 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
updateQueuingMicBtn();
|
updateQueuingMicBtn();
|
||||||
updatePkScoreBoard();
|
updatePkScoreBoard();
|
||||||
initRoomPkOrder(AvRoomDataManager.get().showPkBeginTime, AvRoomDataManager.get().pkBeginTime);
|
initRoomPkOrder(AvRoomDataManager.get().showPkBeginTime, AvRoomDataManager.get().pkBeginTime);
|
||||||
|
requestData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void requestData() {
|
||||||
|
RoomDataService dataService = (RoomDataService) AudioRoomContext.Companion.get().findAbility(RoomDataService.class.getSimpleName());
|
||||||
|
String cacheKey = "gameplay_list#" + hashCode();
|
||||||
|
Disposable disposable = AvRoomModel.get().getRoomGamePlayList().doOnError(new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
hasBaishunGames = false;
|
||||||
|
updateConfigButtonArea();
|
||||||
|
}
|
||||||
|
}).subscribe(new Consumer<List<RoomIcon>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(List<RoomIcon> roomIcons) throws Exception {
|
||||||
|
if (dataService != null) {
|
||||||
|
dataService.putData(cacheKey, roomIcons);
|
||||||
|
}
|
||||||
|
hasBaishunGames = roomIcons.size() > 0;
|
||||||
|
updateConfigButtonArea();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -197,6 +228,7 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
gameBinding.setRoomInfo(AvRoomDataManager.get().mCurrentRoomInfo);
|
gameBinding.setRoomInfo(AvRoomDataManager.get().mCurrentRoomInfo);
|
||||||
updateQueuingMicBtn();
|
updateQueuingMicBtn();
|
||||||
updatePkScoreBoard();
|
updatePkScoreBoard();
|
||||||
|
updateConfigButtonArea();
|
||||||
getMvpPresenter().updateLeaveMode();
|
getMvpPresenter().updateLeaveMode();
|
||||||
break;
|
break;
|
||||||
case RoomEvent.ENTER_ROOM:
|
case RoomEvent.ENTER_ROOM:
|
||||||
@@ -470,11 +502,7 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
updateMicroView();
|
updateMicroView();
|
||||||
changeModelShowView();
|
changeModelShowView();
|
||||||
refreshDatingNextStatus();
|
refreshDatingNextStatus();
|
||||||
if (AvRoomDataManager.get().isDatingMode()) {
|
// updateConfigButtonArea();
|
||||||
gameBinding.ivGame.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
gameBinding.ivGame.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateMicroView(){
|
protected void updateMicroView(){
|
||||||
@@ -502,6 +530,34 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
refreshDatingNextStatus();
|
refreshDatingNextStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateConfigButtonArea() {
|
||||||
|
RightBottomIconConfig configModel = AvRoomDataManager.get().rightBottomIconConfig;
|
||||||
|
if (configModel == null) {
|
||||||
|
gameBinding.ivConfigEntrance.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
if (configModel.getIcon1Url() == null) {
|
||||||
|
gameBinding.ivConfigEntrance.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
ImageLoadUtils.loadAvatar(configModel.getIcon1Url(), gameBinding.ivConfigEntrance);
|
||||||
|
gameBinding.ivConfigEntrance.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configModel.getIcon2Url() != null) {
|
||||||
|
ImageLoadUtils.loadAvatar(configModel.getIcon2Url(), gameBinding.ivGame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AvRoomDataManager.get().isDatingMode()) {
|
||||||
|
gameBinding.ivGame.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
if (hasBaishunGames) {
|
||||||
|
gameBinding.ivGame.setVisibility(View.VISIBLE);
|
||||||
|
}else {
|
||||||
|
gameBinding.ivGame.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateQueuingMicBtn() {
|
private void updateQueuingMicBtn() {
|
||||||
if (AvRoomDataManager.get().mCurrentRoomInfo != null) {
|
if (AvRoomDataManager.get().mCurrentRoomInfo != null) {
|
||||||
bottomView.updateQueuingMicButton();
|
bottomView.updateQueuingMicButton();
|
||||||
@@ -564,7 +620,6 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onDatingSelectUserEvent(DatingSelectUserEvent event) {
|
public void onDatingSelectUserEvent(DatingSelectUserEvent event) {
|
||||||
if (getMvpPresenter() != null) {
|
if (getMvpPresenter() != null) {
|
||||||
|
@@ -238,7 +238,8 @@
|
|||||||
android:layout_marginBottom="@dimen/dp_6"
|
android:layout_marginBottom="@dimen/dp_6"
|
||||||
android:onClick="@{click}"
|
android:onClick="@{click}"
|
||||||
android:src="@drawable/room_ic_game"
|
android:src="@drawable/room_ic_game"
|
||||||
tools:visibility="gone"/>
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_game"
|
android:id="@+id/iv_game"
|
||||||
@@ -249,13 +250,15 @@
|
|||||||
android:layout_marginEnd="@dimen/dp_11"
|
android:layout_marginEnd="@dimen/dp_11"
|
||||||
android:layout_marginBottom="@dimen/dp_6"
|
android:layout_marginBottom="@dimen/dp_6"
|
||||||
android:onClick="@{click}"
|
android:onClick="@{click}"
|
||||||
android:src="@drawable/room_ic_game" />
|
android:src="@drawable/room_ic_game"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_team_pk"
|
android:id="@+id/iv_team_pk"
|
||||||
android:layout_width="@dimen/dp_38"
|
android:layout_width="@dimen/dp_38"
|
||||||
android:layout_height="@dimen/dp_38"
|
android:layout_height="@dimen/dp_38"
|
||||||
android:layout_above="@id/iv_game"
|
android:layout_above="@id/iv_config_entrance"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginEnd="@dimen/dp_11"
|
android:layout_marginEnd="@dimen/dp_11"
|
||||||
android:layout_marginBottom="@dimen/dp_8"
|
android:layout_marginBottom="@dimen/dp_8"
|
||||||
|
Reference in New Issue
Block a user