https://github.com/boybeak/safeposter
Safe way to do post or postDelayed
https://github.com/boybeak/safeposter
Last synced: 6 months ago
JSON representation
Safe way to do post or postDelayed
- Host: GitHub
- URL: https://github.com/boybeak/safeposter
- Owner: boybeak
- Created: 2022-01-09T03:41:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-09T06:34:48.000Z (over 4 years ago)
- Last Synced: 2025-02-13T11:49:37.019Z (over 1 year ago)
- Language: Java
- Size: 109 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SafePoster
A simple tool to make **post** and **postDelayed** safety.
## Install 
```groovy
// root build.gradle
buildscript {
repositories {
mavenCentral()
}
}
```
```groovy
// module's build.gradle
dependencies {
implementation 'com.github.boybeak:safe-poster:latest-version'
}
```
## Usage
```kotlin
SafePoster.by(view)
.liveWith(activity)
.onThrow {
// Handle error here
}.postDelayed(4000L) {
view.setBackgroundColor(Color.CYAN)
}
```
or use extension function.
```kotlin
view.postSafety {
}
view.postDelayedSafety(3000L) {
}
```
## License
```
Copyright [2022] [boybeak]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```