diff --git a/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java b/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java index 0a113460b..0eea98f33 100644 --- a/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java +++ b/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java @@ -8,7 +8,7 @@ public class CustomDrawerPopupEvent extends BaseModel { //权益的名字 private String rightsInterests = ""; //活动的id - private int activityId = -1; + private int activityId = 0; //跳转网页地址 private String htmlUrl; //是否半屏展示 diff --git a/common/src/main/java/com/yunbao/common/views/DrawerRecommendViewHolder.java b/common/src/main/java/com/yunbao/common/views/DrawerRecommendViewHolder.java index 50fb078bf..5178f1348 100644 --- a/common/src/main/java/com/yunbao/common/views/DrawerRecommendViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/DrawerRecommendViewHolder.java @@ -1,5 +1,6 @@ package com.yunbao.common.views; +import android.text.TextUtils; import android.view.View; import android.widget.TextView; @@ -8,9 +9,16 @@ import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.yunbao.common.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.adapter.DrawerRecommendAdapter; import com.yunbao.common.bean.CustomSidebarInfoModel; +import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.event.CustomDrawerPopupEvent; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; /** * 侧边栏推荐布局 任务 @@ -34,5 +42,29 @@ public class DrawerRecommendViewHolder extends RecyclerView.ViewHolder { sendGoodGift.setText(model.getTitle()); subtitle.setText(model.getSubtitle()); recommendAdapter.updateData(model.getChild()); + ViewClicksAntiShake.clicksAntiShake(subtitle, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (TextUtils.isEmpty(model.getSrc())) { + ToastUtil.show("SHOWER_ERROR"); + } else { + IMLoginModel userInfo = IMLoginManager.get(itemView.getContext()).getUserInfo(); + StringBuffer htmlUrl = new StringBuffer(); + htmlUrl.append(CommonAppConfig.HOST) + .append("/") + .append(model.getSrc()) + .append("&uid=") + .append(userInfo.getId()) + .append("&token=") + .append(userInfo.getToken()); + Bus.get().post(new CustomDrawerPopupEvent() + .setDisMiss(true) + .setHtmlUrl(htmlUrl.toString()) + .setScreen(TextUtils.equals(model.getShowType(), "2"))); + } + + + } + }); } } diff --git a/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java index 737b2e589..24c8f6134 100644 --- a/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java @@ -3,6 +3,7 @@ package com.yunbao.common.views; import android.graphics.Color; import android.text.TextUtils; import android.view.View; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; @@ -12,13 +13,17 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.R; import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; public class DrawerTaskChildViewHolder extends RecyclerView.ViewHolder { private ImageView icon; private TextView title, subtitle, toReceive; private RelativeLayout layout; - + private FrameLayout toReceiveLayout; public DrawerTaskChildViewHolder(@NonNull View itemView) { super(itemView); @@ -27,6 +32,7 @@ public class DrawerTaskChildViewHolder extends RecyclerView.ViewHolder { subtitle = itemView.findViewById(R.id.subtitle); toReceive = itemView.findViewById(R.id.to_receive); layout = itemView.findViewById(R.id.layout); + toReceiveLayout = itemView.findViewById(R.id.to_receive_layout); } public void setData(CustomSidebarChildModel model) { @@ -44,18 +50,29 @@ public class DrawerTaskChildViewHolder extends RecyclerView.ViewHolder { 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); + toReceiveLayout.setBackgroundResource(R.drawable.bg_drawer_popup_task_status); + toReceiveLayout.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); + toReceiveLayout.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); + toReceiveLayout.setBackgroundResource(R.drawable.bg_drawer_popup_task_status); + toReceiveLayout.setEnabled(true); layout.setEnabled(true); toReceive.setText(R.string.to_receive); } + ViewClicksAntiShake.clicksAntiShake(toReceive, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + Bus.get().post(new CustomDrawerPopupEvent() + .setDisMiss(true)); + + if (TextUtils.equals(model.getStatus(), "2")) { + ToastUtil.show("敬请期待"); + } + } + }); } } 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 3d16df8d4..2db91f460 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,24 @@ package com.yunbao.common.views; +import android.text.TextUtils; import android.view.View; +import android.widget.FrameLayout; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.yunbao.common.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.adapter.DrawerTaskAdapter; import com.yunbao.common.bean.CustomSidebarInfoModel; +import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.event.CustomDrawerPopupEvent; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; /** * 侧边栏任务布局 @@ -19,6 +28,7 @@ public class DrawerTaskViewHolder extends RecyclerView.ViewHolder { private RecyclerView childList; private DrawerTaskAdapter taskAdapter; + public DrawerTaskViewHolder(@NonNull View itemView) { super(itemView); sendGoodGift = itemView.findViewById(R.id.send_good_gift); @@ -33,5 +43,29 @@ public class DrawerTaskViewHolder extends RecyclerView.ViewHolder { sendGoodGift.setText(model.getTitle()); subtitle.setText(model.getSubtitle()); taskAdapter.updateData(model.getChild()); + ViewClicksAntiShake.clicksAntiShake(subtitle, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (TextUtils.isEmpty(model.getSrc())) { + ToastUtil.show("SHOWER_ERROR"); + } else { + IMLoginModel userInfo = IMLoginManager.get(itemView.getContext()).getUserInfo(); + StringBuffer htmlUrl = new StringBuffer(); + htmlUrl.append(CommonAppConfig.HOST) + .append("/") + .append(model.getSrc()) + .append("&uid=") + .append(userInfo.getId()) + .append("&token=") + .append(userInfo.getToken()); + Bus.get().post(new CustomDrawerPopupEvent() + .setDisMiss(true) + .setHtmlUrl(htmlUrl.toString()) + .setScreen(TextUtils.equals(model.getShowType(), "2"))); + } + + + } + }); } } diff --git a/common/src/main/res/drawable/bg_drawer_popup_task.xml b/common/src/main/res/drawable/bg_drawer_popup_task.xml index 0b41de4ab..89c5d1df6 100644 --- a/common/src/main/res/drawable/bg_drawer_popup_task.xml +++ b/common/src/main/res/drawable/bg_drawer_popup_task.xml @@ -9,7 +9,7 @@ - + \ 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 index 2740769ad..cec5c9451 100644 --- a/common/src/main/res/layout/view_tsak_center_child.xml +++ b/common/src/main/res/layout/view_tsak_center_child.xml @@ -39,16 +39,25 @@ android:textColor="#9A9A9A" android:textSize="10sp" /> - + android:gravity="center"> + + + + + \ No newline at end of file