|
@@ -14,6 +14,7 @@ import android.widget.TextView;
|
|
|
|
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
|
import com.cooleshow.base.common.WebConstants;
|
|
|
+import com.cooleshow.base.constanst.MusicSubjectType;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.utils.MusicSheetUtils;
|
|
|
import com.cooleshow.base.utils.SizeUtils;
|
|
@@ -22,6 +23,8 @@ import com.cooleshow.base.utils.helper.WebStartHelper;
|
|
|
import com.cooleshow.student.R;
|
|
|
import com.cooleshow.student.bean.HomeHotMusicSheetBean;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+
|
|
|
import androidx.annotation.NonNull;
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
@@ -97,12 +100,15 @@ public class HomeHotMusicSheetItemView extends FrameLayout {
|
|
|
|
|
|
|
|
|
mLlMusicSubject.removeAllViews();
|
|
|
- if (!TextUtils.isEmpty(data.subjectNames)) {
|
|
|
- String[] split = data.subjectNames.split(",");
|
|
|
- if (split != null && split.length > 0) {
|
|
|
- for (int i = 0; i < split.length; i++) {
|
|
|
- createSubjectView(split[i]);
|
|
|
+ ArrayList<View> subjectTipView = MusicSubjectType.getSubjectTipView(getContext(), mLlMusicSubject, data.getMusicSheetType(), data.subjectNames);
|
|
|
+ if (subjectTipView.size() > 0) {
|
|
|
+ for (int i = 0; i < subjectTipView.size(); i++) {
|
|
|
+ View view = subjectTipView.get(i);
|
|
|
+ LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
|
+ if (mLlMusicSubject.getChildCount() >= 1) {
|
|
|
+ params.setMargins(SizeUtils.dp2px(4), 0, 0, 0);
|
|
|
}
|
|
|
+ mLlMusicSubject.addView(view, params);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -110,7 +116,7 @@ public class HomeHotMusicSheetItemView extends FrameLayout {
|
|
|
mIvGoodTag.setVisibility(TextUtils.equals(data.exquisiteFlag, "1") ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
//专辑曲目标记
|
|
|
- MusicSheetUtils.addAlbumTag(data.albumNums,mIvAlbumTag);
|
|
|
+ MusicSheetUtils.addAlbumTag(data.albumNums, mIvAlbumTag);
|
|
|
}
|
|
|
|
|
|
private void createSubjectView(String text) {
|
|
@@ -119,9 +125,6 @@ public class HomeHotMusicSheetItemView extends FrameLayout {
|
|
|
textView.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_2dc7aa));
|
|
|
textView.setBackgroundResource(com.cooleshow.base.R.drawable.shape_effbf9_9dp);
|
|
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
|
- if (mLlMusicSubject.getChildCount() >= 1) {
|
|
|
- params.setMargins(SizeUtils.dp2px(4), 0, 0, 0);
|
|
|
- }
|
|
|
mLlMusicSubject.addView(textView, params);
|
|
|
}
|
|
|
|