侧边栏:趣味游戏
This commit is contained in:
parent
350f17915a
commit
60453c756c
@ -67,6 +67,9 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
||||
}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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
25
common/src/main/res/layout/view_fun_games_child_view.xml
Normal file
25
common/src/main/res/layout/view_fun_games_child_view.xml
Normal 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>
|
@ -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>
|
Loading…
Reference in New Issue
Block a user