Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/romancha/android-material-play-pause-view-button
A material play pause view button
https://github.com/romancha/android-material-play-pause-view-button
android android-library button material play-pause
Last synced: about 2 months ago
JSON representation
A material play pause view button
- Host: GitHub
- URL: https://github.com/romancha/android-material-play-pause-view-button
- Owner: Romancha
- License: mit
- Created: 2017-03-29T10:36:56.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-12-21T19:29:46.000Z (about 3 years ago)
- Last Synced: 2024-04-16T21:04:20.505Z (9 months ago)
- Topics: android, android-library, button, material, play-pause
- Language: Java
- Homepage:
- Size: 432 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
`MaterialPlayPauseViewButton` that toggle play/pause with material animation
This an improvements of the [OHoussein PlayPauseView](https://github.com/OHoussein/android-material-play-pause-view)
and [Alex Lockwood's PlayPauseView](https://github.com/alexjlockwood/material-pause-play-animation).# Demo
# Usage
## Gradle dependency:
Add the following to your project level build.gradle:
```groovy
allprojects {
repositories {
maven {
url 'https://jitpack.io'
}
}
}
```Add this to your app build.gradle:
```groovy
dependencies {
implementation 'com.github.Romancha:android-material-play-pause-view-button:2.3'
}
```## Xml layout
```xml
```
- pause_bg : the background for the pause status
- play_bg : the background for the play status
- fill_color: the icon's color## Code
#### Click listener
```kotlin
val playPauseView = layout.findViewById(R.id.play_pause_view)
playPauseView.setOnClickListener {
// View clicked
playPauseView.toggle()
}
```#### Methods
|Methods|Description|
|---|---|
|boolean onPlaying()|View is on 'playing' state|
|boolean onPause()|View is on 'pause' state|
|toggle()|Toogle the play/pause status with animation|
|void toggle(boolean withAnim)|Toogle the play/pause status with animation or not|
|void change(boolean isPlay)|Change state of view with animation. isPlay for playing, false else|
|change(boolean isPlay, boolean withAnim) |Change state of view with specified behavior|# License
The MIT License (MIT)
Copyright (c) 2017 Romancha
Copyright 2016 OHoussein
Copyright (c) 2015 Alex Lockwood
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.