class SwipeProgressView : FrameLayout
(source)
An interactive user interface element that indicates generic progress. The user can touch the view and swipe left or right to set the current progress level.
A SwipeProgressView
can also act as a container view in which you can place other interactive
or non interactive elements. Swipe actions will be available when swiping anywhere within this
view as long as child views (such as SeekBar) won't also attempt to listen to swipe gestures.
You can update the percentage of progress displayed by using the progress property. By default,
the progress bar is full when the progress value reaches 100. You can adjust this default by
setting the app:spv_maxProgress
attribute. You can also adjust the minimum value by setting
the app:spv_minProgress
attribute.
Progress view with range from 25 to 200 and a default value of 50:
<me.thanel.swipeprogressview.SwipeProgressView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:progress="50"
app:spv_maxProgress="200"
app:spv_minProgress="25" />
Progress view that displays progress using solid black color:
<me.thanel.swipeprogressview.SwipeProgressView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:progressDrawable="@android:color/black" />
app:spv_minProgress
- the lower limit of this progress view's range. Defaults to 0
.
app:spv_maxProgress
- the upper limit of this progress view's range. Defaults to 100
.
android:progress
- the progress view's current level of progress. Defaults to the same value
as app:spv_minProgress
.
android:progressDrawable
- the drawable used to draw the progress indicator. Defaults to
ColorDrawable with color set from colorControlActivated
style attribute.
android:mirrorForRtl
- defines if the progress drawable and swipe direction need to be
mirrored when in RTL mode. Defaults to false
.
SwipeProgressView(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.swipeProgressViewStyle)
An interactive user interface element that indicates generic progress. The user can touch the view and swipe left or right to set the current progress level. |
var maxProgress: Int
The upper limit of this progress view's range. |
|
var minProgress: Int
The lower limit of this progress view's range. |
|
var mirrorForRtl: Boolean
Defines if the progress drawable and swipe direction need to be mirrored when in RTL mode.
Defaults to |
|
var progress: Int
The progress view's current level of progress. |
|
var progressDrawable: Drawable
The drawable used to draw the progress indicator. |
fun setOnProgressChangeListener(listener: ((Int) -> Unit)?): Unit
Registers a callback to be invoked when the value of progress property is changed. |
var SwipeProgressView.progressRange: IntRange
The minimum-maximum progress range of this view. |
fun SwipeProgressView.setProgressAnimated(progress: Int): Unit
Sets the current progress to the specified value, animating the visual position between the current and target values. |
|
fun SwipeProgressView.setProgressColor(color: Int): Unit
Sets the progressDrawable of this view to a solid color. |