Skip to content

Commit c51147b

Browse files
author
TuringTechnologies
committed
Annotations
1 parent 304a8fe commit c51147b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import android.graphics.Color;
2525
import android.graphics.drawable.GradientDrawable;
2626
import android.os.Build;
27+
import android.support.annotation.ColorInt;
28+
import android.support.annotation.ColorRes;
2729
import android.support.v4.content.ContextCompat;
2830
import android.support.v4.view.ViewCompat;
2931
import android.support.v4.widget.SwipeRefreshLayout;
@@ -374,7 +376,7 @@ public T setHandleColour(String colour){
374376
* Provides the ability to programmatically set the colour of the scrollbar handle.
375377
* @param colour to set the handle.
376378
*/
377-
public T setHandleColour(int colour){
379+
public T setHandleColour(@ColorInt int colour){
378380
handleColour = colour;
379381
setHandleColour();
380382
return (T)this;
@@ -384,7 +386,7 @@ public T setHandleColour(int colour){
384386
* Provides the ability to programmatically set the colour of the scrollbar handle.
385387
* @param colourResId to set the handle.
386388
*/
387-
public T setHandleColourRes(int colourResId){
389+
public T setHandleColourRes(@ColorRes int colourResId){
388390
handleColour = ContextCompat.getColor(getContext(), colourResId);
389391
setHandleColour();
390392
return (T)this;
@@ -415,7 +417,7 @@ public T setHandleOffColour(String colour){
415417
* Provides the ability to programmatically set the colour of the scrollbar handle when unpressed. Only applies if lightOnTouch is true.
416418
* @param colour to set the handle when unpressed.
417419
*/
418-
public T setHandleOffColour(int colour){
420+
public T setHandleOffColour(@ColorInt int colour){
419421
handleOffColour = colour;
420422
if(lightOnTouch){
421423
handle.setBackgroundColor(handleOffColour);
@@ -427,7 +429,7 @@ public T setHandleOffColour(int colour){
427429
* Provides the ability to programmatically set the colour of the scrollbar handle when unpressed. Only applies if lightOnTouch is true.
428430
* @param colourResId to set the handle when unpressed.
429431
*/
430-
public T setHandleOffColourRes(int colourResId){
432+
public T setHandleOffColourRes(@ColorRes int colourResId){
431433
handleOffColour = ContextCompat.getColor(getContext(), colourResId);
432434
if(lightOnTouch){
433435
handle.setBackgroundColor(handleOffColour);
@@ -448,7 +450,7 @@ public T setBarColour(String colour){
448450
* Provides the ability to programmatically set the colour of the scrollbar.
449451
* @param colour to set the bar.
450452
*/
451-
public T setBarColour(int colour){
453+
public T setBarColour(@ColorInt int colour){
452454
background.setBackgroundColor(colour);
453455
return (T)this;
454456
}
@@ -457,7 +459,7 @@ public T setBarColour(int colour){
457459
* Provides the ability to programmatically set the colour of the scrollbar.
458460
* @param colourResId to set the bar.
459461
*/
460-
public T setBarColourRes(int colourResId){
462+
public T setBarColourRes(@ColorRes int colourResId){
461463
background.setBackgroundColor(ContextCompat.getColor(getContext(), colourResId));
462464
return (T)this;
463465
}
@@ -466,7 +468,7 @@ public T setBarColourRes(int colourResId){
466468
* Provides the ability to programmatically set the text colour of the indicator. Will do nothing if there is no section indicator.
467469
* @param colour to set the text of the indicator.
468470
*/
469-
public T setTextColour(int colour){
471+
public T setTextColour(@ColorInt int colour){
470472
textColour = colour;
471473
if(indicator != null){
472474
indicator.setTextColour(textColour);
@@ -479,7 +481,7 @@ public T setTextColour(int colour){
479481
* Provides the ability to programmatically set the text colour of the indicator. Will do nothing if there is no section indicator.
480482
* @param colourResId to set the text of the indicator.
481483
*/
482-
public T setTextColourRes(int colourResId){
484+
public T setTextColourRes(@ColorRes int colourResId){
483485
textColour = ContextCompat.getColor(getContext(), colourResId);
484486
if(indicator != null){
485487
indicator.setTextColour(textColour);

0 commit comments

Comments
 (0)