add[直播数据-送礼列表]
This commit is contained in:
@@ -14,11 +14,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.LiveDataHistoryBean;
|
||||
import com.yunbao.common.bean.LiveDataHistoryBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.ClipPathCircleImage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -30,12 +25,12 @@ import java.util.List;
|
||||
public class LiveDataHistoryAdapter extends RecyclerView.Adapter<LiveDataHistoryAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<LiveDataHistoryBean> mList;
|
||||
private List<LiveDataHistoryBean> mList= new ArrayList<>();
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
public LiveDataHistoryAdapter(Context context, List<LiveDataHistoryBean> list) {
|
||||
mContext = context;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mInflater = LayoutInflater.from(mContext);
|
||||
mList = list;
|
||||
}
|
||||
|
||||
@@ -59,7 +54,7 @@ public class LiveDataHistoryAdapter extends RecyclerView.Adapter<LiveDataHistory
|
||||
return;
|
||||
}
|
||||
holder.time.setText(mList.get(position).getAddtime().substring(0,9)+"\n"+mList.get(position).getAddtime().substring(10));
|
||||
holder.giftTypeName.setText(mList.get(position).getAction());
|
||||
holder.giftTypeName.setText(mList.get(position).getCateName());
|
||||
holder.giftName.setText(mList.get(position).getGiftname());
|
||||
holder.income.setText(String.valueOf(mList.get(position).getAnchor_profit_coin()));
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
/**
|
||||
* 直播数据
|
||||
*/
|
||||
@@ -8,7 +10,9 @@ public class LiveDataHistoryBean extends BaseModel {
|
||||
private String anchor_profit_coin;
|
||||
private String addtime;
|
||||
private String giftname;
|
||||
private String action;
|
||||
private String cate_name;
|
||||
private String english_cate_name;
|
||||
|
||||
|
||||
public String getGiftid() {
|
||||
return giftid;
|
||||
@@ -42,11 +46,19 @@ public class LiveDataHistoryBean extends BaseModel {
|
||||
this.giftname = giftname;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
public String getCateName() {
|
||||
return WordUtil.isNewZh()?cate_name:english_cate_name;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
public void setCate_name(String cate_name) {
|
||||
this.cate_name = cate_name;
|
||||
}
|
||||
|
||||
public String getEnglish_cate_name() {
|
||||
return english_cate_name;
|
||||
}
|
||||
|
||||
public void setEnglish_cate_name(String english_cate_name) {
|
||||
this.english_cate_name = english_cate_name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,12 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -18,6 +22,7 @@ import com.yunbao.common.bean.LiveDataHistoryBean;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.ViewUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -28,80 +33,78 @@ import io.rong.imkit.widget.refresh.listener.OnLoadMoreListener;
|
||||
import io.rong.imkit.widget.refresh.listener.OnRefreshListener;
|
||||
import io.rong.imkit.widget.refresh.wrapper.RongRefreshHeader;
|
||||
|
||||
public class LiveDataHistoryFragment extends BaseFragment {
|
||||
SmartRefreshLayout mRefreshLayout;
|
||||
RecyclerView mList;
|
||||
Context mContext;
|
||||
LiveDataHistoryAdapter adapter;
|
||||
List<LiveDataHistoryBean> list = new ArrayList<>();
|
||||
int mPageCount = 1;//页数
|
||||
public class LiveDataHistoryFragment extends Fragment {
|
||||
|
||||
protected SmartRefreshLayout mRefreshLayout;
|
||||
protected RecyclerView mList;
|
||||
private LiveDataHistoryAdapter mAdapter;
|
||||
List<LiveDataHistoryBean> list = new ArrayList<>();
|
||||
private View emptyView;
|
||||
private Context mContext;
|
||||
private String mStream;
|
||||
private int mPageCount = 1;//页数
|
||||
|
||||
public LiveDataHistoryFragment(Context context,String stream) {
|
||||
this.mContext =context;
|
||||
this.mStream = stream;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View createView(LayoutInflater inflater, ViewGroup container) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
emptyView = inflater.inflate(R.layout.view_layout_msg,container, false);
|
||||
ViewUtils.findViewById(emptyView,R.id.imageView, ImageView.class).setImageResource(R.mipmap.ic_addressbook_not_search);
|
||||
ViewUtils.findViewById(emptyView,R.id.textView, TextView.class).setText(R.string.not_data_message_address_book_list);
|
||||
return inflater.inflate(R.layout.live_data_history_list_fragment, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initVariables(Bundle bundle) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState, View contentView) {
|
||||
initView(contentView);
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mAdapter = new LiveDataHistoryAdapter(mContext,list);
|
||||
this.mList = (RecyclerView) view.findViewById(R.id.rc_conversation_list);
|
||||
this.mRefreshLayout = (SmartRefreshLayout) view.findViewById(R.id.rc_refresh);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(this.getActivity());
|
||||
this.mList.setLayoutManager(layoutManager);
|
||||
mList.setAdapter(mAdapter);
|
||||
initRefreshView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadData() {
|
||||
initData();
|
||||
}
|
||||
|
||||
public LiveDataHistoryFragment(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
private void initView(View view) {
|
||||
mRefreshLayout = view.findViewById(R.id.rc_refresh);
|
||||
mList = view.findViewById(R.id.rc_conversation_list);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(this.getActivity());
|
||||
mList.setLayoutManager(layoutManager);
|
||||
mList.setItemViewCacheSize(0);
|
||||
}
|
||||
|
||||
protected void initRefreshView() {
|
||||
mRefreshLayout.setNestedScrollingEnabled(false);
|
||||
mRefreshLayout.setRefreshHeader(new RongRefreshHeader(getContext()));
|
||||
mRefreshLayout.setRefreshFooter(new RongRefreshHeader(getContext()));
|
||||
mRefreshLayout.setEnableLoadMore(false);
|
||||
mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
||||
this.mRefreshLayout.setNestedScrollingEnabled(false);
|
||||
this.mRefreshLayout.setRefreshHeader(new RongRefreshHeader(this.getContext()));
|
||||
this.mRefreshLayout.setRefreshFooter(new RongRefreshHeader(this.getContext()));
|
||||
this.mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
mPageCount = 1;
|
||||
initData();
|
||||
}
|
||||
});
|
||||
mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
|
||||
this.mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
mPageCount++;
|
||||
initData();
|
||||
}
|
||||
});
|
||||
adapter = new LiveDataHistoryAdapter(mContext,list);
|
||||
mList.setAdapter(adapter);
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
CommonHttpUtil.getLiveDataHistoryList("","",new HttpCallback() {
|
||||
CommonHttpUtil.getLiveDataHistoryList(mStream, String.valueOf(mPageCount),new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info != null) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if(){
|
||||
|
||||
List<LiveDataHistoryBean> tempList = JSON.parseArray(obj.getString("data"), LiveDataHistoryBean.class);
|
||||
if(mPageCount==1){
|
||||
list = tempList;
|
||||
mAdapter.setDataCollection(list);
|
||||
mRefreshLayout.finishRefresh(true);
|
||||
}else{
|
||||
list.addAll(tempList);
|
||||
mAdapter.setDataCollection(list);
|
||||
mRefreshLayout.finishLoadMore(true);
|
||||
}
|
||||
list = JSON.parseArray(obj.getString("data"), LiveDataHistoryBean.class);
|
||||
adapter.setDataCollection(list);
|
||||
mRefreshLayout.finishRefresh(true);
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/rc_conversation_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
@@ -7,63 +7,64 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/titleLayout"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:paddingEnd="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="20dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="時間"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14dp" />
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="20dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="@string/live_data_history_time"
|
||||
android:textSize="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/giftTypeName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14dp"
|
||||
tools:text="分類" />
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12dp"
|
||||
android:text="@string/live_data_history_type"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/giftName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14dp"
|
||||
tools:text="禮物" />
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12dp"
|
||||
android:text="@string/live_data_history_name"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/income"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="0.7"
|
||||
android:gravity="end|center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14dp"
|
||||
tools:text="10000" />
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="0.7"
|
||||
android:ellipsize="end"
|
||||
android:gravity="end|center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12dp"
|
||||
android:text="@string/live_data_history_gain" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/line"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_below="@+id/titleLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:background="#525252"
|
||||
@@ -73,10 +74,8 @@
|
||||
|
||||
<io.rong.imkit.widget.refresh.SmartRefreshLayout
|
||||
android:id="@+id/rc_refresh"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_below="@+id/line"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
@@ -1479,6 +1479,10 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="live_interaction_Interaction">Interaction</string>
|
||||
<string name="live_interaction_broadcaster_rights">Broadcaster Rights</string>
|
||||
<string name="live_interaction_tools">Live streaming tools</string>
|
||||
<string name="live_data_now_data">本場數據</string>
|
||||
<string name="live_data_gift_history">禮物記錄</string>
|
||||
<string name="live_data_now_data">This data</string>
|
||||
<string name="live_data_gift_history">Gift Record</string>
|
||||
<string name="live_data_history_time">time</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>
|
||||
</resources>
|
||||
|
||||
@@ -1611,5 +1611,9 @@
|
||||
<string name="live_interaction_tools">直播工具</string>
|
||||
<string name="live_data_now_data">本場數據</string>
|
||||
<string name="live_data_gift_history">禮物記錄</string>
|
||||
<string name="live_data_history_time">時間</string>
|
||||
<string name="live_data_history_type">分類</string>
|
||||
<string name="live_data_history_name">名稱</string>
|
||||
<string name="live_data_history_gain">收益</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1417,7 +1417,11 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="live_interaction_Interaction">Interaction</string>
|
||||
<string name="live_interaction_broadcaster_rights">Broadcaster Rights</string>
|
||||
<string name="live_interaction_tools">Live streaming tools</string>
|
||||
<string name="live_data_now_data">本場數據</string>
|
||||
<string name="live_data_gift_history">禮物記錄</string>
|
||||
<string name="live_data_now_data">This data</string>
|
||||
<string name="live_data_gift_history">Gift Record</string>
|
||||
<string name="live_data_history_time">tory_time</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>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user