Skip to content

Commit

Permalink
Version 4.0.1
Browse files Browse the repository at this point in the history
- Fixed flipped indicator bug affecting APIs 14-.

- Fixed no indicator colour bug affecting all APIs.

- Fixed indicator not fading bug affecting APIs 14-.
  • Loading branch information
turing-tech committed Sep 11, 2015
1 parent 60baa9e commit a6b30fb
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ android {

defaultConfig {
applicationId "com.turingtechnologies.materialscrollbardemo"
minSdkVersion 11
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionCode 2
versionName "2.0"
}
buildTypes {
Expand Down
6 changes: 3 additions & 3 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ext {
siteUrl = 'https://github.com/krimin-killr21/MaterialScrollBar'
gitUrl = 'https://github.com/krimin-killr21/MaterialScrollBar.git'

libraryVersion = '4.0.0'
libraryVersion = '4.0.1'

developerId = 'krimin-killr21'
developerName = 'Turing Technologies'
Expand All @@ -31,8 +31,8 @@ android {
defaultConfig {
minSdkVersion 7
targetSdkVersion 23
versionCode 6
versionName "4.0.0"
versionCode 7
versionName "4.0.1"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
Expand Down Expand Up @@ -168,6 +171,9 @@ public boolean onTouch(View v, MotionEvent event) {
fadeIn();
} else {
if(indicator != null && indicator.getVisibility() == VISIBLE){
if(Build.VERSION.SDK_INT <= 12){
indicator.clearAnimation();
}
indicator.setVisibility(INVISIBLE);
}

Expand Down Expand Up @@ -200,9 +206,10 @@ public MaterialScrollBar setHideDuration(int duration){
* @param colour to set the handle.
*/
public MaterialScrollBar setHandleColour(String colour){
handleColour = Color.parseColor(colour);
handleColour = ContextCompat.getColor(getContext(), Color.parseColor(colour));
((GradientDrawable) indicator.getBackground()).setColor(Color.parseColor(colour));
if(!lightOnTouch) {
handle.setBackgroundColor(Color.parseColor(colour));
((GradientDrawable)indicator.getBackground()).setColor(Color.parseColor(colour));
}
return this;
}
Expand All @@ -212,9 +219,14 @@ public MaterialScrollBar setHandleColour(String colour){
* @param colour to set the handle.
*/
public MaterialScrollBar setHandleColour(int colour){
handleColour = getResources().getColor(colour);
try{
handleColour = ContextCompat.getColor(getContext(), getResources().getColor(colour));
} catch (Resources.NotFoundException e){
handleColour = colour;
}
((GradientDrawable)indicator.getBackground()).setColor(handleColour);
if(!lightOnTouch){
handle.setBackgroundColor(getResources().getColor(colour));
handle.setBackgroundColor(handleColour);
}
return this;
}
Expand Down
30 changes: 30 additions & 0 deletions lib/src/main/res/drawable-v12/indicator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright © 2015, Turing Technologies, an unincorporated organisation of Wynne Plaga
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<shape
xmlns:android="http://schemas.android.com/apk/res/android" >

<solid
android:color="@android:color/white" />

<corners
android:bottomLeftRadius="100dp"
android:topLeftRadius="100dp"
android:topRightRadius="100dp"
android:bottomRightRadius="0dp" />

</shape>
7 changes: 5 additions & 2 deletions lib/src/main/res/drawable/indicator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
<solid
android:color="@android:color/white" />

<!--
~ For some idiotic reason Android switches left and right until API 12+. Baffling.
-->
<corners
android:bottomLeftRadius="100dp"
android:bottomLeftRadius="0dp"
android:topLeftRadius="100dp"
android:topRightRadius="100dp"
android:bottomRightRadius="0dp" />
android:bottomRightRadius="100dp" />

</shape>

0 comments on commit a6b30fb

Please sign in to comment.