File tree Expand file tree Collapse file tree 4 files changed +10
-8
lines changed
library_tagflow/src/main/java/com/framework/tagflow Expand file tree Collapse file tree 4 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ abstract class BaseTagAdapter<T> : BaseAdapter() {
59
59
return
60
60
}
61
61
if (dataList[position] is BaseTagBean ){
62
- (dataList[position] as BaseTagBean ).setSelected (true )
62
+ (dataList[position] as BaseTagBean ).setIsSelected (true )
63
63
}
64
64
}
65
65
@@ -71,7 +71,7 @@ abstract class BaseTagAdapter<T> : BaseAdapter() {
71
71
return
72
72
}
73
73
if (dataList[position] is BaseTagBean ){
74
- (dataList[position] as BaseTagBean ).setSelected (false )
74
+ (dataList[position] as BaseTagBean ).setIsSelected (false )
75
75
}
76
76
77
77
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ package com.framework.tagflow.bean
9
9
open class BaseTagBean {
10
10
private var id = 0
11
11
private var name: String? = null
12
- private var selected = false // 是否选中
12
+ private var isSelected = false // 是否选中
13
13
private var tag: Any? = null // 标签额外信息
14
14
15
15
fun getId (): Int {
@@ -37,10 +37,10 @@ open class BaseTagBean {
37
37
}
38
38
39
39
fun isSelected (): Boolean {
40
- return selected
40
+ return isSelected
41
41
}
42
42
43
- fun setSelected (selected : Boolean ) {
44
- this .selected = selected
43
+ fun setIsSelected (selected : Boolean ) {
44
+ this .isSelected = selected
45
45
}
46
46
}
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import android.util.AttributeSet
8
8
import android.view.Gravity
9
9
import androidx.annotation.ColorInt
10
10
import androidx.appcompat.widget.AppCompatTextView
11
+ import androidx.core.content.ContextCompat
11
12
import com.framework.tagflow.utils.DensityUtils
12
13
import com.framework.tagflow.R
13
14
@@ -52,7 +53,7 @@ open class DefaultTagView @JvmOverloads constructor(
52
53
// 返回一个Drawable背景样式
53
54
protected open fun getBackgroundDrawable (): Drawable ? {
54
55
// 设置字体颜色的选择器
55
- val colorSateList = mContext.resources. getColorStateList(R .color.secondary_text)
56
+ val colorSateList = ContextCompat . getColorStateList(context, R .color.secondary_text)
56
57
setTextColor(colorSateList)
57
58
val normal = GradientDrawable ()
58
59
normal.shape = GradientDrawable .RECTANGLE
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import android.graphics.drawable.Drawable
6
6
import android.graphics.drawable.GradientDrawable
7
7
import android.graphics.drawable.StateListDrawable
8
8
import android.util.AttributeSet
9
+ import androidx.core.content.ContextCompat
9
10
import com.framework.tagflow.utils.DensityUtils
10
11
import com.framework.tagflow.R
11
12
@@ -29,7 +30,7 @@ class MutSelectedTagView : DefaultTagView {
29
30
30
31
override fun getBackgroundDrawable (): Drawable ? {
31
32
// 设置字体颜色的选择器
32
- val colorSateList = mContext.resources. getColorStateList(R .color.secondary_text)
33
+ val colorSateList = ContextCompat . getColorStateList(context, R .color.secondary_text)
33
34
setTextColor(colorSateList)
34
35
val normal = GradientDrawable ()
35
36
normal.shape = GradientDrawable .RECTANGLE
You can’t perform that action at this time.
0 commit comments