swipeprogressview / me.thanel.swipeprogressview / SwipeProgressView / <init>

<init>

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.

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.

Samples

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" />

Attributes

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.