@@ -477,13 +477,9 @@ private void processAttributes(Context context, AttributeSet attrs, int defStyle
477
477
? haloColor
478
478
: AppCompatResources .getColorStateList (context , R .color .material_slider_halo_color ));
479
479
480
- if (a .hasValue (R .styleable .Slider_tickVisibilityMode )) {
481
- this .tickVisibilityMode = a .getInt (R .styleable .Slider_tickVisibilityMode , -1 );
482
- } else {
483
- this .tickVisibilityMode = a .getBoolean (R .styleable .Slider_tickVisible , true )
484
- ? TICK_VISIBILITY_AUTO_LIMIT
485
- : TICK_VISIBILITY_HIDDEN ;
486
- }
480
+ tickVisibilityMode = a .hasValue (R .styleable .Slider_tickVisibilityMode )
481
+ ? a .getInt (R .styleable .Slider_tickVisibilityMode , -1 )
482
+ : convertToTickVisibilityMode (a .getBoolean (R .styleable .Slider_tickVisible , true ));
487
483
488
484
boolean hasTickColor = a .hasValue (R .styleable .Slider_tickColor );
489
485
int tickColorInactiveRes =
@@ -1489,9 +1485,8 @@ public void setTickInactiveTintList(@NonNull ColorStateList tickColor) {
1489
1485
* Returns whether the tick marks are visible. Only used when the slider is in discrete mode.
1490
1486
*
1491
1487
* @attr ref com.google.android.material.R.styleable#Slider_tickVisible
1492
- * @deprecated Use {@link BaseSlider#getTickVisibilityMode()} to get the current
1493
- * tick visibility mode or {@link BaseSlider#areTicksDrawn()} to get whether the ticks
1494
- * are currently drawn.
1488
+ * @deprecated Use {@link #getTickVisibilityMode()} to get the current tick visibility mode
1489
+ * or {@link #areTicksDrawn()} to get whether the ticks are currently drawn.
1495
1490
*/
1496
1491
@ Deprecated
1497
1492
public boolean isTickVisible () {
@@ -1517,11 +1512,18 @@ public boolean areTicksDrawn() {
1517
1512
*
1518
1513
* @param tickVisible The visibility of tick marks.
1519
1514
* @attr ref com.google.android.material.R.styleable#Slider_tickVisible
1520
- * @deprecated Use {@link BaseSlider #setTickVisibilityMode(int)} instead.
1515
+ * @deprecated Use {@link #setTickVisibilityMode(int)} instead.
1521
1516
*/
1522
1517
@ Deprecated
1523
1518
public void setTickVisible (boolean tickVisible ) {
1524
- setTickVisibilityMode (tickVisible ? TICK_VISIBILITY_AUTO_LIMIT : TICK_VISIBILITY_HIDDEN );
1519
+ setTickVisibilityMode (convertToTickVisibilityMode (tickVisible ));
1520
+ }
1521
+
1522
+ @ TickVisibilityMode
1523
+ private int convertToTickVisibilityMode (boolean tickVisible ) {
1524
+ return tickVisible
1525
+ ? TICK_VISIBILITY_AUTO_LIMIT
1526
+ : TICK_VISIBILITY_HIDDEN ;
1525
1527
}
1526
1528
1527
1529
/**
0 commit comments