|
@@ -3,6 +3,7 @@ package com.cooleshow.teacher.widgets;
|
|
|
import android.content.Context;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.AttributeSet;
|
|
|
+import android.view.Gravity;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
@@ -14,6 +15,7 @@ import android.widget.TextView;
|
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
|
import com.cooleshow.base.common.WebConstants;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
+import com.cooleshow.base.utils.MusicSheetUtils;
|
|
|
import com.cooleshow.base.utils.SizeUtils;
|
|
|
import com.cooleshow.base.utils.UiUtils;
|
|
|
import com.cooleshow.teacher.R;
|
|
@@ -26,10 +28,6 @@ import androidx.annotation.Nullable;
|
|
|
* Author by pq, Date on 2022/8/8.
|
|
|
*/
|
|
|
public class HomeHotMusicSheetItemView extends FrameLayout {
|
|
|
- public static final String CHARGE_TYPE_FREE = "FREE";
|
|
|
- public static final String CHARGE_TYPE_VIP = "VIP";
|
|
|
- public static final String CHARGE_TYPE_CHARGE = "CHARGE";
|
|
|
- private TextView mTvTag;
|
|
|
private TextView mTvName;
|
|
|
private TextView mTvAuthor;
|
|
|
private TextView mTvUploadAuthor;
|
|
@@ -38,6 +36,7 @@ public class HomeHotMusicSheetItemView extends FrameLayout {
|
|
|
private HomeHotMusicSheetBean.RowsBean mBean;
|
|
|
private boolean isGood = false;//是否是精品曲目
|
|
|
private ImageView mIvGoodTag;
|
|
|
+ private LinearLayout mTagContainer;
|
|
|
|
|
|
public HomeHotMusicSheetItemView(@NonNull Context context) {
|
|
|
this(context, null);
|
|
@@ -54,7 +53,7 @@ public class HomeHotMusicSheetItemView extends FrameLayout {
|
|
|
|
|
|
private void init() {
|
|
|
LayoutInflater.from(getContext()).inflate(R.layout.view_hot_music_sheet_child_layout, this);
|
|
|
- mTvTag = findViewById(R.id.tv_tag);
|
|
|
+ mTagContainer = findViewById(R.id.ll_tag_container);
|
|
|
mTvName = findViewById(R.id.tv_name);
|
|
|
mTvAuthor = findViewById(R.id.tv_author);
|
|
|
mTvUploadAuthor = findViewById(R.id.tv_upload_author);
|
|
@@ -108,23 +107,14 @@ public class HomeHotMusicSheetItemView extends FrameLayout {
|
|
|
|
|
|
//精品标记
|
|
|
mIvGoodTag.setVisibility(TextUtils.equals(data.exquisiteFlag, "1") ? View.VISIBLE : View.GONE);
|
|
|
-
|
|
|
- if (TextUtils.equals(data.chargeType, CHARGE_TYPE_FREE)) {
|
|
|
- mTvTag.setText("免费");
|
|
|
- mTvTag.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_01b84f));
|
|
|
- mTvTag.setBackgroundResource(R.drawable.shape_01b84f_border);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (TextUtils.equals(data.chargeType, CHARGE_TYPE_VIP)) {
|
|
|
- mTvTag.setText("会员");
|
|
|
- mTvTag.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_cd863e));
|
|
|
- mTvTag.setBackgroundResource(R.drawable.shape_cd863e_border);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (TextUtils.equals(data.chargeType, CHARGE_TYPE_CHARGE)) {
|
|
|
- mTvTag.setText("点播");
|
|
|
- mTvTag.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_3591ce));
|
|
|
- mTvTag.setBackgroundResource(R.drawable.shape_3591ce_border);
|
|
|
+ mTagContainer.removeAllViews();
|
|
|
+ if (!TextUtils.isEmpty(data.paymentType)) {
|
|
|
+ String[] split = data.paymentType.split(",");
|
|
|
+ if (split != null && split.length > 0) {
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ MusicSheetUtils.createTag(getContext(), mTagContainer, split[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -155,4 +145,5 @@ public class HomeHotMusicSheetItemView extends FrameLayout {
|
|
|
mViewLine.setVisibility(isShow ? View.VISIBLE : View.INVISIBLE);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|