新增主播任务对话框模块
This commit is contained in:
parent
d86e16c9f5
commit
79ded6bff4
@ -0,0 +1,71 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
|
||||||
|
public class LiveTaskModel extends BaseModel {
|
||||||
|
public static final int TASK_TYPE_TIP=0;
|
||||||
|
public static final int TASK_TYPE_ITEM=1;
|
||||||
|
|
||||||
|
int type;
|
||||||
|
String title;
|
||||||
|
int hot;
|
||||||
|
int xp;
|
||||||
|
int taskTarget;
|
||||||
|
int task;
|
||||||
|
boolean complete;
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHot() {
|
||||||
|
return hot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHot(int hot) {
|
||||||
|
this.hot = hot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getXp() {
|
||||||
|
return xp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXp(int xp) {
|
||||||
|
this.xp = xp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTaskTarget() {
|
||||||
|
return taskTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskTarget(int taskTarget) {
|
||||||
|
this.taskTarget = taskTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTask() {
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask(int task) {
|
||||||
|
this.task = task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isComplete() {
|
||||||
|
return complete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComplete(boolean complete) {
|
||||||
|
this.complete = complete;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.yunbao.common.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.lxj.xpopup.XPopup;
|
||||||
|
import com.lxj.xpopup.core.BottomPopupView;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class AbsDialogPopupWindow extends BottomPopupView {
|
||||||
|
private final Context mContext;
|
||||||
|
|
||||||
|
public AbsDialogPopupWindow(@NonNull Context context) {
|
||||||
|
super(context);
|
||||||
|
this.mContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void buildDialog(XPopup.Builder builder);
|
||||||
|
|
||||||
|
public void showDialog() {
|
||||||
|
XPopup.Builder builder = new XPopup.Builder(mContext);
|
||||||
|
builder.isDestroyOnDismiss(true);
|
||||||
|
buildDialog(builder);
|
||||||
|
builder.asCustom(this).show();
|
||||||
|
}
|
||||||
|
}
|
@ -10,9 +10,9 @@ ext {
|
|||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
//正式
|
//正式
|
||||||
|
|
||||||
serverHost : "https://napi.yaoulive.com",
|
// serverHost : "https://napi.yaoulive.com",
|
||||||
//
|
//
|
||||||
// serverHost : "https://ceshi.yaoulive.com",
|
serverHost : "https://ceshi.yaoulive.com",
|
||||||
|
|
||||||
//腾讯地图
|
//腾讯地图
|
||||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||||
|
@ -866,7 +866,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
|||||||
|
|
||||||
private void showTaskDialog() {
|
private void showTaskDialog() {
|
||||||
final Dialog dialog = new Dialog(LiveActivity.this, com.yunbao.live.R.style.dialog);
|
final Dialog dialog = new Dialog(LiveActivity.this, com.yunbao.live.R.style.dialog);
|
||||||
dialog.setContentView(R.layout.dialog_task);
|
dialog.setContentView(R.layout.dialog_live_task);
|
||||||
dialog.setCancelable(true);
|
dialog.setCancelable(true);
|
||||||
dialog.setCanceledOnTouchOutside(true);
|
dialog.setCanceledOnTouchOutside(true);
|
||||||
|
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
package com.yunbao.live.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.bean.LiveTaskModel;
|
||||||
|
import com.yunbao.common.utils.DpUtil;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.live.R;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class LiveTaskRecyclerAdapter extends RecyclerView.Adapter<LiveTaskRecyclerAdapter.TaskHolder> {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private List<LiveTaskModel> tasks;
|
||||||
|
|
||||||
|
public LiveTaskRecyclerAdapter(Context mContext) {
|
||||||
|
this.mContext = mContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTasks(List<LiveTaskModel> tasks) {
|
||||||
|
this.tasks = tasks;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public TaskHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
if (viewType == LiveTaskModel.TASK_TYPE_TIP) {
|
||||||
|
return new TaskHolder(new TextView(mContext));
|
||||||
|
} else {
|
||||||
|
return new TaskHolder(LayoutInflater.from(mContext).inflate(R.layout.item_live_task, parent, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
return tasks.get(position).getType();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull TaskHolder holder, int position) {
|
||||||
|
holder.setDate(tasks.get(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return tasks.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class TaskHolder extends RecyclerView.ViewHolder {
|
||||||
|
private TextView title;
|
||||||
|
private TextView complete;
|
||||||
|
private TextView hot;
|
||||||
|
private TextView xp;
|
||||||
|
private ImageView hotIcon;
|
||||||
|
private ImageView xpIcon;
|
||||||
|
|
||||||
|
public TaskHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
if (itemView instanceof TextView) {
|
||||||
|
title = (TextView) itemView;
|
||||||
|
title.setTextColor(Color.parseColor("#B3B3B3"));
|
||||||
|
title.setTextSize(12);
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
params.setMarginStart(DpUtil.dp2px(27));
|
||||||
|
params.setMargins(DpUtil.dp2px(27), DpUtil.dp2px(16), 0, DpUtil.dp2px(16));
|
||||||
|
title.setLayoutParams(params);
|
||||||
|
} else {
|
||||||
|
title = itemView.findViewById(R.id.item_task_title);
|
||||||
|
complete = itemView.findViewById(R.id.item_task_complete);
|
||||||
|
hot = itemView.findViewById(R.id.item_task_hot);
|
||||||
|
xp = itemView.findViewById(R.id.item_task_xp);
|
||||||
|
hotIcon = itemView.findViewById(R.id.item_task_hot_img);
|
||||||
|
xpIcon = itemView.findViewById(R.id.item_task_xp_img);
|
||||||
|
hotIcon.setImageResource(R.mipmap.dialog_task_hot);
|
||||||
|
xpIcon.setImageResource(R.mipmap.dialog_task_star);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(LiveTaskModel task) {
|
||||||
|
title.setText(task.getTitle());
|
||||||
|
if (task.getType() == LiveTaskModel.TASK_TYPE_TIP) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
complete.setText(task.isComplete() ? R.string.live_task_item_complete_true : R.string.live_task_item_complete_false);
|
||||||
|
complete.setBackgroundResource(task.isComplete() ? R.drawable.background_6cbe53 : R.drawable.background_595959);
|
||||||
|
hot.setText(Html.fromHtml("<font color='#B3B3B3'>"+ WordUtil.getString(R.string.live_task_item_hot) +"</font>  <font color='#F09FC2'>" + task.getHot() + "</font>"));
|
||||||
|
xp.setText(Html.fromHtml("<font color='#B3B3B3'>"+WordUtil.getString(R.string.live_task_item_xp)+"</font>  <font color='#FFF69F'>" + task.getXp() + "</font>"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
202
live/src/main/java/com/yunbao/live/dialog/LiveTaskDialog.java
Normal file
202
live/src/main/java/com/yunbao/live/dialog/LiveTaskDialog.java
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
package com.yunbao.live.dialog;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
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.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
|
import androidx.viewpager2.widget.ViewPager2;
|
||||||
|
|
||||||
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主播直播任务弹框
|
||||||
|
*/
|
||||||
|
public class LiveTaskDialog extends AbsDialogPopupWindow {
|
||||||
|
private TextView newStarTime;
|
||||||
|
private ImageView newStarImg;
|
||||||
|
private ImageView taskInfoImg;
|
||||||
|
private ImageView tipImg;
|
||||||
|
private TabLayout tabLayout;
|
||||||
|
|
||||||
|
private ViewPager2 viewPager;
|
||||||
|
|
||||||
|
|
||||||
|
private TabLayoutMediator mediator;
|
||||||
|
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
public LiveTaskDialog(Context context) {
|
||||||
|
super(context);
|
||||||
|
this.mContext = context;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildDialog(XPopup.Builder builder) {
|
||||||
|
builder.enableDrag(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
newStarImg = findViewById(R.id.live_task_banner1);
|
||||||
|
taskInfoImg = findViewById(R.id.live_task_banner2);
|
||||||
|
tipImg = findViewById(R.id.live_task_tip);
|
||||||
|
tabLayout = findViewById(R.id.live_task_menu);
|
||||||
|
viewPager = findViewById(R.id.live_task_viewpager);
|
||||||
|
|
||||||
|
newStarTime.setText("新秀主播時效截止至 2023/1/01 12:00");
|
||||||
|
|
||||||
|
initImgView();
|
||||||
|
initTabLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initImgView() {
|
||||||
|
newStarImg.setImageResource(R.mipmap.dialog_task_new_star);
|
||||||
|
taskInfoImg.setImageResource(R.mipmap.dialog_task_info);
|
||||||
|
tipImg.setImageResource(R.mipmap.icon_guize);
|
||||||
|
tipImg.setOnClickListener(v -> new LiveTaskInfoDialog(mContext).showDialog());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initTabLayout() {
|
||||||
|
TabLayout.Tab liveTaskTag = tabLayout.newTab();
|
||||||
|
TabLayout.Tab userTaskTag = tabLayout.newTab();
|
||||||
|
liveTaskTag.setText(R.string.live_task_tab1);
|
||||||
|
userTaskTag.setText(R.string.live_task_tab2);
|
||||||
|
tabLayout.addTab(liveTaskTag);
|
||||||
|
tabLayout.addTab(userTaskTag);
|
||||||
|
|
||||||
|
viewPager.setAdapter(new FragmentStateAdapter(((AppCompatActivity) mContext).getSupportFragmentManager(), getLifecycle()) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Fragment createFragment(int position) {
|
||||||
|
TaskFragment fragment = new TaskFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putInt("position", position);
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
mediator = new TabLayoutMediator(tabLayout, viewPager, true, new TabLayoutMediator.TabConfigurationStrategy() {
|
||||||
|
@Override
|
||||||
|
public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
|
||||||
|
if (position == 0) {
|
||||||
|
tab.setText(R.string.live_task_tab1);
|
||||||
|
} else {
|
||||||
|
tab.setText(R.string.live_task_tab2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
mediator.attach();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class TaskFragment extends Fragment {
|
||||||
|
private RecyclerView taskList;
|
||||||
|
private LiveTaskRecyclerAdapter adapter;
|
||||||
|
private List<LiveTaskModel> tasks;
|
||||||
|
private int position;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
return new RecyclerView(getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
this.position = getArguments().getInt("position", -1);
|
||||||
|
taskList = (RecyclerView) view;
|
||||||
|
initTaskList();
|
||||||
|
createTask();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initTaskList() {
|
||||||
|
adapter = new LiveTaskRecyclerAdapter(getContext());
|
||||||
|
taskList.setAdapter(adapter);
|
||||||
|
taskList.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createTask() {
|
||||||
|
tasks = new ArrayList<>();
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
LiveTaskModel model = new LiveTaskModel();
|
||||||
|
if (i == 0) {
|
||||||
|
model.setType(LiveTaskModel.TASK_TYPE_TIP);
|
||||||
|
model.setTitle(WordUtil.getString(R.string.live_task_no1));
|
||||||
|
} else {
|
||||||
|
model.setType(LiveTaskModel.TASK_TYPE_ITEM);
|
||||||
|
model.setTitle("开播测试标题");
|
||||||
|
}
|
||||||
|
model.setTask(30);
|
||||||
|
model.setXp(3000);
|
||||||
|
model.setHot(5000);
|
||||||
|
tasks.add(model);
|
||||||
|
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
LiveTaskModel model = new LiveTaskModel();
|
||||||
|
if (i == 0) {
|
||||||
|
model.setType(LiveTaskModel.TASK_TYPE_TIP);
|
||||||
|
model.setTitle(WordUtil.getString(R.string.live_task_no2));
|
||||||
|
} else {
|
||||||
|
model.setType(LiveTaskModel.TASK_TYPE_ITEM);
|
||||||
|
model.setTitle("PK测试标题");
|
||||||
|
}
|
||||||
|
model.setTask(30);
|
||||||
|
model.setXp(3000);
|
||||||
|
model.setHot(5000);
|
||||||
|
tasks.add(model);
|
||||||
|
|
||||||
|
}
|
||||||
|
adapter.setTasks(tasks);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.yunbao.live.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.lxj.xpopup.XPopup;
|
||||||
|
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||||
|
import com.yunbao.live.R;
|
||||||
|
|
||||||
|
public class LiveTaskInfoDialog extends AbsDialogPopupWindow {
|
||||||
|
public LiveTaskInfoDialog(@NonNull Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getImplLayoutId() {
|
||||||
|
return R.layout.dialog_live_task_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildDialog(XPopup.Builder builder) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
ImageView back = findViewById(R.id.live_task_info_back);
|
||||||
|
back.setImageResource(R.mipmap.icon_back);
|
||||||
|
back.setOnClickListener(v -> dismiss());
|
||||||
|
}
|
||||||
|
}
|
9
live/src/main/res/drawable/background_151515.xml
Normal file
9
live/src/main/res/drawable/background_151515.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>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<corners android:radius="8dp" />
|
||||||
|
<solid android:color="#1A1A1A" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
9
live/src/main/res/drawable/background_595959.xml
Normal file
9
live/src/main/res/drawable/background_595959.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>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<corners android:radius="20dp" />
|
||||||
|
<solid android:color="#595959" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
9
live/src/main/res/drawable/background_6cbe53.xml
Normal file
9
live/src/main/res/drawable/background_6cbe53.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>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<corners android:radius="20dp" />
|
||||||
|
<solid android:color="#6CBE53" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
91
live/src/main/res/layout/dialog_live_task.xml
Normal file
91
live/src/main/res/layout/dialog_live_task.xml
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?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="600dp"
|
||||||
|
|
||||||
|
android:background="#000002">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="13dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="13dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/task_new_star_time"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="14dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/live_task_banner1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/task_new_star_time"
|
||||||
|
tools:srcCompat="@mipmap/dialog_task_new_star" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/live_task_banner2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/live_task_banner1"
|
||||||
|
tools:srcCompat="@mipmap/dialog_task_info" />
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/live_task_menu"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/live_task_tip"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/live_task_banner2"
|
||||||
|
app:tabIndicatorColor="#F6F7FB"
|
||||||
|
app:tabIndicatorFullWidth="false"
|
||||||
|
app:tabMaxWidth="100dp"
|
||||||
|
app:tabMode="scrollable"
|
||||||
|
app:tabSelectedTextColor="#F6F7FB"
|
||||||
|
app:tabTextColor="#9A9A9A" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/live_task_tip"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/live_task_banner2"
|
||||||
|
tools:srcCompat="@mipmap/icon_guize" />
|
||||||
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
|
android:id="@+id/live_task_viewpager"
|
||||||
|
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_toBottomOf="@+id/live_task_menu"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
66
live/src/main/res/layout/dialog_live_task_info.xml
Normal file
66
live/src/main/res/layout/dialog_live_task_info.xml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?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="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/live_task_info_back"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
tools:srcCompat="@mipmap/icon_back" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/live_task_info_title"
|
||||||
|
android:textColor="#808080"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:background="@drawable/background_151515"
|
||||||
|
android:padding="15dp"
|
||||||
|
android:text="@string/live_task_info_msg1"
|
||||||
|
android:textColor="#80CEF2" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:layout_marginBottom="50dp"
|
||||||
|
android:text="@string/live_task_info_msg2"
|
||||||
|
android:textColor="#CCCCCC" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
89
live/src/main/res/layout/item_live_task.xml
Normal file
89
live/src/main/res/layout/item_live_task.xml
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
<?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_marginBottom="10dp"
|
||||||
|
android:background="@drawable/background_151515">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_task_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="11dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_task_complete"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:background="@drawable/background_6cbe53"
|
||||||
|
android:paddingStart="14dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingEnd="14dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="10sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/item_task_title" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/item_task_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/item_task_title">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_task_hot_img"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:srcCompat="@mipmap/dialog_task_hot" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_task_hot"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#B3B3B3"
|
||||||
|
android:textSize="10sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/item_task_layout"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/item_task_title">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_task_xp_img"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:srcCompat="@mipmap/dialog_task_star" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_task_xp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#B3B3B3"
|
||||||
|
android:textSize="10sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
BIN
live/src/main/res/mipmap-xhdpi/dialog_task_hot.png
Normal file
BIN
live/src/main/res/mipmap-xhdpi/dialog_task_hot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
live/src/main/res/mipmap-xhdpi/dialog_task_info.png
Normal file
BIN
live/src/main/res/mipmap-xhdpi/dialog_task_info.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
live/src/main/res/mipmap-xhdpi/dialog_task_new_star.png
Normal file
BIN
live/src/main/res/mipmap-xhdpi/dialog_task_new_star.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
BIN
live/src/main/res/mipmap-xhdpi/dialog_task_star.png
Normal file
BIN
live/src/main/res/mipmap-xhdpi/dialog_task_star.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -18,4 +18,15 @@
|
|||||||
<string name="live_room_private_des">Only those who have the room code can watch</string>
|
<string name="live_room_private_des">Only those who have the room code can watch</string>
|
||||||
<string name="live_room_type_submit">Submit</string>
|
<string name="live_room_type_submit">Submit</string>
|
||||||
<string name="live_mic_max">The number of voices has reached 3, and no more can be added.</string>
|
<string name="live_mic_max">The number of voices has reached 3, and no more can be added.</string>
|
||||||
|
<string name="live_task_no1">當日連續開播時長(分鐘)</string>
|
||||||
|
<string name="live_task_no2">當日累計PK次數(不限模式)</string>
|
||||||
|
<string name="live_task_tab1">直播互動</string>
|
||||||
|
<string name="live_task_tab2">粉絲增漲</string>
|
||||||
|
<string name="live_task_info_title">主播任務特別說明</string>
|
||||||
|
<string name="live_task_info_msg1">所有主播在開播後,即可獲得一系列的當日任務,當根據相應的要求完成任務後,主播即可在第二天開播後,獲得前一天的任務獎勵。</string>
|
||||||
|
<string name="live_task_info_msg2">● 所有任務數值將由系統進行實時計算,如因個人手機電腦設備問題、網絡問題或是沒有正常進行下播導致數據出現錯誤等問題,為此相關主播可進行聯系相關平臺工作人員或是在線客服,進行反饋,待相關部分確認後,將會再進行補償處理。\n● 所有任務數據的正常結算周期將會在每日的淩晨6點進行結算,若開播時間超過淩晨6點,將會出現獎勵無法正常結算的情況,請知悉。\n● 當主播規範分低於90時,主播任務中心的所有獎勵,將僅能獲得50%的,當主播規範分低於80以下時,將無法獲得主播任務獎勵。</string>
|
||||||
|
<string name="live_task_item_complete_true">已完成</string>
|
||||||
|
<string name="live_task_item_complete_false">未完成</string>
|
||||||
|
<string name="live_task_item_hot">直播熱度</string>
|
||||||
|
<string name="live_task_item_xp">主播經驗</string>
|
||||||
</resources>
|
</resources>
|
@ -49,6 +49,15 @@
|
|||||||
<string name="random_pk_search_hint" translatable="false">請輸入您要pk的主播昵稱或id</string>
|
<string name="random_pk_search_hint" translatable="false">請輸入您要pk的主播昵稱或id</string>
|
||||||
<string name="free_pk_user_pking" translatable="false">對方正在PK中</string>
|
<string name="free_pk_user_pking" translatable="false">對方正在PK中</string>
|
||||||
<string name="free_pk_num_null" translatable="false">PK次數已用完</string>
|
<string name="free_pk_num_null" translatable="false">PK次數已用完</string>
|
||||||
|
<string name="live_task_no1">當日連續開播時長(分鐘)</string>
|
||||||
|
<string name="live_task_no2">當日累計PK次數(不限模式)</string>
|
||||||
|
<string name="live_task_tab1">直播互動</string>
|
||||||
|
<string name="live_task_tab2">粉絲增漲</string>
|
||||||
|
<string name="live_task_info_title">主播任務特別說明</string>
|
||||||
|
<string name="live_task_info_msg1">所有主播在開播後,即可獲得一系列的當日任務,當根據相應的要求完成任務後,主播即可在第二天開播後,獲得前一天的任務獎勵。</string>
|
||||||
|
<string name="live_task_info_msg2">● 所有任務數值將由系統進行實時計算,如因個人手機電腦設備問題、網絡問題或是沒有正常進行下播導致數據出現錯誤等問題,為此相關主播可進行聯系相關平臺工作人員或是在線客服,進行反饋,待相關部分確認後,將會再進行補償處理。\n● 所有任務數據的正常結算周期將會在每日的淩晨6點進行結算,若開播時間超過淩晨6點,將會出現獎勵無法正常結算的情況,請知悉。\n● 當主播規範分低於90時,主播任務中心的所有獎勵,將僅能獲得50%的,當主播規範分低於80以下時,將無法獲得主播任務獎勵。</string>
|
||||||
|
<string name="live_task_item_complete_true">已完成</string>
|
||||||
|
<string name="live_task_item_complete_false">未完成</string>
|
||||||
|
<string name="live_task_item_hot">直播熱度</string>
|
||||||
|
<string name="live_task_item_xp">主播經驗</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,23 +1,55 @@
|
|||||||
package com.yunbao.main.activity;
|
package com.yunbao.main.activity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.live.dialog.LiveTaskDialog;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
|
||||||
public class TestActivity extends AppCompatActivity {
|
public class TestActivity extends AppCompatActivity {
|
||||||
private TextView contextLayout;
|
private TextView contextLayout;
|
||||||
|
private ListView listView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_test);
|
listView = new ListView(this);
|
||||||
contextLayout = findViewById(R.id.context_layout);
|
setContentView(listView);
|
||||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
String[] strs = new String[]{
|
||||||
|
"弹出主播任务"
|
||||||
|
};
|
||||||
|
|
||||||
|
listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, strs));
|
||||||
|
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
new LiveTaskDialog(TestActivity.this).showDialog();
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.yunbao.main.views;
|
package com.yunbao.main.views;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
@ -11,6 +12,7 @@ import com.yunbao.common.utils.WordUtil;
|
|||||||
import com.yunbao.live.dialog.LiveRobotSettingDialogFragment;
|
import com.yunbao.live.dialog.LiveRobotSettingDialogFragment;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.activity.MainActivity;
|
import com.yunbao.main.activity.MainActivity;
|
||||||
|
import com.yunbao.main.activity.TestActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by cxf on 2018/9/22.
|
* Created by cxf on 2018/9/22.
|
||||||
@ -38,6 +40,10 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
|
|||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
img_trophy = (ImageView) findViewById(R.id.img_trophy);
|
img_trophy = (ImageView) findViewById(R.id.img_trophy);
|
||||||
|
img_trophy.setOnLongClickListener(v -> {
|
||||||
|
mContext.startActivity(new Intent(mContext, TestActivity.class));
|
||||||
|
return true;
|
||||||
|
});
|
||||||
ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy);
|
ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user