侧边栏:任务中心
This commit is contained in:
parent
5e55a5b94c
commit
350f17915a
@ -64,6 +64,9 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
|||||||
if (holder instanceof DrawerRecommendViewHolder) {
|
if (holder instanceof DrawerRecommendViewHolder) {
|
||||||
DrawerRecommendViewHolder recommendViewHolder = (DrawerRecommendViewHolder) holder;
|
DrawerRecommendViewHolder recommendViewHolder = (DrawerRecommendViewHolder) holder;
|
||||||
recommendViewHolder.setData(infoModels.get(position));
|
recommendViewHolder.setData(infoModels.get(position));
|
||||||
|
}else if (holder instanceof DrawerTaskViewHolder) {
|
||||||
|
DrawerTaskViewHolder taskViewHolder = (DrawerTaskViewHolder) holder;
|
||||||
|
taskViewHolder.setData(infoModels.get(position));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.yunbao.common.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||||
|
import com.yunbao.common.views.DrawerTaskChildViewHolder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DrawerTaskAdapter extends RecyclerView.Adapter {
|
||||||
|
private Context mContext;
|
||||||
|
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||||
|
|
||||||
|
public DrawerTaskAdapter(Context mContext) {
|
||||||
|
this.mContext = mContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View taskCenterView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_tsak_center_child, parent, false);
|
||||||
|
return new DrawerTaskChildViewHolder(taskCenterView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
|
DrawerTaskChildViewHolder taskChildViewHolder = (DrawerTaskChildViewHolder) holder;
|
||||||
|
taskChildViewHolder.setData(child.get(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return child.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||||
|
child.clear();
|
||||||
|
child.addAll(mChild);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
@ -19,6 +19,15 @@ public class CustomSidebarChildModel extends BaseModel {
|
|||||||
private String showType;
|
private String showType;
|
||||||
@SerializedName("sort")
|
@SerializedName("sort")
|
||||||
private String sort;
|
private String sort;
|
||||||
|
@SerializedName("english")
|
||||||
|
private String english;
|
||||||
|
//奖励领取状态 0未达到领取要求 1已领取 2未领取
|
||||||
|
@SerializedName("status")
|
||||||
|
private String status;
|
||||||
|
@SerializedName("need_num")
|
||||||
|
private String needNum;
|
||||||
|
@SerializedName("now_num")
|
||||||
|
private String nowNum;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
@ -91,4 +100,40 @@ public class CustomSidebarChildModel extends BaseModel {
|
|||||||
this.sort = sort;
|
this.sort = sort;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getEnglish() {
|
||||||
|
return english;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomSidebarChildModel setEnglish(String english) {
|
||||||
|
this.english = english;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomSidebarChildModel setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNeedNum() {
|
||||||
|
return needNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomSidebarChildModel setNeedNum(String needNum) {
|
||||||
|
this.needNum = needNum;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNowNum() {
|
||||||
|
return nowNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomSidebarChildModel setNowNum(String nowNum) {
|
||||||
|
this.nowNum = nowNum;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
|
||||||
|
public class DrawerTaskChildViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private ImageView icon;
|
||||||
|
private TextView title, subtitle, toReceive;
|
||||||
|
private RelativeLayout layout;
|
||||||
|
|
||||||
|
|
||||||
|
public DrawerTaskChildViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
icon = itemView.findViewById(R.id.icon);
|
||||||
|
title = itemView.findViewById(R.id.title);
|
||||||
|
subtitle = itemView.findViewById(R.id.subtitle);
|
||||||
|
toReceive = itemView.findViewById(R.id.to_receive);
|
||||||
|
layout = itemView.findViewById(R.id.layout);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(CustomSidebarChildModel model) {
|
||||||
|
ImgLoader.display2(itemView.getContext(), model.getIcon(), icon);
|
||||||
|
StringBuffer titleBuffer = new StringBuffer();
|
||||||
|
titleBuffer
|
||||||
|
.append(model.getTitle())
|
||||||
|
.append("(")
|
||||||
|
.append(model.getNowNum())
|
||||||
|
.append("/")
|
||||||
|
.append(model.getNeedNum())
|
||||||
|
.append(")");
|
||||||
|
title.setText(titleBuffer.toString());
|
||||||
|
subtitle.setText(model.getSubtitle());
|
||||||
|
if (TextUtils.equals(model.getStatus(), "0")) {
|
||||||
|
layout.setEnabled(false);
|
||||||
|
toReceive.setText(R.string.to_complete);
|
||||||
|
toReceive.setBackgroundResource(R.drawable.bg_drawer_popup_task_status);
|
||||||
|
toReceive.setEnabled(false);
|
||||||
|
} else if (TextUtils.equals(model.getStatus(), "1")) {
|
||||||
|
layout.setEnabled(false);
|
||||||
|
toReceive.setText(R.string.already_collected);
|
||||||
|
toReceive.setBackgroundResource(R.drawable.bg_drawer_popup_task_status2);
|
||||||
|
toReceive.setTextColor(Color.parseColor("#DDDDDD"));
|
||||||
|
} else if (TextUtils.equals(model.getStatus(), "2")) {
|
||||||
|
toReceive.setBackgroundResource(R.drawable.bg_drawer_popup_task_status);
|
||||||
|
toReceive.setEnabled(true);
|
||||||
|
layout.setEnabled(true);
|
||||||
|
toReceive.setText(R.string.to_receive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +1,37 @@
|
|||||||
package com.yunbao.common.views;
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.adapter.DrawerTaskAdapter;
|
||||||
|
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 侧边栏任务布局
|
* 侧边栏任务布局
|
||||||
*/
|
*/
|
||||||
public class DrawerTaskViewHolder extends RecyclerView.ViewHolder {
|
public class DrawerTaskViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private TextView sendGoodGift, subtitle;
|
||||||
|
private RecyclerView childList;
|
||||||
|
private DrawerTaskAdapter taskAdapter;
|
||||||
|
|
||||||
public DrawerTaskViewHolder(@NonNull View itemView) {
|
public DrawerTaskViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
|
||||||
|
subtitle = itemView.findViewById(R.id.subtitle);
|
||||||
|
childList = itemView.findViewById(R.id.child_list);
|
||||||
|
taskAdapter = new DrawerTaskAdapter(itemView.getContext());
|
||||||
|
childList.setLayoutManager(new LinearLayoutManager(itemView.getContext(), LinearLayoutManager.VERTICAL, false));
|
||||||
|
childList.setAdapter(taskAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(CustomSidebarInfoModel model) {
|
||||||
|
sendGoodGift.setText(model.getTitle());
|
||||||
|
subtitle.setText(model.getSubtitle());
|
||||||
|
taskAdapter.updateData(model.getChild());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<!-- <item android:state_enabled="true">-->
|
|
||||||
<!-- <shape>-->
|
|
||||||
<!-- <corners android:radius="7dp"/>-->
|
|
||||||
<!-- <solid android:color="#20ffffff"/>-->
|
|
||||||
<!-- </shape>-->
|
|
||||||
<!-- </item>-->
|
|
||||||
<!-- <item android:state_enabled="false">-->
|
|
||||||
<!-- <shape>-->
|
|
||||||
<!-- <corners android:radius="7dp"/>-->
|
|
||||||
<!-- <solid android:color="#20000000"/>-->
|
|
||||||
<!-- </shape>-->
|
|
||||||
<!-- </item>-->
|
|
||||||
<item android:state_enabled="true">
|
<item android:state_enabled="true">
|
||||||
<shape>
|
<shape>
|
||||||
<corners android:radius="7dp"/>
|
<corners android:radius="7dp"/>
|
||||||
<solid android:color="#7000" />
|
<solid android:color="#20ffffff"/>
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
<item android:state_enabled="false">
|
<item android:state_enabled="false">
|
||||||
<shape>
|
<shape>
|
||||||
<corners android:radius="7dp"/>
|
<corners android:radius="7dp"/>
|
||||||
<solid android:color="#7000" />
|
<solid android:color="#20000000"/>
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
|
<!-- <item android:state_enabled="true">-->
|
||||||
|
<!-- <shape>-->
|
||||||
|
<!-- <corners android:radius="7dp" />-->
|
||||||
|
<!-- <solid android:color="#7000" />-->
|
||||||
|
<!-- </shape>-->
|
||||||
|
<!-- </item>-->
|
||||||
|
<!-- <item android:state_enabled="false">-->
|
||||||
|
<!-- <shape>-->
|
||||||
|
<!-- <corners android:radius="7dp" />-->
|
||||||
|
<!-- <solid android:color="#7000" />-->
|
||||||
|
<!-- </shape>-->
|
||||||
|
<!-- </item>-->
|
||||||
</selector>
|
</selector>
|
15
common/src/main/res/drawable/bg_drawer_popup_task.xml
Normal file
15
common/src/main/res/drawable/bg_drawer_popup_task.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_enabled="true">
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="7dp" />
|
||||||
|
<solid android:color="#30FFD35A" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:state_enabled="false">
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="7dp" />
|
||||||
|
<solid android:color="#7000" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
15
common/src/main/res/drawable/bg_drawer_popup_task_status.xml
Normal file
15
common/src/main/res/drawable/bg_drawer_popup_task_status.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_enabled="true">
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="12.5dp" />
|
||||||
|
<solid android:color="#FFE59A" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:state_enabled="false">
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="12.5dp" />
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="12.5dp" />
|
||||||
|
<solid android:color="#95FFFFFF" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
@ -28,10 +28,10 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:drawableEnd="@mipmap/icon_more_01"
|
android:drawableEnd="@mipmap/icon_more_02"
|
||||||
android:drawablePadding="3dp"
|
android:drawablePadding="3dp"
|
||||||
android:text="去充值"
|
android:text="去充值"
|
||||||
android:textColor="#FBFF72"
|
android:textColor="#A1A7BE"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,46 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:background="@drawable/bg_drawer_popup"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/send_good_gift"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="任務中心"
|
||||||
|
android:textColor="#F6F7FB"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/subtitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:drawableEnd="@mipmap/icon_more_02"
|
||||||
|
android:drawablePadding="3dp"
|
||||||
|
android:text="查看更多"
|
||||||
|
android:textColor="#A1A7BE"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/child_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginBottom="16dp" />
|
||||||
|
</LinearLayout>
|
54
common/src/main/res/layout/view_tsak_center_child.xml
Normal file
54
common/src/main/res/layout/view_tsak_center_child.xml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="58dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:background="@drawable/bg_drawer_popup_task">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/icon"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="9dp"
|
||||||
|
android:scaleType="fitCenter" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="9dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_toEndOf="@id/icon"
|
||||||
|
android:text="赠送送玫瑰 (5/5)"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/subtitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/title"
|
||||||
|
android:layout_marginStart="9dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:layout_toEndOf="@id/icon"
|
||||||
|
android:text="赠送送玫瑰 (5/5)"
|
||||||
|
android:textColor="#9A9A9A"
|
||||||
|
android:textSize="10sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/to_receive"
|
||||||
|
android:layout_width="58dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="9dp"
|
||||||
|
android:background="@drawable/bg_drawer_popup_task_status"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="领取"
|
||||||
|
android:textColor="#15151D"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</RelativeLayout>
|
BIN
common/src/main/res/mipmap-xxhdpi/icon_more_02.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/icon_more_02.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 546 B |
@ -954,4 +954,7 @@
|
|||||||
<string name="want_pre">想在其他APP上方也顯示小窗,\n可前往設置進行授權。</string>
|
<string name="want_pre">想在其他APP上方也顯示小窗,\n可前往設置進行授權。</string>
|
||||||
<string name="lucky_angel" translatable="false">恭喜 %s 在幸運天使中抽中 %s!下一個幸運天使就是你哦!</string>
|
<string name="lucky_angel" translatable="false">恭喜 %s 在幸運天使中抽中 %s!下一個幸運天使就是你哦!</string>
|
||||||
<string name="user_card_guard" translatable="false">守護團%s人</string>
|
<string name="user_card_guard" translatable="false">守護團%s人</string>
|
||||||
|
<string name="to_receive" translatable="false">領取</string>
|
||||||
|
<string name="to_complete" translatable="false">去完成</string>
|
||||||
|
<string name="already_collected" translatable="false">已領取</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user