Skip to content

Commit d0fe97f

Browse files
author
TuringTechnologies
committed
Version 10.0.0
- Fixes #42 - Fixes #43
1 parent 1e08bf9 commit d0fe97f

File tree

5 files changed

+31
-32
lines changed

5 files changed

+31
-32
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<com.turingtechnologies.materialscrollbar.DragScrollBar
1414
android:id="@+id/dragScrollBar"
1515
android:layout_width="wrap_content"
16-
app:recyclerView="@id/recyclerView"
17-
app:lightOnTouch="false"
16+
app:msb_recyclerView="@id/recyclerView"
17+
app:msb_lightOnTouch="false"
1818
android:layout_height="match_parent"
1919
android:layout_alignParentTop="true"
2020
android:layout_alignParentRight="true"

lib/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
22
apply plugin: 'com.github.dcendents.android-maven'
33
apply plugin: 'com.jfrog.bintray'
44

5-
def version = '9.3.0'
5+
def version = '10.0.0'
66

77
install {
88
repositories.mavenInstaller {
@@ -46,7 +46,7 @@ android {
4646
defaultConfig {
4747
minSdkVersion 11
4848
targetSdkVersion 23
49-
versionCode 21
49+
versionCode 22
5050
versionName version
5151
}
5252
}

lib/src/main/java/com/turingtechnologies/materialscrollbar/MaterialScrollBar.java

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ abstract class MaterialScrollBar<T> extends RelativeLayout {
9898
programmatic = false;
9999
addView(setUpBackground(context));
100100
setUpProps(context, attributeSet);
101-
addView(setUpHandle(context, a.getBoolean(R.styleable.MaterialScrollBar_lightOnTouch, true)));
101+
addView(setUpHandle(context, a.getBoolean(R.styleable.MaterialScrollBar_msb_lightOnTouch, true)));
102102
if(!isInEditMode()){
103-
seekId = a.getResourceId(R.styleable.MaterialScrollBar_recyclerView, 0);
103+
seekId = a.getResourceId(R.styleable.MaterialScrollBar_msb_recyclerView, 0);
104104
}
105105
implementPreferences();
106106
a.recycle();
@@ -133,11 +133,11 @@ void setUpProps(Context context, AttributeSet attrs){
133133
0, 0);
134134
ArrayList<String> missing = new ArrayList<>();
135135
//Ensures that a recyclerView is associated with the bar.
136-
if(!a.hasValue(R.styleable.MaterialScrollBar_recyclerView)){
136+
if(!a.hasValue(R.styleable.MaterialScrollBar_msb_recyclerView)){
137137
missing.add("recyclerView");
138138
}
139139
//Ensures that a preference is expressed for lightOnTouch.
140-
if(!a.hasValue(R.styleable.MaterialScrollBar_lightOnTouch)){
140+
if(!a.hasValue(R.styleable.MaterialScrollBar_msb_lightOnTouch)){
141141
missing.add("lightOnTouch");
142142
}
143143
if(missing.size() != 0){
@@ -182,20 +182,20 @@ Handle setUpHandle(Context context, Boolean lightOnTouch){
182182

183183
//XML case only. Implements optional attributes.
184184
void implementPreferences(){
185-
if(a.hasValue(R.styleable.MaterialScrollBar_barColour)){
186-
setBarColour(a.getColor(R.styleable.MaterialScrollBar_barColour, 0));
185+
if(a.hasValue(R.styleable.MaterialScrollBar_msb_barColour)){
186+
setBarColour(a.getColor(R.styleable.MaterialScrollBar_msb_barColour, 0));
187187
}
188-
if(a.hasValue(R.styleable.MaterialScrollBar_handleColour)){
189-
setHandleColour(a.getColor(R.styleable.MaterialScrollBar_handleColour, 0));
188+
if(a.hasValue(R.styleable.MaterialScrollBar_msb_handleColour)){
189+
setHandleColour(a.getColor(R.styleable.MaterialScrollBar_msb_handleColour, 0));
190190
}
191-
if(a.hasValue(R.styleable.MaterialScrollBar_handleOffColour)){
192-
setHandleOffColour(a.getColor(R.styleable.MaterialScrollBar_handleOffColour, 0));
191+
if(a.hasValue(R.styleable.MaterialScrollBar_msb_handleOffColour)){
192+
setHandleOffColour(a.getColor(R.styleable.MaterialScrollBar_msb_handleOffColour, 0));
193193
}
194-
if(a.hasValue(R.styleable.MaterialScrollBar_textColour)){
195-
setTextColour(a.getColor(R.styleable.MaterialScrollBar_textColour, 0));
194+
if(a.hasValue(R.styleable.MaterialScrollBar_msb_textColour)){
195+
setTextColour(a.getColor(R.styleable.MaterialScrollBar_msb_textColour, 0));
196196
}
197-
if(a.hasValue(R.styleable.MaterialScrollBar_barThickness)){
198-
setBarThickness(a.getInteger(R.styleable.MaterialScrollBar_barThickness, 0));
197+
if(a.hasValue(R.styleable.MaterialScrollBar_msb_barThickness)){
198+
setBarThickness(a.getDimensionPixelSize(R.styleable.MaterialScrollBar_msb_barThickness, 0));
199199
}
200200
implementFlavourPreferences(a);
201201
}
@@ -541,7 +541,6 @@ public void onLayoutChange(View v, int left, int top, int right, int bottom, int
541541
* @param thickness The desired bar thickness.
542542
*/
543543
public T setBarThickness(int thickness){
544-
thickness = Utils.getDP(thickness, this);
545544
LayoutParams layoutParams = (LayoutParams) handle.getLayoutParams();
546545
layoutParams.width = thickness;
547546
handle.setLayoutParams(layoutParams);

lib/src/main/java/com/turingtechnologies/materialscrollbar/TouchScrollBar.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ boolean getHide() {
121121

122122
@Override
123123
void implementFlavourPreferences(TypedArray a) {
124-
if(a.hasValue(R.styleable.TouchScrollBar_autoHide)){
125-
setAutoHide(a.getBoolean(R.styleable.TouchScrollBar_autoHide, true));
124+
if(a.hasValue(R.styleable.TouchScrollBar_msb_autoHide)){
125+
setAutoHide(a.getBoolean(R.styleable.TouchScrollBar_msb_autoHide, true));
126126
}
127-
if(a.hasValue(R.styleable.TouchScrollBar_hideDelayInMilliseconds)){
128-
hideDuration = (a.getInteger(R.styleable.TouchScrollBar_hideDelayInMilliseconds, 2500));
127+
if(a.hasValue(R.styleable.TouchScrollBar_msb_hideDelayInMilliseconds)){
128+
hideDuration = (a.getInteger(R.styleable.TouchScrollBar_msb_hideDelayInMilliseconds, 2500));
129129
}
130130
}
131131

lib/src/main/res/values/attrs.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
<resources>
1919

2020
<declare-styleable name="MaterialScrollBar">
21-
<attr name="recyclerView" format="reference"/>
22-
<attr name="lightOnTouch" format="boolean"/>
23-
<attr name="handleColour" format="color"/>
24-
<attr name="barColour" format="color"/>
25-
<attr name="handleOffColour" format="color"/>
26-
<attr name="textColour" format="color"/>
27-
<attr name="barThickness" format="integer"/>
21+
<attr name="msb_recyclerView" format="reference"/>
22+
<attr name="msb_lightOnTouch" format="boolean|reference"/>
23+
<attr name="msb_handleColour" format="color|reference"/>
24+
<attr name="msb_barColour" format="color|reference"/>
25+
<attr name="msb_handleOffColour" format="color|reference"/>
26+
<attr name="msb_textColour" format="color|reference"/>
27+
<attr name="msb_barThickness" format="dimension|reference"/>
2828
</declare-styleable>
2929

3030
<declare-styleable name="TouchScrollBar">
31-
<attr name="hideDelayInMilliseconds" format="integer"/>
32-
<attr name="autoHide" format="boolean"/>
31+
<attr name="msb_hideDelayInMilliseconds" format="integer|reference"/>
32+
<attr name="msb_autoHide" format="boolean|reference"/>
3333
</declare-styleable>
3434

3535
</resources>

0 commit comments

Comments
 (0)