add[直播数据-当场数据、PK弹窗]
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
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.bean.LiveDataInfoNowModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LiveDataInfoRecyclerAdapter extends RecyclerView.Adapter<LiveDataInfoRecyclerAdapter.LiveDataHolder> {
|
||||
private Context mContext;
|
||||
private List<LiveDataInfoNowModel> list=new ArrayList<>();
|
||||
|
||||
public LiveDataInfoRecyclerAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
public void setList(List<LiveDataInfoNowModel> list) {
|
||||
this.list = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public LiveDataHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new LiveDataHolder(LayoutInflater.from(mContext).inflate(R.layout.item_live_data, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull LiveDataHolder holder, int position) {
|
||||
holder.setData(list.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public static class LiveDataHolder extends RecyclerView.ViewHolder {
|
||||
private TextView title, data;
|
||||
|
||||
public LiveDataHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
title = itemView.findViewById(R.id.item_title);
|
||||
data = itemView.findViewById(R.id.item_data);
|
||||
}
|
||||
|
||||
public void setData(LiveDataInfoNowModel model) {
|
||||
data.setText(model.getData());
|
||||
title.setText(model.getTitle());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
|
||||
public class LiveDataInfoNowModel extends BaseModel {
|
||||
private String color;
|
||||
private String title;
|
||||
private String data;
|
||||
|
||||
public LiveDataInfoNowModel(String color, String title, String data) {
|
||||
this.color = color;
|
||||
this.title = title;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public LiveDataInfoNowModel(String title, String data) {
|
||||
this.title = title;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public LiveDataInfoNowModel() {
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.yunbao.common.fragment;
|
||||
|
||||
import static com.umeng.commonsdk.stateless.UMSLEnvelopeBuild.mContext;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.LiveDataInfoRecyclerAdapter;
|
||||
import com.yunbao.common.bean.LiveDataInfoModel;
|
||||
import com.yunbao.common.bean.LiveDataInfoNowModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LiveDataNowFragment extends Fragment {
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
private LiveDataInfoRecyclerAdapter adapter;
|
||||
private List<LiveDataInfoNowModel> list;
|
||||
private String mLiveUid;
|
||||
private onDataResult onDataResult;
|
||||
|
||||
public LiveDataNowFragment(Context context, String liveUid,LiveDataNowFragment.onDataResult onDataResult) {
|
||||
this.mLiveUid = liveUid;
|
||||
this.onDataResult = onDataResult;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.live_data_now_fragment, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
recyclerView = view.findViewById(R.id.live_data_list);
|
||||
adapter = new LiveDataInfoRecyclerAdapter(getContext());
|
||||
recyclerView.setAdapter(adapter);
|
||||
initData();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
list = new ArrayList<>();
|
||||
list.add(new LiveDataInfoNowModel("#00FFFF", getContext().getString(R.string.live_data_coin), getContext().getString(R.string.live_data_loading)));
|
||||
list.add(new LiveDataInfoNowModel("#FFF69F", getContext().getString(R.string.live_data_gold), getContext().getString(R.string.live_data_loading)));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_accept), getContext().getString(R.string.live_data_loading)));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_enter), getContext().getString(R.string.live_data_loading)));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_attention), getContext().getString(R.string.live_data_loading)));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_attention_rate), getContext().getString(R.string.live_data_loading)));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_fan_group), getContext().getString(R.string.live_data_loading)));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_fan_group_rate), getContext().getString(R.string.live_data_loading)));
|
||||
adapter.setList(list);
|
||||
LiveNetManager.get(getContext())
|
||||
.getLiveData(mLiveUid, new HttpCallback<LiveDataInfoModel>() {
|
||||
@Override
|
||||
public void onSuccess(com.yunbao.common.bean.LiveDataInfoModel data) {
|
||||
list.clear();
|
||||
list.add(new LiveDataInfoNowModel("#00FFFF", getContext().getString(R.string.live_data_coin), data.getTotalCoin() + ""));
|
||||
list.add(new LiveDataInfoNowModel("#FFF69F", getContext().getString(R.string.live_data_gold), data.getTotalGold() + ""));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_accept), data.getAcceptNum() + ""));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_enter), data.getEnterNum() + ""));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_attention), data.getAttentionNum() + ""));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_attention_rate), data.getAttentionNumRate() + ""));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_fan_group), data.getFanGroupNum() + ""));
|
||||
list.add(new LiveDataInfoNowModel(getContext().getString(R.string.live_data_fan_group_rate), data.getFanGroupNumRate() + ""));
|
||||
adapter.setList(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface onDataResult{
|
||||
void Result(String countZs,String countPerson);
|
||||
}
|
||||
}
|
||||
31
common/src/main/res/layout/item_live_data.xml
Normal file
31
common/src/main/res/layout/item_live_data.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="14dp"
|
||||
android:paddingEnd="14dp"
|
||||
android:text="222"
|
||||
android:textColor="#92949A"
|
||||
android:textSize="11sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_marginTop="5dp"
|
||||
android:id="@+id/item_data"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="111"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
61
common/src/main/res/layout/live_data_now_fragment.xml
Normal file
61
common/src/main/res/layout/live_data_now_fragment.xml
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/live_data_msg1"
|
||||
android:textColor="#808080"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end|center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/live_data_img"
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="13dp"
|
||||
android:layout_marginEnd="5dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:textSize="14dp"
|
||||
android:text="@string/live_data_msg2"
|
||||
android:textColor="#595959" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/live_data_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:overScrollMode="never"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:spanCount="3"
|
||||
tools:listitem="@layout/item_live_data" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1485,4 +1485,8 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="live_data_history_type">type</string>
|
||||
<string name="live_data_history_name">name</string>
|
||||
<string name="live_data_history_gain">gain</string>
|
||||
|
||||
<string name="live_data_tip">* Non-real-time calculation of data</string>
|
||||
<string name="live_data_msg2">Historical data can be viewed in the anchor center</string>
|
||||
<string name="live_data_msg1">This live data statistics</string>
|
||||
</resources>
|
||||
|
||||
@@ -1615,5 +1615,8 @@
|
||||
<string name="live_data_history_type">分類</string>
|
||||
<string name="live_data_history_name">名稱</string>
|
||||
<string name="live_data_history_gain">收益</string>
|
||||
<string name="live_data_tip">* 人數及新增相關數據非实时计算</string>
|
||||
<string name="live_data_msg2">歷史數據可在主播中心查看</string>
|
||||
<string name="live_data_msg1">本場直播數據統計</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1424,4 +1424,7 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="live_data_history_name">name</string>
|
||||
<string name="live_data_history_gain">gain</string>
|
||||
|
||||
<string name="live_data_tip">* Non-real-time calculation of data</string>
|
||||
<string name="live_data_msg2">Historical data can be viewed in the anchor center</string>
|
||||
<string name="live_data_msg1">This live data statistics</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user