update 首页游戏专区
@ -0,0 +1,75 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SudGameSearchHistoryListAdapter extends RecyclerView.Adapter<SudGameSearchHistoryListAdapter.ViewHolder> {
|
||||
private List<String> mList;
|
||||
private Context mContext;
|
||||
private OnItemClickListener<String> onItemClickListener;
|
||||
|
||||
public SudGameSearchHistoryListAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
mList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setList(List<String> list) {
|
||||
this.mList = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<String> onItemClickListener) {
|
||||
this.onItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_search_history, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.setData(mList.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return Math.min(mList.size(), 5);
|
||||
}
|
||||
|
||||
public List<String> getList() {
|
||||
return mList;
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView nameView;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
nameView = itemView.findViewById(R.id.history);
|
||||
|
||||
}
|
||||
|
||||
public void setData(String name) {
|
||||
nameView.setText(name);
|
||||
nameView.setOnClickListener(v -> {
|
||||
if(onItemClickListener!=null){
|
||||
onItemClickListener.onItemClick(name,0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class SudGameSearchRoomListAdapter extends RecyclerView.Adapter<SudGameSearchRoomListAdapter.ViewHolder> {
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.views.SudGameListViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SudHomeGameListAdapter extends RecyclerView.Adapter<SudGameListViewHolder> {
|
||||
private Context mContext;
|
||||
private List<SudRoomListModel> mList;
|
||||
|
||||
public SudHomeGameListAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
mList=new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setList(List<SudRoomListModel> mList) {
|
||||
this.mList = mList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public SudGameListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new SudGameListViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_sud_game_list, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull SudGameListViewHolder holder, int position) {
|
||||
holder.setData(mList.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
}
|
@ -36,15 +36,24 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
private EditText roomName, gameSill;
|
||||
private long interactionID = 0;
|
||||
private String id;
|
||||
private boolean isHomeView;
|
||||
|
||||
public CreateSudGamePopup(@NonNull Context context, List<CustomSidebarChildModel> child) {
|
||||
super(context);
|
||||
customSidebarChildModels = child;
|
||||
}
|
||||
|
||||
public CreateSudGamePopup setHomeView(boolean homeView) {
|
||||
isHomeView = homeView;
|
||||
return this;
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
if (isHomeView) {
|
||||
return R.layout.dialog_home_create_sud_game;
|
||||
}
|
||||
return R.layout.dialog_create_sud_game;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -35,6 +37,7 @@ public class SudGameListSelectPopup extends AttachPopupView {
|
||||
|
||||
private SudTitleSelectAdapter sudTitleSelectAdapter;
|
||||
private long interactionID = 0;
|
||||
private DialogInterface.OnDismissListener onDismissListener;
|
||||
private String mSill;
|
||||
|
||||
public SudGameListSelectPopup(@NonNull Context context, int type, List<CustomSidebarChildModel> child, long interactionID) {
|
||||
@ -44,6 +47,11 @@ public class SudGameListSelectPopup extends AttachPopupView {
|
||||
this.interactionID = interactionID;
|
||||
}
|
||||
|
||||
public SudGameListSelectPopup setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
|
||||
this.onDismissListener = onDismissListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SudGameListSelectPopup(@NonNull Context context, int mType, String sill) {
|
||||
super(context);
|
||||
this.mType = mType;
|
||||
@ -161,4 +169,12 @@ public class SudGameListSelectPopup extends AttachPopupView {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
if(onDismissListener!=null){
|
||||
onDismissListener.onDismiss(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,180 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.SudGameListAdapter;
|
||||
import com.yunbao.common.adapter.SudGameSearchHistoryListAdapter;
|
||||
import com.yunbao.common.adapter.SudHomeGameListAdapter;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.event.SudRoomListModelEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.views.LiveSudGamePopup;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
|
||||
private static final String SP_HISTORY = "sud_game_search_history";
|
||||
private EditText editSearch;
|
||||
private RecyclerView listHistory, listRoom;
|
||||
private View history;
|
||||
|
||||
private SudGameSearchHistoryListAdapter historyListAdapter;
|
||||
private SudHomeGameListAdapter sudGameListAdapter;
|
||||
|
||||
public SudGameSearchDialogPopup(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
builder.moveUpToKeyboard(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_home_search_sud_game;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
editSearch = findViewById(R.id.edit_search);
|
||||
listHistory = findViewById(R.id.list_history);
|
||||
listRoom = findViewById(R.id.list_room);
|
||||
history = findViewById(R.id.layout_history);
|
||||
findViewById(R.id.layout_history_empty).setVisibility(GONE);
|
||||
|
||||
GridLayoutManager manager = (GridLayoutManager) listHistory.getLayoutManager();
|
||||
if (manager != null) {
|
||||
manager.setReverseLayout(true);
|
||||
}
|
||||
|
||||
historyListAdapter = new SudGameSearchHistoryListAdapter(mContext);
|
||||
sudGameListAdapter = new SudHomeGameListAdapter(mContext);
|
||||
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.setAdapter(sudGameListAdapter);
|
||||
listHistory.setAdapter(historyListAdapter);
|
||||
initHistoryData();
|
||||
switchList(true);
|
||||
|
||||
editSearch.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String value = s.toString();
|
||||
if (!StringUtil.isEmpty(value)) {
|
||||
search(value);
|
||||
} else {
|
||||
switchList(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initHistoryData() {
|
||||
String value = SpUtil.getStringValue(SP_HISTORY);
|
||||
List<String> historyList = new ArrayList<>();
|
||||
if (!StringUtil.isEmpty(value)) {
|
||||
historyList = JSONArray.parseArray(value, String.class);
|
||||
}
|
||||
historyListAdapter.setList(historyList);
|
||||
}
|
||||
|
||||
private void search(String value) {
|
||||
LiveNetManager.get(mContext)
|
||||
.searchRoomList("0", "0,0", "0", value, 0, new HttpCallback<List<SudRoomListModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<SudRoomListModel> data) {
|
||||
switchList(false);
|
||||
sudGameListAdapter.setList(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void switchList(boolean isHistory) {
|
||||
if (isHistory) {
|
||||
history.setVisibility(VISIBLE);
|
||||
listRoom.setVisibility(GONE);
|
||||
} else {
|
||||
listRoom.setVisibility(VISIBLE);
|
||||
history.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
String value = editSearch.getText().toString();
|
||||
if (!StringUtil.isEmpty(value)) {
|
||||
List<String> list = historyListAdapter.getList();
|
||||
if (list.size() >= 5) {
|
||||
list.remove(0);
|
||||
}
|
||||
list.add(value);
|
||||
SpUtil.setStringValue(SP_HISTORY, JSONArray.toJSONString(list));
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListEvent(SudRoomListModelEvent event) {
|
||||
CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel();
|
||||
createSudRoomModel.setSudGameId(event.getModel().getSudGameId());
|
||||
createSudRoomModel.setSudGameRoomId(event.getModel().getSudGameRoomId());
|
||||
createSudRoomModel.setAvatar(event.getModel().getAvatar());
|
||||
createSudRoomModel.setRoomName(event.getModel().getRoomName());
|
||||
createSudRoomModel.setSudGameName(event.getModel().getSudGameName());
|
||||
new XPopup.Builder(getContext())
|
||||
.enableDrag(false)
|
||||
.dismissOnTouchOutside(false)
|
||||
.dismissOnBackPressed(false)
|
||||
.asCustom(new LiveSudGamePopup(getContext(), createSudRoomModel))
|
||||
.show();
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
@ -1004,6 +1004,19 @@ public interface PDLiveApi {
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("page") int page
|
||||
);
|
||||
/**
|
||||
* 获取游戏房列表 - 搜索
|
||||
*
|
||||
*/
|
||||
@GET("/api/public/?service=Sudgameserver.getRoomList")
|
||||
Observable<ResponseModel<List<SudRoomListModel>>> searchRoomList(
|
||||
@Query("sud_game_id") String sudGameId,
|
||||
@Query("threshold") String threshold,
|
||||
@Query("room_holder_type") String roomHolderType,
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("search") String search,
|
||||
@Query("page") int page
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
@ -2261,6 +2261,28 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void searchRoomList(String sudGameId, String threshold, String roomHolderType, String search, int page, HttpCallback<List<SudRoomListModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.searchRoomList(sudGameId,threshold,roomHolderType,"0",search,page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<SudRoomListModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<SudRoomListModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
|
8
common/src/main/res/drawable/bg_home_search_input.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="#F0E7E5" />
|
||||
<stroke
|
||||
android:width="0.5dp"
|
||||
android:color="#C2BDBC" />
|
||||
</shape>
|
9
common/src/main/res/drawable/bg_home_search_not.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="150dp" android:height="44dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ff000000" />
|
||||
<corners android:topLeftRadius="22dp" android:topRightRadius="22dp" android:bottomLeftRadius="22dp" android:bottomRightRadius="22dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
5
common/src/main/res/drawable/bg_home_sud_list_btn.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="6dp" />
|
||||
<solid android:color="#fff" />
|
||||
</shape>
|
7
common/src/main/res/drawable/bg_home_sud_list_sill.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:bottomLeftRadius="12dp"
|
||||
android:topRightRadius="12dp" />
|
||||
<solid android:color="#FFE6A3" />
|
||||
</shape>
|
9
common/src/main/res/drawable/bg_item_search_history.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="51dp" android:height="28dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ffe7e0df" />
|
||||
<corners android:topLeftRadius="14dp" android:topRightRadius="14dp" android:bottomLeftRadius="14dp" android:bottomRightRadius="14dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="#F0E7E5" />
|
||||
</shape>
|
127
common/src/main/res/layout/dialog_home_create_sud_game.xml
Normal file
@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="486dp"
|
||||
android:background="@mipmap/bg_main_home_sub_game"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/interactive_game_create_room"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:src="@mipmap/icon_interactive_game_create_room_back" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="50dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/interactive_game_create_room_name"
|
||||
android:textColor="#000"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/room_name"
|
||||
android:layout_width="175dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/bg_live_sud_list_input"
|
||||
android:hint="@string/interactive_game_create_room_name_input"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="9dp"
|
||||
android:paddingBottom="9dp"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="#FFFFFF"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="26dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/interactive_game_create_game_type"
|
||||
android:textColor="#000"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/create_game_type"
|
||||
android:layout_width="175dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/bg_live_sud_list_input"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="9dp"
|
||||
android:paddingBottom="9dp"
|
||||
android:text="@string/interactive_game_create_game_select"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="26dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/interactive_game_create_game_sill"
|
||||
android:textColor="#000"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/game_sill"
|
||||
android:layout_width="175dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/bg_live_sud_list_input"
|
||||
android:hint="@string/interactive_game_create_gold_bean_quantity"
|
||||
android:inputType="numberDecimal"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="9dp"
|
||||
android:paddingBottom="9dp"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="#FFFFFF"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/create_room"
|
||||
android:layout_width="112dp"
|
||||
android:layout_height="39dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="40dp"
|
||||
android:background="@mipmap/icon_create_sud_game"
|
||||
android:gravity="center"
|
||||
android:text="@string/interactive_game_create_room"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
123
common/src/main/res/layout/dialog_home_search_sud_game.xml
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="486dp"
|
||||
android:background="@mipmap/bg_main_home_sub_game"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/interactive_game_search_room"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_back"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:src="@mipmap/icon_interactive_game_create_room_back" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/bg_home_search_input">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="11dp"
|
||||
android:src="@mipmap/ic_home_game_search" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_search"
|
||||
android:layout_width="266dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_live_sud_list_input_home"
|
||||
android:hint="@string/interactive_game_search_room_name_input"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingTop="9dp"
|
||||
android:paddingBottom="9dp"
|
||||
android:textColor="#000"
|
||||
android:textColorHint="#000"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_history"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/interactive_game_search_history"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/list_history"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:spanCount="3"
|
||||
tools:itemCount="5"
|
||||
tools:layoutManager="GridLayoutManager"
|
||||
tools:listitem="@layout/item_search_history" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_history_empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<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"
|
||||
android:paddingEnd="30dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:text="暫未搜索結果~"
|
||||
android:textColor="#CCFFFFFF"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/list_room"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
</LinearLayout>
|
158
common/src/main/res/layout/item_home_sud_game_list.xml
Normal file
@ -0,0 +1,158 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="88dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@mipmap/background_home_sud_game_list"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="55dp"
|
||||
android:layout_height="55dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="17dp">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_oval="true" />
|
||||
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/btn_live"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@mipmap/icon_user_home_living"
|
||||
android:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sex"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_gravity="bottom|end" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/room_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/interactive_game_create_room_name"
|
||||
android:textColor="#000"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/player_we_are"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/interactive_game_player_we_are"
|
||||
android:textColor="#B3000000"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="79dp"
|
||||
android:layout_height="20dp">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar_list1"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_oval="true" />
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar_list2"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="-6dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_oval="true" />
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar_list3"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="-6dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_oval="true" />
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar_list4"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="-6dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_oval="true" />
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar_list5"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="-6dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_oval="true" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/avatar_list"
|
||||
android:layout_width="76dp"
|
||||
android:layout_height="20dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/player_we_are_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/interactive_game_player_we_are_2"
|
||||
android:textColor="#000"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="26dp"
|
||||
android:background="@drawable/bg_home_sud_list_sill"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/golden_bean_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:text="1000"
|
||||
android:textColor="#FF8000"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="13dp"
|
||||
android:layout_marginStart="2dp"
|
||||
android:background="@mipmap/gold_coin" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
24
common/src/main/res/layout/item_search_history.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@drawable/bg_item_search_history">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/history"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="13dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
tools:text="@tools:sample/full_names"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
After Width: | Height: | Size: 14 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/ic_home_game_search.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 713 B |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 5.4 KiB |
BIN
common/src/main/res/mipmap-xxxhdpi/bg_main_home_sub_game.png
Normal file
After Width: | Height: | Size: 39 KiB |
@ -1211,7 +1211,7 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="red_packet_info_residue_none">None</string>
|
||||
<string name="red_packet_info_residue_back">Return to account</string>
|
||||
<string name="red_packet_user_tips2">Popularity Red packet</string>
|
||||
<string name="main_tabs_red_packet">Red packets</string>
|
||||
<string name="main_tabs_red_packet">Game</string>
|
||||
<string name="save_popular_red_packets">Popular red packets</string>
|
||||
<string name="amount">amount</string>
|
||||
<string name="drill">Diamonds</string>
|
||||
|
@ -1206,7 +1206,7 @@
|
||||
<string name="red_packet_info_residue_none">無</string>
|
||||
<string name="red_packet_info_residue_back">退回賬戶</string>
|
||||
<string name="red_packet_user_tips2">攢人氣紅包</string>
|
||||
<string name="main_tabs_red_packet">紅包專區</string>
|
||||
<string name="main_tabs_red_packet">遊戲專區</string>
|
||||
<string name="save_popular_red_packets">攢人氣紅包</string>
|
||||
<string name="amount">金額</string>
|
||||
<string name="drill">鑚</string>
|
||||
|
@ -1205,7 +1205,7 @@
|
||||
<string name="red_packet_info_residue_none">無</string>
|
||||
<string name="red_packet_info_residue_back">退回賬戶</string>
|
||||
<string name="red_packet_user_tips2">攢人氣紅包</string>
|
||||
<string name="main_tabs_red_packet">紅包專區</string>
|
||||
<string name="main_tabs_red_packet">遊戲專區</string>
|
||||
<string name="save_popular_red_packets">攢人氣紅包</string>
|
||||
<string name="amount">金額</string>
|
||||
<string name="drill">鑚</string>
|
||||
@ -1313,4 +1313,5 @@
|
||||
<string name="live_mic_anchor_to_user_dialog">主播:</string>
|
||||
<string name="trial_coupon">是否使用試用劵</string>
|
||||
<string name="use_diamonds">使用鑽石</string>
|
||||
<string name="interactive_game_search_room">搜索房間</string>
|
||||
</resources>
|
||||
|
@ -1206,7 +1206,7 @@
|
||||
<string name="red_packet_info_residue_none">無</string>
|
||||
<string name="red_packet_info_residue_back">退回賬戶</string>
|
||||
<string name="red_packet_user_tips2">攢人氣紅包</string>
|
||||
<string name="main_tabs_red_packet">紅包專區</string>
|
||||
<string name="main_tabs_red_packet">遊戲專區</string>
|
||||
<string name="save_popular_red_packets">攢人氣紅包</string>
|
||||
<string name="red_packet_value">價值</string>
|
||||
<string name="top_up_now">去充值></string>
|
||||
|
@ -1212,7 +1212,7 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="red_packet_info_residue_none">None</string>
|
||||
<string name="red_packet_info_residue_back">Return to account</string>
|
||||
<string name="red_packet_user_tips2">Popularity Red packet</string>
|
||||
<string name="main_tabs_red_packet">Red packets</string>
|
||||
<string name="main_tabs_red_packet">Game</string>
|
||||
<string name="save_popular_red_packets">Popular red packets</string>
|
||||
<string name="amount">amount</string>
|
||||
<string name="drill">Diamonds</string>
|
||||
@ -1344,4 +1344,7 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="interactive_game_player">玩家</string>
|
||||
<string name="interactive_game_player_we_are">%s人組隊中,一起來玩吧</string>
|
||||
<string name="interactive_game_player_we_are_2">%s人在綫</string>
|
||||
<string name="interactive_game_search_room">搜索房間</string>
|
||||
<string name="interactive_game_search_history">搜索历史</string>
|
||||
<string name="interactive_game_search_room_name_input">請輸入您要搜索的房主昵稱、房主ID或房間名</string>
|
||||
</resources>
|
||||
|
@ -26,5 +26,6 @@ ext {
|
||||
//是否上报异常日志
|
||||
isUploadLog : true,
|
||||
//是否打包成插件包模式
|
||||
isPluginModel : true, ]
|
||||
isPluginModel : true,
|
||||
]
|
||||
}
|
||||
|
@ -0,0 +1,334 @@
|
||||
package com.yunbao.main.views;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.DrawableImageViewTarget;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.enums.PopupPosition;
|
||||
import com.ms.banner.Banner;
|
||||
import com.ms.banner.listener.OnBannerClickListener;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.BannerBean;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.LiveClassBean;
|
||||
import com.yunbao.common.bean.WeekListBean;
|
||||
import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.custom.ItemDecoration;
|
||||
import com.yunbao.common.dialog.CreateSudGamePopup;
|
||||
import com.yunbao.common.dialog.SudGameListSelectPopup;
|
||||
import com.yunbao.common.dialog.SudGameSearchDialogPopup;
|
||||
import com.yunbao.common.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.common.event.RoomHolderTypeEvent;
|
||||
import com.yunbao.common.event.SudGameListEvent;
|
||||
import com.yunbao.common.event.SudGameListSillEvent;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.LiveClassManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.CustomViewHolder;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.live.utils.LiveStorge;
|
||||
import com.yunbao.live.views.LiveRoomViewHolder;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.activity.MainActivity;
|
||||
import com.yunbao.main.adapter.MainHomeLiveAdapter;
|
||||
import com.yunbao.main.adapter.MainHomeLivesClassAdapter;
|
||||
import com.yunbao.main.http.MainHttpConsts;
|
||||
import com.yunbao.main.http.MainHttpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/22.
|
||||
* MainActivity 首页 游戏
|
||||
*/
|
||||
|
||||
public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener<LiveBean> {
|
||||
|
||||
private CommonRefreshView mRefreshView;
|
||||
private ImageView roomGameArrow, roomSillArrow, houseOwnerArrow;
|
||||
private TextView gameTitle, sillTitle, houseOwnerTitle;
|
||||
private long interactionID = 0;
|
||||
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
|
||||
private String mSill = "0,0", mSillName, roomHolderType = "0", roomHolderTypeName;
|
||||
private long animDuration = 500;
|
||||
private String id = "0";
|
||||
|
||||
public MainHomeGameViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
Bus.getOn(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.view_main_home_sud_game_list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
initData();
|
||||
roomGameArrow = (ImageView) findViewById(R.id.room_game_arrow);
|
||||
roomSillArrow = (ImageView) findViewById(R.id.room_sill_arrow);
|
||||
houseOwnerArrow = (ImageView) findViewById(R.id.house_owner_arrow);
|
||||
gameTitle = (TextView) findViewById(R.id.game_title);
|
||||
sillTitle = (TextView) findViewById(R.id.room_sill_text);
|
||||
houseOwnerTitle = (TextView) findViewById(R.id.house_owner_text);
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_room_game), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 0f, 90f);
|
||||
animator.setDuration(animDuration);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
XPopup.Builder builder = new XPopup.Builder(mContext).atView(findViewById(com.yunbao.common.R.id.interactive_game_room_game));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(mContext, 0, customSidebarChildModels, interactionID)
|
||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
closeAnimSudGameListEvent();
|
||||
}
|
||||
})
|
||||
)
|
||||
.show();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.room_sill), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(roomSillArrow, "rotation", 0f, 90f);
|
||||
animator.setDuration(animDuration);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
XPopup.Builder builder = new XPopup.Builder(mContext).atView(findViewById(com.yunbao.common.R.id.room_sill));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(mContext, 1, mSillName).setOnDismissListener(dialog -> {
|
||||
closeAnimSudGameListSillEvent();
|
||||
}))
|
||||
.show();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.house_owner), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(houseOwnerArrow, "rotation", 0f, 90f);
|
||||
animator.setDuration(animDuration);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
XPopup.Builder builder = new XPopup.Builder(mContext).atView(findViewById(com.yunbao.common.R.id.house_owner));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(mContext, 2, roomHolderTypeName).setOnDismissListener(dialog -> {
|
||||
closeAnimRoomHolderTypeEvent();
|
||||
}))
|
||||
.show();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_add), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
new XPopup.Builder(mContext)
|
||||
.enableDrag(false)
|
||||
.asCustom(new CreateSudGamePopup(mContext, customSidebarChildModels).setHomeView(true))
|
||||
|
||||
.show();
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.search), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
new SudGameSearchDialogPopup(mContext).showDialog();
|
||||
}
|
||||
});
|
||||
|
||||
LiveNetManager.get(mContext)
|
||||
.getCustomSidebarInfo("1", new HttpCallback<List<CustomSidebarInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<CustomSidebarInfoModel> data) {
|
||||
for (CustomSidebarInfoModel datum : data) {
|
||||
if (datum.getType().equals("6")) {
|
||||
customSidebarChildModels = datum.getChild();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListEvent(SudGameListEvent event) {
|
||||
interactionID = event.getInteractionID();
|
||||
gameTitle.setText(event.getTitle().substring(0, 2));
|
||||
id = event.getId();
|
||||
initData();
|
||||
closeAnimSudGameListEvent();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListSillEvent(SudGameListSillEvent event) {
|
||||
mSill = event.getSill();
|
||||
mSillName = event.getSillName();
|
||||
if (TextUtils.equals("0,0", mSill)) {
|
||||
sillTitle.setText(mSillName);
|
||||
} else {
|
||||
sillTitle.setText(mSillName.substring(0, mSillName.length() - 2));
|
||||
}
|
||||
closeAnimSudGameListSillEvent();
|
||||
initData();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRoomHolderTypeEvent(RoomHolderTypeEvent event) {
|
||||
roomHolderType = event.getRoomHolderType();
|
||||
roomHolderTypeName = event.getRoomHolderTypeName();
|
||||
houseOwnerTitle.setText(roomHolderTypeName);
|
||||
initData();
|
||||
closeAnimRoomHolderTypeEvent();
|
||||
}
|
||||
|
||||
private void closeAnimSudGameListEvent() {
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 90f, 0f);
|
||||
animator.setDuration(animDuration);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
}
|
||||
|
||||
private void closeAnimSudGameListSillEvent() {
|
||||
ObjectAnimator backAnimator = ObjectAnimator.ofFloat(roomSillArrow, "rotation", 90f, 0f);
|
||||
backAnimator.setDuration(animDuration);
|
||||
backAnimator.setInterpolator(new LinearInterpolator());
|
||||
backAnimator.start();
|
||||
}
|
||||
|
||||
private void closeAnimRoomHolderTypeEvent() {
|
||||
ObjectAnimator backAnimator = ObjectAnimator.ofFloat(houseOwnerArrow, "rotation", 90f, 0f);
|
||||
backAnimator.setDuration(animDuration);
|
||||
backAnimator.setInterpolator(new LinearInterpolator());
|
||||
backAnimator.start();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemClick(LiveBean bean, int position) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void loadData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
Bus.getOff(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
release();
|
||||
}
|
||||
|
||||
//显示顶部商城tab时,显示底部tabGroup
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onUpdata(String str) {
|
||||
if ("Updata".equals(str)) {
|
||||
if (mRefreshView != null) {
|
||||
mRefreshView.showRefreshBar();
|
||||
mRefreshView.mRecyclerView.scrollToPosition(0);
|
||||
}
|
||||
} else if ("blacklist".equals(str)) {
|
||||
if (mRefreshView != null) {
|
||||
mRefreshView.showRefreshBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
|
||||
private MainHomeFollLiveViewHolder mainHomeFollLiveViewHolder;
|
||||
private MainHomeLiveViewHolder mainHomeLiveViewHolder;
|
||||
private MainHomeRecomLiveViewHolder mainHomeRecomLiveViewHolder;
|
||||
private MainHomeRedPacketLiveViewHolder mainHomeRedPacketLiveViewHolder;
|
||||
private MainHomeGameViewHolder mainHomeGameLiveViewHolder;
|
||||
private final String mPageName = "home_page";
|
||||
private ImageView img_trophy;
|
||||
|
||||
@ -85,8 +85,8 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
|
||||
vh = mainHomeRecomLiveViewHolder;
|
||||
|
||||
} else if (position == 3) {
|
||||
mainHomeRedPacketLiveViewHolder = new MainHomeRedPacketLiveViewHolder(mContext, parent);
|
||||
vh = mainHomeRedPacketLiveViewHolder;
|
||||
mainHomeGameLiveViewHolder = new MainHomeGameViewHolder(mContext, parent);
|
||||
vh = mainHomeGameLiveViewHolder;
|
||||
|
||||
}
|
||||
|
||||
|
191
main/src/main/res/layout/view_main_home_sud_game_list.xml
Normal file
@ -0,0 +1,191 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/bg_main_home_sub_game"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/interactive_game_room_list"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/search"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="14dp"
|
||||
android:src="@mipmap/icon_home_interactive_game_search" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/interactive_game_add"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="14dp"
|
||||
android:src="@mipmap/icon_home_interactive_game_add" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:src="@mipmap/icon_home_interactive_game_ranking" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="14dp"
|
||||
android:text="@string/interactive_game_room_game"
|
||||
android:textColor="#000"
|
||||
android:textStyle="bold"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/interactive_game_room_game"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="@drawable/bg_home_sud_list_btn"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/game_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:text="@string/interactive_game_room_game_all"
|
||||
android:textColor="#000"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/room_game_arrow"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:src="@mipmap/icon_home_interactive_game_arrow" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:text="@string/interactive_game_room_sill"
|
||||
android:textColor="#000"
|
||||
android:textStyle="bold"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/room_sill"
|
||||
android:layout_width="74dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="@drawable/bg_home_sud_list_btn">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/room_sill_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="6dp"
|
||||
android:text="@string/interactive_game_create_unlimited"
|
||||
android:textColor="#000"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/room_sill_arrow"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@mipmap/icon_home_interactive_game_arrow" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:text="@string/interactive_game_room_house_owner"
|
||||
android:textColor="#000"
|
||||
android:textStyle="bold"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/house_owner"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="@drawable/bg_home_sud_list_btn"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/house_owner_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:text="@string/interactive_game_create_unlimited"
|
||||
android:textColor="#000"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/house_owner_arrow"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:src="@mipmap/icon_home_interactive_game_arrow" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.yunbao.common.custom.CommonRefreshView
|
||||
android:id="@+id/refreshView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:layout_width="174dp"
|
||||
android:layout_height="61dp"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:layout_marginBottom="80dp"
|
||||
android:background="@mipmap/icon_interactive_game_room_random_start"
|
||||
android:gravity="center"
|
||||
android:text="@string/interactive_game_room_random_start"
|
||||
android:textColor="#FF8100"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/refreshView"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|