diff --git a/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java b/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java index 9c47ff129..7b721bb4c 100644 --- a/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java @@ -104,6 +104,20 @@ public class CreateSudGamePopup extends BottomPopupView { public void onViewClicks() { String sill = gameSill.getText().toString(); String name = roomName.getText().toString(); + if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + if (name.length() > 10) { + ToastUtil.show("房间名太长"); + return; + } + + } + if (IMLoginManager.get(getContext()).getLocaleLanguage() != Locale.SIMPLIFIED_CHINESE) { + if (name.length() > 15) { + ToastUtil.show("The room name is too long"); + return; + } + + } if (TextUtils.isEmpty(name)) { if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { ToastUtil.show("房间名不能为空"); diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameSearchDialogPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameSearchDialogPopup.java index 41909b57b..b5c4ac0fc 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameSearchDialogPopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameSearchDialogPopup.java @@ -77,22 +77,9 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow { findViewById(R.id.layout_history_empty).setVisibility(GONE); searchHistory = findViewById(R.id.search_history); searchHistory.removeAllViews(); -// GridLayoutManager manager = (GridLayoutManager) listHistory.getLayoutManager(); -// if (manager != null) { -// manager.setReverseLayout(true); -// } - -// historyListAdapter = new SudGameSearchHistoryListAdapter(mContext, isHome); sudGameListAdapter = new SudHomeGameListAdapter(mContext, isHome); -// historyListAdapter.setOnItemClickListener(new OnItemClickListener() { -// @Override -// public void onItemClick(String bean, int position) { -// editSearch.setText(bean); -// } -// }); listRoom.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); listRoom.setAdapter(sudGameListAdapter); -// listHistory.setAdapter(historyListAdapter); initHistoryData(); switchList(true); @@ -107,6 +94,7 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow { String value = s.toString(); if (!StringUtil.isEmpty(value)) { search(value); + } else { switchList(true); } @@ -127,46 +115,61 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow { private List historyList; + private void addHistoryData(String str) { + LinearLayout.LayoutParams layoutParams = + new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + layoutParams.setMargins(15, 10, 15, 7); + TextView chip = new TextView(mContext); + chip.setText(str); + chip.setMaxEms(10); + chip.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + chip.setSingleLine(); + if (isHome) { + + chip.setBackgroundResource(R.drawable.bg_item_search_history); + chip.setTextColor(Color.parseColor("#FF999999")); + } else { + + chip.setBackgroundResource(R.drawable.bg_item_home_search_history); + chip.setTextColor(Color.parseColor("#FFFFFF")); + } + + chip.setLayoutParams(layoutParams); + searchHistory.addView(chip, layoutParams); + + chip.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + editSearch.setText(str); + } + }); + } private void initHistoryData() { String value = SpUtil.getStringValue(SP_HISTORY); historyList = new ArrayList<>(); if (!StringUtil.isEmpty(value)) { historyList = JSONArray.parseArray(value, String.class); } -// historyListAdapter.setList(historyList); - LinearLayout.LayoutParams layoutParams = - new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); - layoutParams.setMargins(15, 10, 15, 7); + for (String str : historyList) { - TextView chip = new TextView(mContext); - chip.setText(str); - chip.setMaxEms(10); - chip.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); - chip.setSingleLine(); - if (isHome) { - - chip.setBackgroundResource(R.drawable.bg_item_search_history); - chip.setTextColor(Color.parseColor("#FF999999")); - } else { - - chip.setBackgroundResource(R.drawable.bg_item_home_search_history); - chip.setTextColor(Color.parseColor("#FFFFFF")); - } - - chip.setLayoutParams(layoutParams); - searchHistory.addView(chip, layoutParams); - - chip.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - editSearch.setText(str); - } - }); + addHistoryData(str); } } private void search(String value) { + boolean isValue = false; + for (String str : historyList) { + if (!isValue) { + isValue = TextUtils.equals(value, str); + } + + } + if (!isValue) { + historyList.add(value); + SpUtil.setStringValue(SP_HISTORY, JSONArray.toJSONString(historyList)); + addHistoryData(value); + } LiveNetManager.get(mContext) .searchRoomList("0", "0,0", "0", value, 0, new HttpCallback>() { @Override @@ -174,17 +177,7 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow { if (data.size() > 0) { switchList(false); sudGameListAdapter.setList(data); - boolean isValue = false; - for (String str : historyList) { - if (!isValue) { - isValue = TextUtils.equals(value, str); - } - } - if (!isValue) { - historyList.add(value); - SpUtil.setStringValue(SP_HISTORY, JSONArray.toJSONString(historyList)); - } } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 3f9b66e84..e31bb2aa0 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -2228,7 +2228,12 @@ public class LiveNetManager { @Override public void accept(ResponseModel createSudRoomModelResponseModel) throws Exception { if (callback != null) { - callback.onSuccess(createSudRoomModelResponseModel.getData().getInfo()); + if (createSudRoomModelResponseModel.getData().getCode() == 200) { + callback.onSuccess(createSudRoomModelResponseModel.getData().getInfo()); + } else { + callback.onError(createSudRoomModelResponseModel.getData().getMsg()); + } + } } }, new Consumer() { diff --git a/common/src/main/res/layout/item_home_sud_game_list.xml b/common/src/main/res/layout/item_home_sud_game_list.xml index 3725b6c73..7621f7cee 100644 --- a/common/src/main/res/layout/item_home_sud_game_list.xml +++ b/common/src/main/res/layout/item_home_sud_game_list.xml @@ -48,7 +48,9 @@