新增主播数据弹窗
This commit is contained in:
parent
79ded6bff4
commit
b2f779f58a
@ -17,6 +17,12 @@ public abstract class AbsDialogPopupWindow extends BottomPopupView {
|
||||
}
|
||||
|
||||
public abstract void buildDialog(XPopup.Builder builder);
|
||||
public abstract int bindLayoutId();
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return bindLayoutId();
|
||||
}
|
||||
|
||||
public void showDialog() {
|
||||
XPopup.Builder builder = new XPopup.Builder(mContext);
|
||||
|
@ -0,0 +1,66 @@
|
||||
package com.yunbao.live.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.live.R;
|
||||
import com.yunbao.live.bean.LiveDataInfoModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LiveDataInfoRecyclerAdapter extends RecyclerView.Adapter<LiveDataInfoRecyclerAdapter.LiveDataHolder> {
|
||||
private Context mContext;
|
||||
private List<LiveDataInfoModel> list;
|
||||
|
||||
public LiveDataInfoRecyclerAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
public void setList(List<LiveDataInfoModel> 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(LiveDataInfoModel model) {
|
||||
if (model.getColor() != null) {
|
||||
data.setText(Html.fromHtml("<font color='" + model.getColor() + "'>" + model.getData() + "</font>"));
|
||||
} else {
|
||||
data.setText(model.getData());
|
||||
}
|
||||
title.setText(model.getTitle());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class LiveDataInfoModel extends BaseModel {
|
||||
private String color;
|
||||
private String title;
|
||||
private String data;
|
||||
|
||||
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,65 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LiveDataInfoRecyclerAdapter;
|
||||
import com.yunbao.live.bean.LiveDataInfoModel;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LiveDataInfoDialog extends AbsDialogPopupWindow {
|
||||
private ImageView img;
|
||||
private RecyclerView recyclerView;
|
||||
private LiveDataInfoRecyclerAdapter adapter;
|
||||
private List<LiveDataInfoModel> list;
|
||||
|
||||
public LiveDataInfoDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_live_data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
img = findViewById(R.id.live_data_img);
|
||||
img.setImageResource(R.mipmap.icon_free_pk_waring);
|
||||
recyclerView = findViewById(R.id.live_data_list);
|
||||
adapter = new LiveDataInfoRecyclerAdapter(getContext());
|
||||
recyclerView.setAdapter(adapter);
|
||||
initData();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
list = new ArrayList<>();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
LiveDataInfoModel model = new LiveDataInfoModel();
|
||||
if (i == 0) {
|
||||
model.setColor("#00FFFF");
|
||||
} else if (i == 1) {
|
||||
model.setColor("#FFF69F");
|
||||
}
|
||||
model.setTitle("标题:" + i);
|
||||
model.setData("数据:" + i);
|
||||
list.add(model);
|
||||
}
|
||||
adapter.setList(list);
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
@ -23,7 +22,6 @@ import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.bean.LiveTaskModel;
|
||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LiveTaskRecyclerAdapter;
|
||||
@ -60,16 +58,17 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
||||
builder.enableDrag(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_live_task;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
initView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_live_task;
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
newStarTime = findViewById(R.id.task_new_star_time);
|
||||
|
@ -15,13 +15,13 @@ public class LiveTaskInfoDialog extends AbsDialogPopupWindow {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_live_task_info;
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_live_task_info;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
74
live/src/main/res/layout/dialog_live_data.xml
Normal file
74
live/src/main/res/layout/dialog_live_data.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:background="#000002">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="13dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="本場直播數據統計"
|
||||
android:textColor="#808080"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.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="10dp"
|
||||
tools:srcCompat="@mipmap/icon_free_pk_waring" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="歷史數據可在主播中心查看"
|
||||
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_marginBottom="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:overScrollMode="never"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:spanCount="2"
|
||||
tools:listitem="@layout/item_live_data" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
44
live/src/main/res/layout/item_live_data.xml
Normal file
44
live/src/main/res/layout/item_live_data.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/background_151515">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_data"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:text="111"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="14dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="14dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="222"
|
||||
android:textColor="#808080"
|
||||
android:textSize="14sp"
|
||||
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/item_data" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -14,6 +14,7 @@ import android.widget.TextView;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.dialog.LiveDataInfoDialog;
|
||||
import com.yunbao.live.dialog.LiveTaskDialog;
|
||||
|
||||
|
||||
@ -30,7 +31,8 @@ public class TestActivity extends AppCompatActivity {
|
||||
listView = new ListView(this);
|
||||
setContentView(listView);
|
||||
String[] strs = new String[]{
|
||||
"弹出主播任务"
|
||||
"弹出主播任务",
|
||||
"直播數據"
|
||||
};
|
||||
|
||||
listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, strs));
|
||||
@ -41,6 +43,9 @@ public class TestActivity extends AppCompatActivity {
|
||||
case 0:
|
||||
new LiveTaskDialog(TestActivity.this).showDialog();
|
||||
break;
|
||||
case 1:
|
||||
new LiveDataInfoDialog(TestActivity.this).showDialog();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user