Skip to content

Commit 1bb6970

Browse files
committed
更新values,防止与使用者的本地命名冲突
1 parent 2d0a4e9 commit 1bb6970

3 files changed

Lines changed: 57 additions & 57 deletions

File tree

GySeekBar/src/main/java/com/gaoyu/seekbar/SmartSeekBar.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,22 @@ private void init() {
103103
private void initAttrs(AttributeSet attrs) {
104104
if (attrs != null) {
105105
TypedArray t = getContext().obtainStyledAttributes(attrs, R.styleable.SmartSeekBar);
106-
mConfig.setBgColor(t.getColor(R.styleable.SmartSeekBar_bg_color, 0xffbfbfbf));
107-
mConfig.setBgDrawable(t.getDrawable(R.styleable.SmartSeekBar_bg_drawable));
108-
mConfig.setBgLineWidth(t.getDimensionPixelSize(R.styleable.SmartSeekBar_bg_line_width, 20));
109-
mConfig.setOpenBgCap(t.getBoolean(R.styleable.SmartSeekBar_open_bg_cap, true));
110-
mConfig.setPgColor(t.getColor(R.styleable.SmartSeekBar_pg_color, 0xffbb86fc));
111-
mConfig.setPgDrawable(t.getDrawable(R.styleable.SmartSeekBar_pg_drawable));
112-
mConfig.setSliderBg(t.getDrawable(R.styleable.SmartSeekBar_slider_bg));
113-
mConfig.setSliderStyle(sliderStyleArray[t.getInt(R.styleable.SmartSeekBar_slider_style, 0)]);
114-
mConfig.setSliderWidth(t.getDimensionPixelSize(R.styleable.SmartSeekBar_slider_width, 100));
115-
mConfig.setSliderHeight(t.getDimensionPixelSize(R.styleable.SmartSeekBar_slider_height, 100));
116-
mConfig.setTextColor(t.getColor(R.styleable.SmartSeekBar_text_color, 0xff333333));
117-
mConfig.setTextSize(t.getDimensionPixelSize(R.styleable.SmartSeekBar_text_size, 20));
118-
mConfig.setTextOffSet(t.getDimensionPixelSize(R.styleable.SmartSeekBar_text_offset, 0));
119-
mConfig.setMaxText(t.getInt(R.styleable.SmartSeekBar_max_text, 5));
120-
progress = t.getFloat(R.styleable.SmartSeekBar_progress, 0);
121-
mText = t.getString(R.styleable.SmartSeekBar_text);
106+
mConfig.setBgColor(t.getColor(R.styleable.SmartSeekBar_ssb_bg_color, 0xffbfbfbf));
107+
mConfig.setBgDrawable(t.getDrawable(R.styleable.SmartSeekBar_ssb_bg_drawable));
108+
mConfig.setBgLineWidth(t.getDimensionPixelSize(R.styleable.SmartSeekBar_ssb_bg_line_width, 20));
109+
mConfig.setOpenBgCap(t.getBoolean(R.styleable.SmartSeekBar_ssb_open_bg_cap, true));
110+
mConfig.setPgColor(t.getColor(R.styleable.SmartSeekBar_ssb_pg_color, 0xffbb86fc));
111+
mConfig.setPgDrawable(t.getDrawable(R.styleable.SmartSeekBar_ssb_pg_drawable));
112+
mConfig.setSliderBg(t.getDrawable(R.styleable.SmartSeekBar_ssb_slider_bg));
113+
mConfig.setSliderStyle(sliderStyleArray[t.getInt(R.styleable.SmartSeekBar_ssb_slider_style, 0)]);
114+
mConfig.setSliderWidth(t.getDimensionPixelSize(R.styleable.SmartSeekBar_ssb_slider_width, 100));
115+
mConfig.setSliderHeight(t.getDimensionPixelSize(R.styleable.SmartSeekBar_ssb_slider_height, 100));
116+
mConfig.setTextColor(t.getColor(R.styleable.SmartSeekBar_ssb_text_color, 0xff333333));
117+
mConfig.setTextSize(t.getDimensionPixelSize(R.styleable.SmartSeekBar_ssb_text_size, 20));
118+
mConfig.setTextOffSet(t.getDimensionPixelSize(R.styleable.SmartSeekBar_ssb_text_offset, 0));
119+
mConfig.setMaxText(t.getInt(R.styleable.SmartSeekBar_ssb_max_text, 5));
120+
progress = t.getFloat(R.styleable.SmartSeekBar_ssb_progress, 0);
121+
mText = t.getString(R.styleable.SmartSeekBar_ssb_text);
122122
t.recycle();
123123
}
124124
}

GySeekBar/src/main/res/values/values.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,39 @@
22
<resources>
33
<declare-styleable name="SmartSeekBar">
44
<!--背景条颜色-->
5-
<attr name="bg_color" format="color|reference" />
5+
<attr name="ssb_bg_color" format="color|reference" />
66
<!--背景条自定义背景-->
7-
<attr name="bg_drawable" format="reference" />
7+
<attr name="ssb_bg_drawable" format="reference" />
88
<!--背景条粗细-->
9-
<attr name="bg_line_width" format="dimension|reference" />
9+
<attr name="ssb_bg_line_width" format="dimension|reference" />
1010
<!--背景条线帽-->
11-
<attr name="open_bg_cap" format="boolean" />
11+
<attr name="ssb_open_bg_cap" format="boolean" />
1212
<!--进度条颜色-->
13-
<attr name="pg_color" format="color|reference" />
13+
<attr name="ssb_pg_color" format="color|reference" />
1414
<!--进度条自定义背景-->
15-
<attr name="pg_drawable" format="reference" />
15+
<attr name="ssb_pg_drawable" format="reference" />
1616
<!--滑块背景-->
17-
<attr name="slider_bg" format="reference" />
17+
<attr name="ssb_slider_bg" format="reference" />
1818
<!--滑块模式-->
19-
<attr name="slider_style" format="enum">
19+
<attr name="ssb_slider_style" format="enum">
2020
<enum name="normal" value="0" />
2121
<enum name="include" value="1" />
2222
</attr>
2323
<!--滑块宽度-->
24-
<attr name="slider_width" format="dimension|reference" />
24+
<attr name="ssb_slider_width" format="dimension|reference" />
2525
<!--滑块高度-->
26-
<attr name="slider_height" format="dimension|reference" />
26+
<attr name="ssb_slider_height" format="dimension|reference" />
2727
<!--文本颜色-->
28-
<attr name="text_color" format="color|reference" />
28+
<attr name="ssb_text_color" format="color|reference" />
2929
<!--文本大小-->
30-
<attr name="text_size" format="dimension|reference" />
30+
<attr name="ssb_text_size" format="dimension|reference" />
3131
<!--文本偏移-->
32-
<attr name="text_offset" format="dimension|reference" />
32+
<attr name="ssb_text_offset" format="dimension|reference" />
3333
<!--最大文本数量-->
34-
<attr name="max_text" format="integer" />
34+
<attr name="ssb_max_text" format="integer" />
3535
<!--当前进度-->
36-
<attr name="progress" format="float" />
36+
<attr name="ssb_progress" format="float" />
3737
<!--文本-->
38-
<attr name="text" format="string" />
38+
<attr name="ssb_text" format="string" />
3939
</declare-styleable>
4040
</resources>

app/src/main/res/layout/activity_seek_bar.xml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
android:layout_height="wrap_content"
1313
android:layout_marginTop="20px"
1414
android:layout_marginBottom="20px"
15-
app:progress="50"
16-
app:slider_bg="@mipmap/any_pic" />
15+
app:ssb_progress="50"
16+
app:ssb_slider_bg="@mipmap/any_pic" />
1717

1818
<View
1919
android:layout_width="match_parent"
@@ -25,11 +25,11 @@
2525
android:layout_height="wrap_content"
2626
android:layout_marginTop="20px"
2727
android:layout_marginBottom="20px"
28-
app:bg_drawable="@drawable/simple_bg"
29-
app:bg_line_width="100px"
30-
app:pg_drawable="@drawable/simple_pg_bitmap"
31-
app:progress="0"
32-
app:slider_bg="@mipmap/any_pic" />
28+
app:ssb_bg_drawable="@drawable/simple_bg"
29+
app:ssb_bg_line_width="100px"
30+
app:ssb_pg_drawable="@drawable/simple_pg_bitmap"
31+
app:ssb_progress="0"
32+
app:ssb_slider_bg="@mipmap/any_pic" />
3333

3434
<View
3535
android:layout_width="match_parent"
@@ -41,12 +41,12 @@
4141
android:layout_height="wrap_content"
4242
android:layout_marginTop="20px"
4343
android:layout_marginBottom="20px"
44-
app:bg_drawable="@drawable/simple_bg"
45-
app:bg_line_width="100px"
46-
app:pg_drawable="@drawable/simple_pg_bitmap"
47-
app:progress="0"
48-
app:slider_bg="@mipmap/any_pic"
49-
app:slider_style="include" />
44+
app:ssb_bg_drawable="@drawable/simple_bg"
45+
app:ssb_bg_line_width="100px"
46+
app:ssb_pg_drawable="@drawable/simple_pg_bitmap"
47+
app:ssb_progress="0"
48+
app:ssb_slider_bg="@mipmap/any_pic"
49+
app:ssb_slider_style="include" />
5050

5151
<View
5252
android:layout_width="match_parent"
@@ -59,10 +59,10 @@
5959
android:layout_height="wrap_content"
6060
android:layout_marginTop="45px"
6161
android:layout_marginBottom="45px"
62-
app:max_text="6"
63-
app:slider_bg="@drawable/simple_slider"
64-
app:slider_height="50px"
65-
app:text_offset="-2px" />
62+
app:ssb_max_text="6"
63+
app:ssb_slider_bg="@drawable/simple_slider"
64+
app:ssb_slider_height="50px"
65+
app:ssb_text_offset="-2px" />
6666

6767
<View
6868
android:layout_width="match_parent"
@@ -75,14 +75,14 @@
7575
android:layout_height="wrap_content"
7676
android:layout_marginTop="20px"
7777
android:layout_marginBottom="20px"
78-
app:max_text="6"
79-
app:slider_bg="@drawable/simple_slider"
80-
app:bg_drawable="@drawable/simple_bg"
81-
app:pg_drawable="@drawable/simple_pg"
82-
app:bg_line_width="100px"
83-
app:slider_height="100px"
84-
app:text_offset="-2px"
85-
app:slider_style="include"/>
78+
app:ssb_bg_drawable="@drawable/simple_bg"
79+
app:ssb_bg_line_width="100px"
80+
app:ssb_max_text="6"
81+
app:ssb_pg_drawable="@drawable/simple_pg"
82+
app:ssb_slider_bg="@drawable/simple_slider"
83+
app:ssb_slider_height="100px"
84+
app:ssb_slider_style="include"
85+
app:ssb_text_offset="-2px" />
8686

8787
<View
8888
android:layout_width="match_parent"

0 commit comments

Comments
 (0)