Merge remote-tracking branch 'origin/master'

This commit is contained in:
zlzw 2022-11-09 16:19:07 +08:00
commit 6dafa64e0b
20 changed files with 527 additions and 46 deletions

View File

@ -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));
}
}

View File

@ -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();
}
}

View File

@ -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<CustomSidebarChildModel> 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<CustomSidebarChildModel> mChild) {
child.clear();
child.addAll(mChild);
notifyDataSetChanged();
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}
}

View File

@ -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());
}
}

View File

@ -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());
}
}

View File

@ -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());
}
}

View File

@ -1,27 +1,27 @@
<?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="#20ffffff"/>-->
<!-- </shape>-->
<!-- </item>-->
<!-- <item android:state_enabled="false">-->
<!-- <shape>-->
<!-- <corners android:radius="7dp"/>-->
<!-- <solid android:color="#20000000"/>-->
<!-- </shape>-->
<!-- </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>
<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">-->
<!-- <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>

View 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>

View 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>

View File

@ -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>

View File

@ -1,23 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="330dp"
android:layout_height="match_parent"
android:background="@drawable/backgroud_custom_drawer_popup"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/drawerList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="48dp"
android:layout_weight="1" />
<HorizontalScrollView
android:id="@+id/basic_tools_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:scrollbars="none">
<LinearLayout
@ -163,5 +155,12 @@
</LinearLayout>
</HorizontalScrollView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/drawerList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/basic_tools_layout"
android:layout_marginTop="48dp" />
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="14dp"
android:orientation="vertical">
<ImageView
android:id="@+id/fun_game_pic"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/live_more_icon_guard" />
<TextView
android:id="@+id/fun_game_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/guard_guard"
android:textColor="#9A9A9A"
android:textSize="12sp" />
</LinearLayout>

View File

@ -1,6 +1,46 @@
<?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_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_marginBottom="16dp" />
</LinearLayout>

View File

@ -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" />

View File

@ -1,6 +1,46 @@
<?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_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>

View 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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

View File

@ -954,4 +954,7 @@
<string name="want_pre">想在其他APP上方也顯示小窗\n可前往設置進行授權。</string>
<string name="lucky_angel" translatable="false">恭喜 %s 在幸運天使中抽中 %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>