소스 검색

1.岗位列表如果标签不超过一行不显示 更多按钮

ZhangXinYu 6 년 전
부모
커밋
00336dfd47

+ 18 - 2
app/src/main/java/com/tongyu/luck/happywork/ui/viewholder/cclient/PositionListViewHolder.java

@@ -11,6 +11,7 @@ import com.donkingliang.labels.LabelsView;
 import com.tongyu.luck.happywork.R;
 import com.tongyu.luck.happywork.baselibrary.AppConstant;
 import com.tongyu.luck.happywork.baselibrary.utils.DateUtils;
+import com.tongyu.luck.happywork.baselibrary.widget.LineLabelsView;
 import com.tongyu.luck.happywork.bean.PositionAddressBean;
 import com.tongyu.luck.happywork.bean.PositionCompanyBean;
 import com.tongyu.luck.happywork.bean.PositionListBean;
@@ -40,7 +41,7 @@ public class PositionListViewHolder extends BaseViewHolder {
     @BindView(R.id.tv_area)
     TextView tvArea;
     @BindView(R.id.labels)
-    LabelsView labels;
+    LineLabelsView labels;
     @BindView(R.id.tv_back_price)
     TextView tvBackPrice;
     @BindView(R.id.ll_pay_back)
@@ -74,10 +75,11 @@ public class PositionListViewHolder extends BaseViewHolder {
 
     public PositionListViewHolder(Context mContext) {
         super(mContext);
+        labels.setmLineChangeListener(onLineChangeListener);
     }
 
     public PositionListViewHolder(Context mContext, long timeDifference) {
-        super(mContext);
+        this(mContext);
         this.timeDifference = timeDifference;
     }
 
@@ -348,6 +350,20 @@ public class PositionListViewHolder extends BaseViewHolder {
 
     }
 
+    /**
+     * 当行数变更
+     */
+    LineLabelsView.OnLineChangeListener onLineChangeListener = new LineLabelsView.OnLineChangeListener() {
+        @Override
+        public void showLine(LineLabelsView view, int line, int maxLine) {
+            if (line > 1) {
+                vLabel.setVisibility(View.VISIBLE);
+            } else {
+                vLabel.setVisibility(View.GONE);
+            }
+        }
+    };
+
 
     /**
      * 更多标签点击事件

+ 1 - 1
app/src/main/res/layout/item_recycler_job_content.xml

@@ -117,7 +117,7 @@
                 </LinearLayout>
 
 
-                <com.donkingliang.labels.LabelsView xmlns:app="http://schemas.android.com/apk/res-auto"
+                <com.tongyu.luck.happywork.baselibrary.widget.LineLabelsView xmlns:app="http://schemas.android.com/apk/res-auto"
                     android:id="@+id/labels"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"