|
| 1 | +# CustomProgressIndicator |
| 2 | + |
| 3 | + |
| 4 | + A custom progress indicator view to give your android application a nice feel. |
| 5 | + |
| 6 | + |
| 7 | +## Setup |
| 8 | + |
| 9 | +Add it in your root `build.gradle` at the end of repositories: |
| 10 | + |
| 11 | +```groovy |
| 12 | +allprojects { |
| 13 | + repositories { |
| 14 | + //...omitted for brevity |
| 15 | + maven { url 'https://jitpack.io' } |
| 16 | + } |
| 17 | +} |
| 18 | +``` |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +Add the dependency |
| 23 | + |
| 24 | +```groovy |
| 25 | +dependencies { |
| 26 | + implementation "com.github.certified84:CustomProgressIndicator:$latest_release" |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +## :bulb: Tech Used |
| 31 | + |
| 32 | +<img src="https://marvel-b1-cdn.bc0a.com/f00000000156946/www.jrebel.com/sites/rebel/files/image/2021-01/what%20is%20kotlin%20banner%20image.png" height="70px" width="100px"> |
| 33 | + |
| 34 | +<!-- ## Demo |
| 35 | +<img src="https://user-images.githubusercontent.com/20203694/137814254-97e4aec8-02cb-4c00-8624-ddc24a80f966.gif" alt="demo" width="300" height="300"/><img src="https://user-images.githubusercontent.com/20203694/137814196-01499fa0-9f27-4797-bafe-6530d2e3f743.gif" alt="demo" width="300" height="300"/> --> |
| 36 | + |
| 37 | +## Usage |
| 38 | +Sample implementation [here](app/) |
| 39 | + |
| 40 | +### CustomProgressIndicator |
| 41 | +- Add `CustomProgressIndicator` to your xml layout. |
| 42 | + |
| 43 | +```xml |
| 44 | + <com.certified.customprogressindicatorlibrary.CustomProgressIndicator |
| 45 | + android:id="@+id/indicator" |
| 46 | + android:layout_width="match_parent" |
| 47 | + android:layout_height="match_parent" |
| 48 | + android:elevation="4dp" /> |
| 49 | +``` |
| 50 | +- Make sure it fills the width and height of the parent view |
| 51 | + |
| 52 | +### Initialize the indicator |
| 53 | + |
| 54 | +```kotlin |
| 55 | + var indicator: CustomProgressIndicator = findViewById(R.id.indicator) |
| 56 | + |
| 57 | + override fun onResume() { |
| 58 | + super.onResume() |
| 59 | + indicator.startAnimation() |
| 60 | + } |
| 61 | +``` |
| 62 | + |
| 63 | +### Set the indicator text size |
| 64 | + |
| 65 | +```kotlin |
| 66 | + indicator.setTextSize(resources.getDimension(R.dimen.30sp)) |
| 67 | +``` |
| 68 | + |
| 69 | +### Set the indicator text color |
| 70 | + |
| 71 | +```kotlin |
| 72 | + indicator.setTextColor(ResourcesCompat.getColorStateList(resources, R.color.white, null)!!) |
| 73 | +``` |
| 74 | + |
| 75 | +### Set the indicator text |
| 76 | + |
| 77 | +```kotlin |
| 78 | + indicator.setText("Loading...") |
| 79 | +``` |
| 80 | + |
| 81 | +### Set the indicator text typeface |
| 82 | + |
| 83 | +```kotlin |
| 84 | + indicator.setTypeface(R.font.space_grotesk_regular) |
| 85 | +``` |
| 86 | + |
| 87 | +### Set the indicator progress color |
| 88 | + |
| 89 | +```kotlin |
| 90 | + indicator.setProgressIndicatorColor("#FFFFFF") |
| 91 | +``` |
| 92 | + |
| 93 | +### Set the indicator track color |
| 94 | + |
| 95 | +```kotlin |
| 96 | + indicator.setTrackColor("#B32821") |
| 97 | +``` |
| 98 | + |
| 99 | +### Set the indicator image resource |
| 100 | + |
| 101 | +```kotlin |
| 102 | + indicator.setImageResource(R.drawable.ic_logo) |
| 103 | +``` |
| 104 | + |
| 105 | + |
| 106 | +### Licensed under the [Apache-2.0 License](LICENSE) |
0 commit comments