[Modify]标签功能修改
This commit is contained in:
@@ -5,8 +5,8 @@ import java.io.Serializable
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
data class UserLabelInfo(
|
data class UserLabelInfo(
|
||||||
val config: List<UserLabelItemInfo>,
|
val config: List<UserLabelItemInfo> ?= null,
|
||||||
val meLabels: List<String>
|
val meLabels: List<String> ?= null
|
||||||
) : Serializable
|
) : Serializable
|
||||||
|
|
||||||
|
|
||||||
|
@@ -134,6 +134,9 @@ dependencies {
|
|||||||
|
|
||||||
api "jp.wasabeef:glide-transformations:${GlideTransformationsVersion}"
|
api "jp.wasabeef:glide-transformations:${GlideTransformationsVersion}"
|
||||||
|
|
||||||
|
//流式布局
|
||||||
|
api 'com.google.android.flexbox:flexbox:3.0.0'
|
||||||
|
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@@ -0,0 +1,56 @@
|
|||||||
|
package com.yizhuan.xchat_android_library.common.widget;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.google.android.flexbox.FlexLine;
|
||||||
|
import com.google.android.flexbox.FlexboxLayoutManager;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* author: wushaocheng
|
||||||
|
* time: 2022/2/17
|
||||||
|
* desc: 一行显示FlexBoxManager
|
||||||
|
*/
|
||||||
|
public class LinesFlexBoxLayoutManager extends FlexboxLayoutManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大行数
|
||||||
|
*
|
||||||
|
* 小于等于0时,不限制行数
|
||||||
|
*/
|
||||||
|
private int maxLines = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置最大显示行数
|
||||||
|
* @param maxLines
|
||||||
|
*/
|
||||||
|
public void setMaxLines(int maxLines) {
|
||||||
|
this.maxLines = maxLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinesFlexBoxLayoutManager(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinesFlexBoxLayoutManager(Context context, int flexDirection) {
|
||||||
|
super(context, flexDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinesFlexBoxLayoutManager(Context context, int flexDirection, int flexWrap) {
|
||||||
|
super(context, flexDirection, flexWrap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删掉多余的行数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<FlexLine> getFlexLinesInternal() {
|
||||||
|
List<FlexLine> flexLines = super.getFlexLinesInternal();
|
||||||
|
int size = flexLines.size();
|
||||||
|
if (maxLines > 0 && size > maxLines) {
|
||||||
|
flexLines.subList(maxLines, size).clear();
|
||||||
|
}
|
||||||
|
return flexLines;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user