咱提
This commit is contained in:
parent
54ee2fb0b7
commit
af8ac39e9c
@ -0,0 +1,87 @@
|
|||||||
|
package com.yunbao.common.adapter;
|
||||||
|
|
||||||
|
import static com.yunbao.common.utils.StringUtil.isEmpty;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
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.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cxf on 2019/4/22.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class LiveDataHistoryAdapter extends RecyclerView.Adapter<LiveDataHistoryAdapter.Vh> {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private List<LiveDataHistoryBean> mList;
|
||||||
|
private LayoutInflater mInflater;
|
||||||
|
|
||||||
|
public LiveDataHistoryAdapter(Context context, List<LiveDataHistoryBean> list) {
|
||||||
|
mContext = context;
|
||||||
|
mInflater = LayoutInflater.from(context);
|
||||||
|
mList = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataCollection(List<LiveDataHistoryBean> data) {
|
||||||
|
if (data == null) {
|
||||||
|
data = new ArrayList();
|
||||||
|
}
|
||||||
|
this.mList = data;
|
||||||
|
this.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
return new Vh(mInflater.inflate(R.layout.live_data_history_item, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull Vh holder, @SuppressLint("RecyclerView") int position) {
|
||||||
|
if (isEmpty() || mList.isEmpty()) {
|
||||||
|
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.giftName.setText(mList.get(position).getGiftname());
|
||||||
|
holder.income.setText(String.valueOf(mList.get(position).getAnchor_profit_coin()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
class Vh extends RecyclerView.ViewHolder {
|
||||||
|
private TextView time;
|
||||||
|
private TextView giftTypeName;
|
||||||
|
private TextView giftName;
|
||||||
|
private TextView income;
|
||||||
|
|
||||||
|
public Vh(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
time = itemView.findViewById(R.id.time);
|
||||||
|
giftTypeName = itemView.findViewById(R.id.giftTypeName);
|
||||||
|
giftName = itemView.findViewById(R.id.giftName);
|
||||||
|
income = itemView.findViewById(R.id.income);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直播数据
|
||||||
|
*/
|
||||||
|
public class LiveDataHistoryBean extends BaseModel {
|
||||||
|
private String giftid;
|
||||||
|
private String anchor_profit_coin;
|
||||||
|
private String addtime;
|
||||||
|
private String giftname;
|
||||||
|
private String action;
|
||||||
|
|
||||||
|
public String getGiftid() {
|
||||||
|
return giftid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGiftid(String giftid) {
|
||||||
|
this.giftid = giftid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAnchor_profit_coin() {
|
||||||
|
return anchor_profit_coin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnchor_profit_coin(String anchor_profit_coin) {
|
||||||
|
this.anchor_profit_coin = anchor_profit_coin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddtime() {
|
||||||
|
return addtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddtime(String addtime) {
|
||||||
|
this.addtime = addtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGiftname() {
|
||||||
|
return giftname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGiftname(String giftname) {
|
||||||
|
this.giftname = giftname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAction(String action) {
|
||||||
|
this.action = action;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,111 @@
|
|||||||
|
package com.yunbao.common.fragment;
|
||||||
|
|
||||||
|
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.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.adapter.LiveDataHistoryAdapter;
|
||||||
|
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 java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.rong.imkit.widget.refresh.SmartRefreshLayout;
|
||||||
|
import io.rong.imkit.widget.refresh.api.RefreshLayout;
|
||||||
|
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;//页数
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View createView(LayoutInflater inflater, ViewGroup container) {
|
||||||
|
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);
|
||||||
|
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() {
|
||||||
|
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||||
|
mPageCount = 1;
|
||||||
|
initData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
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() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
if (code == 0 && info != null) {
|
||||||
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
|
if(){
|
||||||
|
|
||||||
|
}
|
||||||
|
list = JSON.parseArray(obj.getString("data"), LiveDataHistoryBean.class);
|
||||||
|
adapter.setDataCollection(list);
|
||||||
|
mRefreshLayout.finishRefresh(true);
|
||||||
|
} else {
|
||||||
|
ToastUtil.show(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -723,6 +723,16 @@ public class CommonHttpUtil {
|
|||||||
.execute(callback);
|
.execute(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*获取聊天列表用户在线状态
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
public static void getLiveDataHistoryList(String stream,String page,HttpCallback callback) {
|
||||||
|
HttpClient.getInstance().get("live.getLiveGiftList", "live.getLiveGiftList")
|
||||||
|
.params("stream",stream)
|
||||||
|
.params("page",page)
|
||||||
|
.execute(callback);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4244,7 +4244,6 @@ public class LiveNetManager {
|
|||||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getSwToken( HttpCallback<SwTokenModel> callback) {
|
public void getSwToken( HttpCallback<SwTokenModel> callback) {
|
||||||
API.get().pdLiveApi(mContext)
|
API.get().pdLiveApi(mContext)
|
||||||
.getSwToken()
|
.getSwToken()
|
||||||
@ -4266,10 +4265,8 @@ public class LiveNetManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).isDisposed();
|
}).isDisposed();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取开播提示信息
|
* 获取开播提示信息
|
||||||
*/
|
*/
|
||||||
@ -4293,7 +4290,6 @@ public class LiveNetManager {
|
|||||||
}).isDisposed();
|
}).isDisposed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 直播间取消网络请求
|
* 直播间取消网络请求
|
||||||
*/
|
*/
|
||||||
|
68
common/src/main/res/layout/live_data_history_item.xml
Normal file
68
common/src/main/res/layout/live_data_history_item.xml
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?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:id="@+id/rc_conversation_item"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<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:ellipsize="end"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textColor="#92949A"
|
||||||
|
android:textSize="12dp"
|
||||||
|
tools:text="2022-06-15\n16:26:15" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/giftTypeName"
|
||||||
|
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="#92949A"
|
||||||
|
android:textSize="12dp"
|
||||||
|
tools:text="分類" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/giftName"
|
||||||
|
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="#92949A"
|
||||||
|
android:textSize="12dp"
|
||||||
|
tools:text="禮物" />
|
||||||
|
|
||||||
|
<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:ellipsize="end"
|
||||||
|
android:gravity="end|center"
|
||||||
|
android:textColor="#92949A"
|
||||||
|
android:textSize="12dp"
|
||||||
|
tools:text="10000" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,90 @@
|
|||||||
|
<?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"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/titleLayout"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
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: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: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: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" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/line"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_below="@+id/titleLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="#525252"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_height="0.5dp"/>
|
||||||
|
|
||||||
|
<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_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rc_conversation_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
tools:listitem="@layout/live_data_history_item" />
|
||||||
|
</io.rong.imkit.widget.refresh.SmartRefreshLayout>
|
||||||
|
</RelativeLayout>
|
@ -1479,4 +1479,6 @@ Limited ride And limited avatar frame</string>
|
|||||||
<string name="live_interaction_Interaction">Interaction</string>
|
<string name="live_interaction_Interaction">Interaction</string>
|
||||||
<string name="live_interaction_broadcaster_rights">Broadcaster Rights</string>
|
<string name="live_interaction_broadcaster_rights">Broadcaster Rights</string>
|
||||||
<string name="live_interaction_tools">Live streaming tools</string>
|
<string name="live_interaction_tools">Live streaming tools</string>
|
||||||
|
<string name="live_data_now_data">本場數據</string>
|
||||||
|
<string name="live_data_gift_history">禮物記錄</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1609,5 +1609,7 @@
|
|||||||
<string name="live_interaction_Interaction">互動</string>
|
<string name="live_interaction_Interaction">互動</string>
|
||||||
<string name="live_interaction_broadcaster_rights">主播權益</string>
|
<string name="live_interaction_broadcaster_rights">主播權益</string>
|
||||||
<string name="live_interaction_tools">直播工具</string>
|
<string name="live_interaction_tools">直播工具</string>
|
||||||
|
<string name="live_data_now_data">本場數據</string>
|
||||||
|
<string name="live_data_gift_history">禮物記錄</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1417,5 +1417,7 @@ Limited ride And limited avatar frame</string>
|
|||||||
<string name="live_interaction_Interaction">Interaction</string>
|
<string name="live_interaction_Interaction">Interaction</string>
|
||||||
<string name="live_interaction_broadcaster_rights">Broadcaster Rights</string>
|
<string name="live_interaction_broadcaster_rights">Broadcaster Rights</string>
|
||||||
<string name="live_interaction_tools">Live streaming tools</string>
|
<string name="live_interaction_tools">Live streaming tools</string>
|
||||||
|
<string name="live_data_now_data">本場數據</string>
|
||||||
|
<string name="live_data_gift_history">禮物記錄</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,32 +1,67 @@
|
|||||||
package com.yunbao.live.dialog;
|
package com.yunbao.live.dialog;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.Spanned;
|
||||||
|
import android.text.TextPaint;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
|
import android.text.style.ClickableSpan;
|
||||||
|
import android.text.style.ImageSpan;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
|
import androidx.viewpager2.widget.ViewPager2;
|
||||||
|
|
||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||||
|
import com.yunbao.common.fragment.AbsMainMessageChatListFragment;
|
||||||
|
import com.yunbao.common.fragment.BaseFragment;
|
||||||
|
import com.yunbao.common.fragment.LiveDataHistoryFragment;
|
||||||
|
import com.yunbao.common.fragment.MainMessageChatListFragment;
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.utils.AppManager;
|
||||||
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.utils.ViewPageIndicatorUtils;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.adapter.LiveDataInfoRecyclerAdapter;
|
import com.yunbao.live.adapter.LiveDataInfoRecyclerAdapter;
|
||||||
import com.yunbao.live.bean.LiveDataInfoModel;
|
import com.yunbao.live.bean.LiveDataInfoModel;
|
||||||
|
|
||||||
|
|
||||||
|
import net.lucode.hackware.magicindicator.MagicIndicator;
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator;
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView;
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.SimplePagerTitleView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class LiveDataInfoDialog extends AbsDialogPopupWindow {
|
public class LiveDataInfoDialog extends AbsDialogPopupWindow {
|
||||||
private ImageView img;
|
|
||||||
private RecyclerView recyclerView;
|
private RecyclerView recyclerView;
|
||||||
private LiveDataInfoRecyclerAdapter adapter;
|
private LiveDataInfoRecyclerAdapter adapter;
|
||||||
private List<LiveDataInfoModel> list;
|
private List<LiveDataInfoModel> list;
|
||||||
private String liveUid;
|
private String liveUid;
|
||||||
|
|
||||||
|
private ViewPager2 viewPager;
|
||||||
|
private MagicIndicator mIndicator;
|
||||||
|
private List<BaseFragment> fragmentList = new ArrayList<>();
|
||||||
|
|
||||||
public LiveDataInfoDialog(@NonNull Context context) {
|
public LiveDataInfoDialog(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
@ -52,8 +87,75 @@ public class LiveDataInfoDialog extends AbsDialogPopupWindow {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate() {
|
protected void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
img = findViewById(R.id.live_data_img);
|
final String[] titles = new String[]{WordUtil.getNewString(R.string.live_data_now_data), WordUtil.getNewString(R.string.live_data_gift_history)};
|
||||||
img.setImageResource(R.mipmap.icon_free_pk_waring);
|
fragmentList.add(new LiveDataHistoryFragment(mContext));
|
||||||
|
fragmentList.add(new LiveDataHistoryFragment(mContext));
|
||||||
|
|
||||||
|
mIndicator = findViewById(R.id.indicator);
|
||||||
|
viewPager = findViewById(R.id.viewPager);
|
||||||
|
|
||||||
|
viewPager.setAdapter(new FragmentStateAdapter((FragmentActivity) AppManager.getInstance().getMainActivity()) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return fragmentList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Fragment createFragment(int i) {
|
||||||
|
return fragmentList.get(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
viewPager.setCurrentItem(1);
|
||||||
|
viewPager.setUserInputEnabled(false);
|
||||||
|
|
||||||
|
CommonNavigator commonNavigator = new CommonNavigator(mContext);
|
||||||
|
commonNavigator.setAdjustMode(true);
|
||||||
|
commonNavigator.setAdapter(new CommonNavigatorAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return titles.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPagerTitleView getTitleView(Context context, final int index) {
|
||||||
|
SimplePagerTitleView simplePagerTitleView = new ColorTransitionPagerTitleView(context);
|
||||||
|
simplePagerTitleView.setNormalColor(Color.parseColor("#777777"));
|
||||||
|
simplePagerTitleView.setSelectedColor(Color.parseColor("#333333"));
|
||||||
|
simplePagerTitleView.setText(titles[index]);
|
||||||
|
simplePagerTitleView.setTextSize(15);
|
||||||
|
simplePagerTitleView.getPaint().setFakeBoldText(true);
|
||||||
|
simplePagerTitleView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (viewPager != null) {
|
||||||
|
viewPager.setCurrentItem(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return simplePagerTitleView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPagerIndicator getIndicator(Context context) {
|
||||||
|
LinePagerIndicator linePagerIndicator = new LinePagerIndicator(context);
|
||||||
|
linePagerIndicator.setMode(LinePagerIndicator.MODE_WRAP_CONTENT);
|
||||||
|
linePagerIndicator.setXOffset(DpUtil.dp2px(5));
|
||||||
|
linePagerIndicator.setRoundRadius(DpUtil.dp2px(2));
|
||||||
|
linePagerIndicator.setColors(Color.parseColor("#EB6FFF"), Color.parseColor("#FF83C6"));
|
||||||
|
return linePagerIndicator;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mIndicator.setNavigator(commonNavigator);
|
||||||
|
ViewPageIndicatorUtils.bind(mIndicator, viewPager, new ViewPager2.OnPageChangeCallback() {
|
||||||
|
@Override
|
||||||
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
recyclerView = findViewById(R.id.live_data_list);
|
recyclerView = findViewById(R.id.live_data_list);
|
||||||
adapter = new LiveDataInfoRecyclerAdapter(getContext());
|
adapter = new LiveDataInfoRecyclerAdapter(getContext());
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
android:background="#000002">
|
android:background="#000002">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -19,6 +18,19 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<net.lucode.hackware.magicindicator.MagicIndicator
|
||||||
|
android:id="@+id/indicator"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="37dp" />
|
||||||
|
|
||||||
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
|
android:id="@+id/viewPager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="50dp"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user