|  | @@ -3,6 +3,7 @@ package com.cooleshow.base.utils;
 | 
											
												
													
														|  |  import android.content.Context;
 |  |  import android.content.Context;
 | 
											
												
													
														|  |  import android.text.TextUtils;
 |  |  import android.text.TextUtils;
 | 
											
												
													
														|  |  import android.view.Gravity;
 |  |  import android.view.Gravity;
 | 
											
												
													
														|  | 
 |  | +import android.view.View;
 | 
											
												
													
														|  |  import android.view.ViewGroup;
 |  |  import android.view.ViewGroup;
 | 
											
												
													
														|  |  import android.widget.LinearLayout;
 |  |  import android.widget.LinearLayout;
 | 
											
												
													
														|  |  import android.widget.TextView;
 |  |  import android.widget.TextView;
 | 
											
										
											
												
													
														|  | @@ -16,13 +17,14 @@ public class MusicSheetUtils {
 | 
											
												
													
														|  |      public static final String CHARGE_TYPE_FREE = "FREE";
 |  |      public static final String CHARGE_TYPE_FREE = "FREE";
 | 
											
												
													
														|  |      public static final String CHARGE_TYPE_VIP = "VIP";
 |  |      public static final String CHARGE_TYPE_VIP = "VIP";
 | 
											
												
													
														|  |      public static final String CHARGE_TYPE_CHARGE = "CHARGE";
 |  |      public static final String CHARGE_TYPE_CHARGE = "CHARGE";
 | 
											
												
													
														|  | -    public static void createTag(Context context,ViewGroup viewParent, String chargeType) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    public static void createTag(Context context, ViewGroup viewParent, String chargeType) {
 | 
											
												
													
														|  |          TextView textView = new TextView(context);
 |  |          TextView textView = new TextView(context);
 | 
											
												
													
														|  |          textView.setWidth(SizeUtils.dp2px(30));
 |  |          textView.setWidth(SizeUtils.dp2px(30));
 | 
											
												
													
														|  |          textView.setHeight(SizeUtils.dp2px(17));
 |  |          textView.setHeight(SizeUtils.dp2px(17));
 | 
											
												
													
														|  |          textView.setTextSize(10);
 |  |          textView.setTextSize(10);
 | 
											
												
													
														|  |          textView.setGravity(Gravity.CENTER);
 |  |          textView.setGravity(Gravity.CENTER);
 | 
											
												
													
														|  | -        setTagStyle(context,chargeType, textView);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        setTagStyle(context, chargeType, textView);
 | 
											
												
													
														|  |          LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
 |  |          LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
 | 
											
												
													
														|  |          if (viewParent.getChildCount() >= 1) {
 |  |          if (viewParent.getChildCount() >= 1) {
 | 
											
												
													
														|  |              params.setMargins(SizeUtils.dp2px(4), 0, 0, 0);
 |  |              params.setMargins(SizeUtils.dp2px(4), 0, 0, 0);
 | 
											
										
											
												
													
														|  | @@ -30,7 +32,7 @@ public class MusicSheetUtils {
 | 
											
												
													
														|  |          viewParent.addView(textView, params);
 |  |          viewParent.addView(textView, params);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    private static void setTagStyle(Context context,String chargeType, TextView tvTag) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private static void setTagStyle(Context context, String chargeType, TextView tvTag) {
 | 
											
												
													
														|  |          if (TextUtils.equals(chargeType, CHARGE_TYPE_FREE)) {
 |  |          if (TextUtils.equals(chargeType, CHARGE_TYPE_FREE)) {
 | 
											
												
													
														|  |              tvTag.setText("免费");
 |  |              tvTag.setText("免费");
 | 
											
												
													
														|  |              tvTag.setTextColor(context.getResources().getColor(com.cooleshow.base.R.color.color_01b84f));
 |  |              tvTag.setTextColor(context.getResources().getColor(com.cooleshow.base.R.color.color_01b84f));
 | 
											
										
											
												
													
														|  | @@ -49,4 +51,21 @@ public class MusicSheetUtils {
 | 
											
												
													
														|  |              tvTag.setBackgroundResource(R.drawable.shape_3591ce_border);
 |  |              tvTag.setBackgroundResource(R.drawable.shape_3591ce_border);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 添加专辑曲目标签
 | 
											
												
													
														|  | 
 |  | +     * @param albumNums
 | 
											
												
													
														|  | 
 |  | +     * @param albumTagView
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    public static void addAlbumTag(int albumNums, View albumTagView) {
 | 
											
												
													
														|  | 
 |  | +        if (albumTagView == null) {
 | 
											
												
													
														|  | 
 |  | +            return;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        if (albumNums > 0) {
 | 
											
												
													
														|  | 
 |  | +            albumTagView.setVisibility(View.VISIBLE);
 | 
											
												
													
														|  | 
 |  | +        } else {
 | 
											
												
													
														|  | 
 |  | +            albumTagView.setVisibility(View.GONE);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  |  }
 |  |  }
 |