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..1ff46d624 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,12 @@ 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)); + }else if (holder instanceof FunGamesViewHolder) { + FunGamesViewHolder funGamesViewHolder = (FunGamesViewHolder) holder; + funGamesViewHolder.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/adapter/FunGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java new file mode 100644 index 000000000..5c55d6aa0 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java @@ -0,0 +1,48 @@ +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.FunGamesChildViewHolder; + +import java.util.ArrayList; +import java.util.List; + +public class FunGamesAdapter extends RecyclerView.Adapter { + private Context mContext; + private List child = new ArrayList<>(); + + public FunGamesAdapter(Context mContext) { + this.mContext = mContext; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_fun_games_child_view, parent, false); + return new FunGamesChildViewHolder(runGamesView); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + FunGamesChildViewHolder childViewHolder = (FunGamesChildViewHolder) holder; + ((FunGamesChildViewHolder) holder).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/java/com/yunbao/common/views/FunGamesChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java new file mode 100644 index 000000000..033733abb --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java @@ -0,0 +1,28 @@ +package com.yunbao.common.views; + +import android.view.View; +import android.widget.ImageView; +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 FunGamesChildViewHolder extends RecyclerView.ViewHolder { + private ImageView funGamePic; + private TextView funGameName; + + public FunGamesChildViewHolder(@NonNull View itemView) { + super(itemView); + funGamePic = itemView.findViewById(R.id.fun_game_pic); + funGameName = itemView.findViewById(R.id.fun_game_name); + } + + public void setData(CustomSidebarChildModel model) { + ImgLoader.display(itemView.getContext(), model.getIcon(), funGamePic); + funGameName.setText(model.getTitle()); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java b/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java index 1ae8f0ad9..a971eebe1 100644 --- a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java @@ -1,12 +1,34 @@ package com.yunbao.common.views; import android.view.View; +import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.yunbao.common.R; +import com.yunbao.common.adapter.FunGamesAdapter; +import com.yunbao.common.bean.CustomSidebarInfoModel; + public class FunGamesViewHolder extends RecyclerView.ViewHolder { - public FunGamesViewHolder(@NonNull View itemView) { - super(itemView); - } + private FunGamesAdapter funGamesAdapter; + private TextView sendGoodGift, subtitle; + private RecyclerView childList; + + public FunGamesViewHolder(@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); + funGamesAdapter = new FunGamesAdapter(itemView.getContext()); + childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4)); + childList.setAdapter(funGamesAdapter); + } + + public void setData(CustomSidebarInfoModel model) { + sendGoodGift.setText(model.getTitle()); + subtitle.setText(model.getSubtitle()); + funGamesAdapter.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/custom_drawer_popup.xml b/common/src/main/res/layout/custom_drawer_popup.xml index 1fe7b92b8..a87f71f26 100644 --- a/common/src/main/res/layout/custom_drawer_popup.xml +++ b/common/src/main/res/layout/custom_drawer_popup.xml @@ -1,23 +1,15 @@ - - - - - + - \ No newline at end of file + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_fun_games_child_view.xml b/common/src/main/res/layout/view_fun_games_child_view.xml new file mode 100644 index 000000000..af4505e8a --- /dev/null +++ b/common/src/main/res/layout/view_fun_games_child_view.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_fun_games_view.xml b/common/src/main/res/layout/view_fun_games_view.xml index 77d9ef65f..10d52e99e 100644 --- a/common/src/main/res/layout/view_fun_games_view.xml +++ b/common/src/main/res/layout/view_fun_games_view.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_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 000000000..3a2d32e72 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_more_02.png differ diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index f3a2d6462..1d641d097 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -954,4 +954,7 @@ 想在其他APP上方也顯示小窗,\n可前往設置進行授權。 恭喜 %s 在幸運天使中抽中 %s!下一個幸運天使就是你哦! 守護團%s人 + 領取 + 去完成 + 已領取