You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.CustomSlider, 0, 0)
101
-
sliderColor = typedArray.getColor(R.styleable.CustomSlider_sliderColor, Color.BLUE) // Set value from XML attributes or set default slider color
102
-
circleColor = typedArray.getColor(R.styleable.CustomSlider_circleColor, Color.GRAY) // Set value from XML attributes or set default circle/text color
103
-
criticalColor = typedArray.getColor(R.styleable.CustomSlider_criticalColor, Color.RED) // Set value from XML attributes or set default circle/text color
104
-
editTextColor = typedArray.getColor(R.styleable.CustomSlider_editTextBorderColor, Color.LTGRAY) // Set value from XML attributes or set default edit text color
105
-
circleWidth = typedArray.getDimensionPixelSize(R.styleable.CustomSlider_circleSize, resources.getDimension(R.dimen.circleSize).toInt()) // Set value from XML attributes or set default size of circle
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.SASlider, 0, 0)
101
+
sliderColor = typedArray.getColor(R.styleable.SASlider_sliderColor, Color.BLUE) // Set value from XML attributes or set default slider color
102
+
circleColor = typedArray.getColor(R.styleable.SASlider_circleColor, Color.GRAY) // Set value from XML attributes or set default circle/text color
103
+
criticalColor = typedArray.getColor(R.styleable.SASlider_criticalColor, Color.RED) // Set value from XML attributes or set default circle/text color
104
+
editTextColor = typedArray.getColor(R.styleable.SASlider_editTextBorderColor, Color.LTGRAY) // Set value from XML attributes or set default edit text color
105
+
circleWidth = typedArray.getDimensionPixelSize(R.styleable.SASlider_circleSize, resources.getDimension(R.dimen.circleSize).toInt()) // Set value from XML attributes or set default size of circle
106
106
bigCircleWidth = circleWidth *2// Big circle is twice the size of small circle
107
107
thumbWidth = (bigCircleWidth *3) // Thumb should be large enough to be seen
108
108
spaceSize = bigCircleWidth *2// Space is twice the size of big circle
109
109
textViewSize = (spaceSize *5) + (bigCircleWidth *5) // Text View is size of 5 circles and 5 spaces as text is displayed at every 5th circle
110
110
spaceBetweenCircles = bigCircleWidth + spaceSize // Space between center point is equal to two half big circles i.e. one big circle and size of space
111
-
isDecimal = typedArray.getBoolean(R.styleable.CustomSlider_isDecimal, false) // Set value from XML attributes or set default slider type
112
-
min = typedArray.getFloat(R.styleable.CustomSlider_minValue, 1.0f).toDouble().roundToOneDecimal() // Set value from XML attributes or set default min value
113
-
max = typedArray.getFloat(R.styleable.CustomSlider_maxValue, 10.0f).toDouble().roundToOneDecimal() // Set value from XML attributes or set default max value
114
-
upperThreshold = typedArray.getFloat(R.styleable.CustomSlider_upperThreshold, max.toFloat()).toDouble().roundToOneDecimal() // Set value from XML attributes or set default threshold value
115
-
lowerThreshold = typedArray.getFloat(R.styleable.CustomSlider_lowerThreshold, min.toFloat()).toDouble().roundToOneDecimal() // Set value from XML attributes or set default threshold value
116
-
default = typedArray.getFloat(R.styleable.CustomSlider_defaultValue, min.toFloat()).toDouble().roundToOneDecimal() // Set value from XML attributes or set default value
111
+
isDecimal = typedArray.getBoolean(R.styleable.SASlider_isDecimal, false) // Set value from XML attributes or set default slider type
112
+
min = typedArray.getFloat(R.styleable.SASlider_minValue, 1.0f).toDouble().roundToOneDecimal() // Set value from XML attributes or set default min value
113
+
max = typedArray.getFloat(R.styleable.SASlider_maxValue, 10.0f).toDouble().roundToOneDecimal() // Set value from XML attributes or set default max value
114
+
upperThreshold = typedArray.getFloat(R.styleable.SASlider_upperThreshold, max.toFloat()).toDouble().roundToOneDecimal() // Set value from XML attributes or set default threshold value
115
+
lowerThreshold = typedArray.getFloat(R.styleable.SASlider_lowerThreshold, min.toFloat()).toDouble().roundToOneDecimal() // Set value from XML attributes or set default threshold value
116
+
default = typedArray.getFloat(R.styleable.SASlider_defaultValue, min.toFloat()).toDouble().roundToOneDecimal() // Set value from XML attributes or set default value
117
117
}
118
118
119
119
@@ -257,7 +257,7 @@ class CustomSlider @JvmOverloads constructor(
257
257
258
258
frameEditText.setBackgroundColor(editTextColor)
259
259
260
-
var triangle =TriangleShapeView(context, editTextColor)
260
+
val triangle =TriangleShapeView(context, editTextColor)
0 commit comments