游戏修改,粉丝团提示修改
This commit is contained in:
parent
d541a4d506
commit
69c0d5f28a
@ -104,6 +104,20 @@ public class CreateSudGamePopup extends BottomPopupView {
|
|||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
String sill = gameSill.getText().toString();
|
String sill = gameSill.getText().toString();
|
||||||
String name = roomName.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 (TextUtils.isEmpty(name)) {
|
||||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||||
ToastUtil.show("房间名不能为空");
|
ToastUtil.show("房间名不能为空");
|
||||||
|
@ -77,22 +77,9 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
|
|||||||
findViewById(R.id.layout_history_empty).setVisibility(GONE);
|
findViewById(R.id.layout_history_empty).setVisibility(GONE);
|
||||||
searchHistory = findViewById(R.id.search_history);
|
searchHistory = findViewById(R.id.search_history);
|
||||||
searchHistory.removeAllViews();
|
searchHistory.removeAllViews();
|
||||||
// GridLayoutManager manager = (GridLayoutManager) listHistory.getLayoutManager();
|
|
||||||
// if (manager != null) {
|
|
||||||
// manager.setReverseLayout(true);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// historyListAdapter = new SudGameSearchHistoryListAdapter(mContext, isHome);
|
|
||||||
sudGameListAdapter = new SudHomeGameListAdapter(mContext, isHome);
|
sudGameListAdapter = new SudHomeGameListAdapter(mContext, isHome);
|
||||||
// historyListAdapter.setOnItemClickListener(new OnItemClickListener<String>() {
|
|
||||||
// @Override
|
|
||||||
// public void onItemClick(String bean, int position) {
|
|
||||||
// editSearch.setText(bean);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
listRoom.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
listRoom.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||||
listRoom.setAdapter(sudGameListAdapter);
|
listRoom.setAdapter(sudGameListAdapter);
|
||||||
// listHistory.setAdapter(historyListAdapter);
|
|
||||||
initHistoryData();
|
initHistoryData();
|
||||||
switchList(true);
|
switchList(true);
|
||||||
|
|
||||||
@ -107,6 +94,7 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
|
|||||||
String value = s.toString();
|
String value = s.toString();
|
||||||
if (!StringUtil.isEmpty(value)) {
|
if (!StringUtil.isEmpty(value)) {
|
||||||
search(value);
|
search(value);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
switchList(true);
|
switchList(true);
|
||||||
}
|
}
|
||||||
@ -127,46 +115,61 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
|
|||||||
|
|
||||||
private List<String> historyList;
|
private List<String> 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() {
|
private void initHistoryData() {
|
||||||
String value = SpUtil.getStringValue(SP_HISTORY);
|
String value = SpUtil.getStringValue(SP_HISTORY);
|
||||||
historyList = new ArrayList<>();
|
historyList = new ArrayList<>();
|
||||||
if (!StringUtil.isEmpty(value)) {
|
if (!StringUtil.isEmpty(value)) {
|
||||||
historyList = JSONArray.parseArray(value, String.class);
|
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) {
|
for (String str : historyList) {
|
||||||
TextView chip = new TextView(mContext);
|
addHistoryData(str);
|
||||||
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 search(String value) {
|
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)
|
LiveNetManager.get(mContext)
|
||||||
.searchRoomList("0", "0,0", "0", value, 0, new HttpCallback<List<SudRoomListModel>>() {
|
.searchRoomList("0", "0,0", "0", value, 0, new HttpCallback<List<SudRoomListModel>>() {
|
||||||
@Override
|
@Override
|
||||||
@ -174,17 +177,7 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
|
|||||||
if (data.size() > 0) {
|
if (data.size() > 0) {
|
||||||
switchList(false);
|
switchList(false);
|
||||||
sudGameListAdapter.setList(data);
|
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2228,7 +2228,12 @@ public class LiveNetManager {
|
|||||||
@Override
|
@Override
|
||||||
public void accept(ResponseModel<CreateSudRoomModel> createSudRoomModelResponseModel) throws Exception {
|
public void accept(ResponseModel<CreateSudRoomModel> createSudRoomModelResponseModel) throws Exception {
|
||||||
if (callback != null) {
|
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<Throwable>() {
|
}, new Consumer<Throwable>() {
|
||||||
|
@ -48,7 +48,9 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/room_name"
|
android:id="@+id/room_name"
|
||||||
android:layout_width="wrap_content"
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_width="150dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:text="@string/interactive_game_create_room_name"
|
android:text="@string/interactive_game_create_room_name"
|
||||||
|
@ -48,7 +48,9 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/room_name"
|
android:id="@+id/room_name"
|
||||||
android:layout_width="wrap_content"
|
android:ellipsize="end"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:singleLine="true"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:text="@string/interactive_game_create_room_name"
|
android:text="@string/interactive_game_create_room_name"
|
||||||
|
Loading…
Reference in New Issue
Block a user