From 350f17915a0f5940967d7833387b360ee87c78f6 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 9 Nov 2022 15:26:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F:=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/CustomDrawerPopupAdapter.java | 3 + .../common/adapter/DrawerTaskAdapter.java | 49 ++++++++++++++ .../common/bean/CustomSidebarChildModel.java | 45 +++++++++++++ .../views/DrawerTaskChildViewHolder.java | 61 ++++++++++++++++++ .../common/views/DrawerTaskViewHolder.java | 22 +++++++ .../src/main/res/drawable/bg_drawer_popup.xml | 48 +++++++------- .../res/drawable/bg_drawer_popup_task.xml | 15 +++++ .../drawable/bg_drawer_popup_task_status.xml | 15 +++++ .../drawable/bg_drawer_popup_task_status2.xml | 9 +++ .../src/main/res/layout/view_good_gifts.xml | 4 +- .../src/main/res/layout/view_tsak_center.xml | 46 ++++++++++++- .../res/layout/view_tsak_center_child.xml | 54 ++++++++++++++++ .../main/res/mipmap-xxhdpi/icon_more_02.png | Bin 0 -> 546 bytes common/src/main/res/values/strings.xml | 3 + 14 files changed, 345 insertions(+), 29 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/adapter/DrawerTaskAdapter.java create mode 100644 common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java create mode 100644 common/src/main/res/drawable/bg_drawer_popup_task.xml create mode 100644 common/src/main/res/drawable/bg_drawer_popup_task_status.xml create mode 100644 common/src/main/res/drawable/bg_drawer_popup_task_status2.xml create mode 100644 common/src/main/res/layout/view_tsak_center_child.xml create mode 100644 common/src/main/res/mipmap-xxhdpi/icon_more_02.png diff --git a/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java b/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java index 4b6891105..4c5aaf9dd 100644 --- a/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java @@ -64,6 +64,9 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter { if (holder instanceof DrawerRecommendViewHolder) { DrawerRecommendViewHolder recommendViewHolder = (DrawerRecommendViewHolder) holder; recommendViewHolder.setData(infoModels.get(position)); + }else if (holder instanceof DrawerTaskViewHolder) { + DrawerTaskViewHolder taskViewHolder = (DrawerTaskViewHolder) holder; + taskViewHolder.setData(infoModels.get(position)); } } diff --git a/common/src/main/java/com/yunbao/common/adapter/DrawerTaskAdapter.java b/common/src/main/java/com/yunbao/common/adapter/DrawerTaskAdapter.java new file mode 100644 index 000000000..60085cc5f --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/DrawerTaskAdapter.java @@ -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 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 mChild) { + child.clear(); + child.addAll(mChild); + notifyDataSetChanged(); + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java b/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java index 41156f452..4a5324e1a 100644 --- a/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java +++ b/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java @@ -19,6 +19,15 @@ public class CustomSidebarChildModel extends BaseModel { private String showType; @SerializedName("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() { return id; @@ -91,4 +100,40 @@ public class CustomSidebarChildModel extends BaseModel { this.sort = sort; 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; + } } diff --git a/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java new file mode 100644 index 000000000..737b2e589 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java @@ -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); + } + } +} diff --git a/common/src/main/java/com/yunbao/common/views/DrawerTaskViewHolder.java b/common/src/main/java/com/yunbao/common/views/DrawerTaskViewHolder.java index 0ac077cdb..3d16df8d4 100644 --- a/common/src/main/java/com/yunbao/common/views/DrawerTaskViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/DrawerTaskViewHolder.java @@ -1,15 +1,37 @@ package com.yunbao.common.views; import android.view.View; +import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; 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 { + private TextView sendGoodGift, subtitle; + private RecyclerView childList; + private DrawerTaskAdapter taskAdapter; + public DrawerTaskViewHolder(@NonNull View 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()); } } diff --git a/common/src/main/res/drawable/bg_drawer_popup.xml b/common/src/main/res/drawable/bg_drawer_popup.xml index 36be141cd..a007bc9f4 100644 --- a/common/src/main/res/drawable/bg_drawer_popup.xml +++ b/common/src/main/res/drawable/bg_drawer_popup.xml @@ -1,27 +1,27 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_drawer_popup_task.xml b/common/src/main/res/drawable/bg_drawer_popup_task.xml new file mode 100644 index 000000000..0b41de4ab --- /dev/null +++ b/common/src/main/res/drawable/bg_drawer_popup_task.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_drawer_popup_task_status.xml b/common/src/main/res/drawable/bg_drawer_popup_task_status.xml new file mode 100644 index 000000000..57bb6e68a --- /dev/null +++ b/common/src/main/res/drawable/bg_drawer_popup_task_status.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_drawer_popup_task_status2.xml b/common/src/main/res/drawable/bg_drawer_popup_task_status2.xml new file mode 100644 index 000000000..2235f5708 --- /dev/null +++ b/common/src/main/res/drawable/bg_drawer_popup_task_status2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_good_gifts.xml b/common/src/main/res/layout/view_good_gifts.xml index 823a83781..1c5fd3341 100644 --- a/common/src/main/res/layout/view_good_gifts.xml +++ b/common/src/main/res/layout/view_good_gifts.xml @@ -28,10 +28,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end" - android:drawableEnd="@mipmap/icon_more_01" + android:drawableEnd="@mipmap/icon_more_02" android:drawablePadding="3dp" android:text="去充值" - android:textColor="#FBFF72" + android:textColor="#A1A7BE" android:textSize="12sp" /> diff --git a/common/src/main/res/layout/view_tsak_center.xml b/common/src/main/res/layout/view_tsak_center.xml index 77d9ef65f..96003dd3c 100644 --- a/common/src/main/res/layout/view_tsak_center.xml +++ b/common/src/main/res/layout/view_tsak_center.xml @@ -1,6 +1,46 @@ - + 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"> - \ No newline at end of file + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_tsak_center_child.xml b/common/src/main/res/layout/view_tsak_center_child.xml new file mode 100644 index 000000000..2740769ad --- /dev/null +++ b/common/src/main/res/layout/view_tsak_center_child.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-xxhdpi/icon_more_02.png b/common/src/main/res/mipmap-xxhdpi/icon_more_02.png new file mode 100644 index 0000000000000000000000000000000000000000..3a2d32e72bab6db461f413fa9576be28eb235e6e GIT binary patch literal 546 zcmV+-0^R+IP)Px$+(|@1R5(wSls{-wQ5431=e{%{sdNwpM?uiZ%|Q@sqpM4Gur+xpR9n8N=Dk4+< z+r3?3W)id?a75&ztf}j|r@qEP5?wy?Ye%f*3ChVv9jG~J9WIH%OGW5!n&_moFQj;%H2wyF$*AoX*>_JgUas-x&%$C&%yKF{ARm&>-L!gkbqUb}|y z0O$rHN!PPZ-b(}~Uw_JFmww+t8B;VHd1RHVi9n+X)9-t1>dzxp+@`T#Is&1y^cbYr z5vWvVyGf^StLhlgSyKC_jhNAl>8想在其他APP上方也顯示小窗,\n可前往設置進行授權。 恭喜 %s 在幸運天使中抽中 %s!下一個幸運天使就是你哦! 守護團%s人 + 領取 + 去完成 + 已領取