添加游戏列表点击查询游戏状态
This commit is contained in:
parent
c1d6b67322
commit
2d7684a5c8
@ -25,6 +25,7 @@ import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.event.RoomHolderTypeEvent;
|
||||
import com.yunbao.common.event.SudGameListDissMissEvent;
|
||||
import com.yunbao.common.event.SudGameListEvent;
|
||||
import com.yunbao.common.event.SudGameListRefreshEvent;
|
||||
import com.yunbao.common.event.SudGameListSillEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
@ -320,6 +321,10 @@ public class SudGameListPopup extends BottomPopupView {
|
||||
public void onSudGameListDissMissEvent(SudGameListDissMissEvent event) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListRefreshEvent(SudGameListRefreshEvent event) {
|
||||
mRefreshView.initData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class SudGameListRefreshEvent extends BaseModel {
|
||||
}
|
@ -1028,5 +1028,10 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<CreateSudRoomModel>> randomRoom(
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Sudgameserver.checkRoomStatus")
|
||||
Observable<ResponseModel<CreateSudRoomModel>> checkRoomStatus(
|
||||
@Query("room_id") String roomId
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
@ -2268,6 +2268,28 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void checkRoomStatus(String roomId, HttpCallback<CreateSudRoomModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.checkRoomStatus(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<CreateSudRoomModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<CreateSudRoomModel> createSudRoomModelResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(createSudRoomModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid, int page, HttpCallback<List<SudRoomListModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getRoomList(sudGameId, threshold, roomHolderType, liveUid, page)
|
||||
|
@ -18,18 +18,20 @@ import com.yunbao.common.activity.SudGameActivity;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.bean.playerObject;
|
||||
import com.yunbao.common.event.SudGameListDissMissEvent;
|
||||
import com.yunbao.common.event.SudGameListRefreshEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
|
||||
@ -38,7 +40,7 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView roomName, playerWeAre, playerWeAre2, goldenBeanNumber;
|
||||
private RoundedImageView avatarList1, avatarList2, avatarList3, avatarList4, avatarList5;
|
||||
private GifImageView gifImageView;
|
||||
private ImageView sex,game_icon;
|
||||
private ImageView sex, game_icon;
|
||||
|
||||
|
||||
public SudGameListViewHolder(@NonNull View itemView) {
|
||||
@ -104,6 +106,17 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView.findViewById(R.id.layout), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
LiveNetManager.get(itemView.getContext()).checkRoomStatus(model.getId(), new com.yunbao.common.http.base.HttpCallback<CreateSudRoomModel>() {
|
||||
@Override
|
||||
public void onSuccess(CreateSudRoomModel data) {
|
||||
if (TextUtils.equals(data.getRoomStatus(), "0")) {
|
||||
if (IMLoginManager.get(itemView.getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("房间不存在");
|
||||
} else {
|
||||
ToastUtil.show("The room does not exist");
|
||||
}
|
||||
Bus.get().post(new SudGameListRefreshEvent());
|
||||
} else {
|
||||
CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel();
|
||||
createSudRoomModel.setSudGameId(model.getSudGameId());
|
||||
createSudRoomModel.setSudGameRoomId(model.getSudGameRoomId());
|
||||
@ -150,6 +163,15 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
Bus.get().post(new SudGameListDissMissEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -97,30 +97,38 @@
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_history_empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="80dp"
|
||||
android:src="@mipmap/icon_attention_noanchor" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/bg_home_search_not"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:paddingStart="30dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:text="@string/interactive_game_search_room_have_been_found"
|
||||
android:textColor="#CCFFFFFF"
|
||||
android:textColorHint="#000"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/list_room"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -111,16 +111,22 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_history_empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="80dp"
|
||||
android:src="@mipmap/icon_attention_noanchor" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/bg_home_search_not"
|
||||
android:gravity="center"
|
||||
android:paddingStart="30dp"
|
||||
android:paddingTop="12dp"
|
||||
|
BIN
common/src/main/res/mipmap-xxhdpi/icon_attention_noanchor.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/icon_attention_noanchor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
@ -1341,5 +1341,5 @@
|
||||
<string name="interactive_game_search_room">搜索房間</string>
|
||||
<string name="interactive_game_search_history">搜索历史</string>
|
||||
<string name="interactive_game_search_room_name_input">請輸入您要搜索的房主昵稱、房主ID或房間名</string>
|
||||
<string name="interactive_game_search_room_have_been_found">暫未搜索結果~</string>
|
||||
<string name="interactive_game_search_room_have_been_found">不存在此房间</string>
|
||||
</resources>
|
||||
|
@ -1340,5 +1340,5 @@
|
||||
<string name="interactive_game_search_room">搜索房間</string>
|
||||
<string name="interactive_game_search_history">搜索历史</string>
|
||||
<string name="interactive_game_search_room_name_input">請輸入您要搜索的房主昵稱、房主ID或房間名</string>
|
||||
<string name="interactive_game_search_room_have_been_found">暫未搜索結果~</string>
|
||||
<string name="interactive_game_search_room_have_been_found">不存在此房间</string>
|
||||
</resources>
|
||||
|
@ -1341,6 +1341,6 @@
|
||||
<string name="interactive_game_search_room">搜索房間</string>
|
||||
<string name="interactive_game_search_history">搜索历史</string>
|
||||
<string name="interactive_game_search_room_name_input">請輸入您要搜索的房主昵稱、房主ID或房間名</string>
|
||||
<string name="interactive_game_search_room_have_been_found">暫未搜索結果~</string>
|
||||
<string name="interactive_game_search_room_have_been_found">不存在此房间</string>
|
||||
|
||||
</resources>
|
||||
|
@ -30,6 +30,7 @@ import com.yunbao.common.dialog.SudGameListSelectPopup;
|
||||
import com.yunbao.common.dialog.SudGameSearchDialogPopup;
|
||||
import com.yunbao.common.event.RoomHolderTypeEvent;
|
||||
import com.yunbao.common.event.SudGameListEvent;
|
||||
import com.yunbao.common.event.SudGameListRefreshEvent;
|
||||
import com.yunbao.common.event.SudGameListSillEvent;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
@ -386,4 +387,8 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListRefreshEvent(SudGameListRefreshEvent event) {
|
||||
mRefreshView.initData();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user