项目作者: Tunous

项目描述 :
An interactive swipe-able Android view for displaying generic progress
高级语言: Kotlin
项目地址: git://github.com/Tunous/SwipeProgressView.git
创建时间: 2019-06-19T19:10:48Z
项目社区:https://github.com/Tunous/SwipeProgressView

开源协议:Apache License 2.0

下载


SwipeProgressView

JitPack API

TODO: CI, Android Arsenal


An interactive view representing generic progress that can be altered by user with swipe gestures.

read-tracker-example

The above sample is from my ReadTracker application. In this layout, SwipeProgressView is a container view which handles swipe gestures, draws progress background and provides listeners for other views to update correspondingly.

Installation

Step 1. Add the JitPack repository to your build file

Add in your root build.gradle at the end of repositories:

  1. allprojects {
  2. repositories {
  3. ...
  4. maven { url 'https://jitpack.io' }
  5. }
  6. }

Step 2. Add the dependency

  1. dependencies {
  2. implementation 'com.github.Tunous:SwipeProgressView:VERSION_HERE'
  3. }

Replace VERSION_HERE with version you want to use. Latest is: JitPack

Usage

Step 1. Define SwipeProgressView in layout

  1. <me.thanel.swipeprogressview.SwipeProgressView
  2. android:id="@+id/swipeProgressView"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent"
  5. android:mirrorForRtl="false"
  6. android:progress="0"
  7. android:progressDrawable="?colorControlActivated"
  8. app:spv_maxProgress="100"
  9. app:spv_minProgress="0" ></me.thanel.swipeprogressview.SwipeProgressView>

Step 2. Access and modify SwipeProgressView from code

  1. val swipeProgressView = findViewById<SwipeProgressView>(R.id.swipeProgressView)
  2. swipeProgressView.maxProgress = 200
  3. swipeProgressView.minProgress = -120
  4. swipeProgressView.progress = 15
  5. swipeProgressView.setOnProgressChangeListener { progress ->
  6. // Handle progress updates
  7. }

For detailed information about what is possible see API Documentation. Most important is documentation for the SwipeProgressView class.

License

  1. Copyright 2019 Łukasz Rutkowski
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.