|
@@ -9,6 +9,7 @@ import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.widget.CompoundButton;
|
|
|
+import android.widget.FrameLayout;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.Switch;
|
|
@@ -68,8 +69,8 @@ public class SlideVideoAdapter extends RecyclerView.Adapter<VideoHolder> {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public String getItemType(int position) {
|
|
|
- return mListData.get(position).getUserRead().getType();
|
|
|
+ public String getItemTag(int position) {
|
|
|
+ return mListData.get(position).getUserRead().getTag();
|
|
|
}
|
|
|
|
|
|
@NonNull
|
|
@@ -94,8 +95,57 @@ public class SlideVideoAdapter extends RecyclerView.Adapter<VideoHolder> {
|
|
|
* */
|
|
|
holder.mItemView.setTag(mListData.get(position).getUserRead().getType());
|
|
|
holder.itemView.setTag(mListData.get(position).getUserRead().getType());
|
|
|
- if (mListData.get(position).getUserRead().getType().equals("READ") || mListData.get(position).getUserRead().getType().equals("EXAMPLE")) {
|
|
|
-// AAA代替EXAMPLE
|
|
|
+
|
|
|
+
|
|
|
+ boolean needDanMu = false;
|
|
|
+ boolean needTag = false;
|
|
|
+ int tagType = -1;
|
|
|
+ String tagText = "";
|
|
|
+ if (mListData.get(position).getUserRead().getTag().equals("READ") || mListData.get(position).getUserRead().getTag().equals("EXAMPLE")) {
|
|
|
+ //是用户朗读的和官方作品
|
|
|
+ needDanMu = true;
|
|
|
+ needTag = false;
|
|
|
+ tagText = "";
|
|
|
+
|
|
|
+ } else if (mListData.get(position).getUserRead().getTag().equals("ACTIVITY")) {
|
|
|
+ //是活动
|
|
|
+ //这里修改成新的type。就可以使用了
|
|
|
+ holder.mSwitch.setVisibility(View.INVISIBLE);
|
|
|
+ holder.mEventBtn.setVisibility(View.VISIBLE);
|
|
|
+ GlideUtils.loadImage(mContext, R.drawable.event_video_into, holder.mEventBtn);
|
|
|
+ holder.mEventBtn.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ EfunboxUtil.toWebFlowerActivity(mContext);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ needDanMu = false;
|
|
|
+ needTag = true;
|
|
|
+ tagText = "活动";
|
|
|
+ tagType = 1;
|
|
|
+
|
|
|
+ } else if (mListData.get(position).getUserRead().getTag().equals("HOT")) {
|
|
|
+ //热播作品
|
|
|
+ needDanMu = true;
|
|
|
+ needTag = false;
|
|
|
+ tagText = "热播";
|
|
|
+ tagType = 2;
|
|
|
+
|
|
|
+ } else if (mListData.get(position).getUserRead().getTag().equals("NEW")) {
|
|
|
+ //新作品
|
|
|
+ needDanMu = true;
|
|
|
+ needTag = false;
|
|
|
+ tagText = "新作品";
|
|
|
+ tagType = 3;
|
|
|
+ } else if (mListData.get(position).getUserRead().getTag().equals("EXCELLENT")) {
|
|
|
+ //优秀作品
|
|
|
+ needDanMu = true;
|
|
|
+ needTag = true;
|
|
|
+ tagText = "优秀作品";
|
|
|
+ tagType = 4;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (needDanMu) {
|
|
|
holder.initDanMu(mListData.get(position).getUserRead().getId());
|
|
|
holder.mSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
@Override
|
|
@@ -109,29 +159,42 @@ public class SlideVideoAdapter extends RecyclerView.Adapter<VideoHolder> {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- } else if (mListData.get(position).getUserRead().getType().equals("AA")) {
|
|
|
- //这里修改成新的type。就可以使用了
|
|
|
- holder.mSwitch.setVisibility(View.INVISIBLE);
|
|
|
- holder.mEventBtn.setVisibility(View.VISIBLE);
|
|
|
- holder.mEventBtn.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- EfunboxUtil.toWebFlowerActivity(mContext);
|
|
|
- }
|
|
|
- });
|
|
|
- TextView textView = new TextView(mContext);
|
|
|
- textView.setLayoutParams(new LinearLayout.LayoutParams(SizeUtils.dp2px(mContext, 200), LinearLayout.LayoutParams.MATCH_PARENT));
|
|
|
- //左上圆角
|
|
|
+ }
|
|
|
+
|
|
|
+ if (needTag) {
|
|
|
+// // 判断是否是优秀视频type,然后增加tag标签
|
|
|
+// TextView textView = new TextView(mContext);
|
|
|
+// textView.setLayoutParams(new LinearLayout.LayoutParams(SizeUtils.dp2px(mContext, 200), LinearLayout.LayoutParams.MATCH_PARENT));
|
|
|
+// textView.setText(tagText);
|
|
|
+// //左上圆角
|
|
|
+//
|
|
|
+// ShapeCreator.create()
|
|
|
+// .setCornerRadiusLT(50)
|
|
|
+// .setCornerRadiusRB(50)
|
|
|
+// .setSolidColor(mContext.getResources().getColor(R.color.grassgreen))
|
|
|
+// .into(textView);
|
|
|
holder.mTagLayout.removeAllViews();
|
|
|
- ShapeCreator.create()
|
|
|
- .setCornerRadiusLT(50)
|
|
|
- .setCornerRadiusRB(50)
|
|
|
- .setSolidColor(mContext.getResources().getColor(R.color.grassgreen))
|
|
|
- .into(textView);
|
|
|
- holder.mTagLayout.addView(textView);
|
|
|
+ ImageView tagImg = new ImageView(mContext);
|
|
|
+ tagImg.setLayoutParams(new FrameLayout.LayoutParams(new LinearLayout.LayoutParams(SizeUtils.dp2px(mContext, 200), SizeUtils.dp2px(mContext, 70))));
|
|
|
+ Logger.e("tagType:" + tagType);
|
|
|
+ switch (tagType) {
|
|
|
+ case 1:
|
|
|
+ //活动
|
|
|
+ GlideUtils.loadImage(mContext, R.drawable.event_activity, tagImg);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ //热播
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ //新作品
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ //优秀作品
|
|
|
+ GlideUtils.loadImage(mContext, R.drawable.event_excellent, tagImg);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ holder.mTagLayout.addView(tagImg);
|
|
|
holder.mTagLayout.setVisibility(View.VISIBLE);
|
|
|
- } else {
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// holder.mVideo.posterImageView.setImageURI(Uri.parse(mListData.get(position).videoUrl));
|
|
@@ -162,7 +225,7 @@ class VideoHolder extends RecyclerView.ViewHolder {
|
|
|
public AutoPollRecyclerView mMarqueen;
|
|
|
public Switch mSwitch;
|
|
|
public ImageView mEventBtn;
|
|
|
- public LinearLayout mTagLayout;
|
|
|
+ public FrameLayout mTagLayout;
|
|
|
public Activity mContext;
|
|
|
|
|
|
public VideoHolder(Activity context, @NonNull View itemView) {
|