A simple Android library with useful (Kotlin extension) functions to help you write less code.
General app helper functions
String.isNumeric(): Boolean // == if the String is numeric
String.isInteger(): Boolean // == if the string can be converted to Int
String.isLong(): Boolean // == if the string can be converted to Long
String.isFloat(): Boolean // == if the string can be converted to Float
String.isDouble(): Boolean // == if the string can be converted to Double
View.clearOnClickListener()
You can also use these functions using AppHelper
object
Navigation helper functions
Context.startIntentAndClearHistory(intent: Intent) // starts an activity and clears the history
You can also use these functions using NavigationHelper
object
Resources helper functions
Context.getColorWithContext(resourceId: Int): Int
Context.getDrawableWithContext(resourceId: Int): Drawable?
These functions use ContextCompat
but you dont have to manually pass Context
SharedPreferences helper functions
Context.getMySharedPreferences(): SharedPreferences
Context.getMySharedPreferencesEditor(): SharedPreferences.Editor
You can also use these functions using SharedPreferencesHelper
object
View helper functions
fun View.visible() = ViewHelper.visible(this) // == view.visibility = View.VISIBLE
fun View.invisible() = ViewHelper.invisible(this) // == view.visibility = View.INVISIBLE
fun View.gone() = ViewHelper.gone(this) // == view.visibility = View.GONE
fun View.showSnackBar(message: String)
fun String.showSnackBar(parent: View)
fun View.showSnackBarOnTop(message: String)
fun String.showSnackBarOnTop(parent: View)
fun Activity.closeKeyboard()
You can also use these functions using ViewHelper
object
Web helper functions
Context.openWebView(url: String?) // Opens the url in a WebView.
// Opens an app's Play Store page. Opens the current app if `packageName` is null.
WebHelper.openAppOnPlayStore(packageName: String? = null)
String.isURL() // Checks if the string is a valid URL or not using Regex.
You can also use these functions using WebHelper
object
Clipboard helper functions
// Copies the string to the clipboard and runs onSuccess if its succeeds.
Context.copyToClipboard(string: String, onSuccess: () -> Unit = {})
You can also use these functions using ClipboardHelper
object
This library is available via JitPack, so getting it as simple as adding it as a dependency, like this:
build.gradle
file:allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
build.gradle
file:dependencies {
implementation 'com.github.yasandev:yasan-helper-android:{latest version}'
}
You can also use 'main-SNAPSHOT' to get the snapshot builds.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
YASAN Status powered by Upptime
An alternative YouTube front end, for Android. [WIP]
Experimental project for learning computer graphics using vulkan API and c++.
Android Toast For RTL Applications
A sample to showcase Kotlin, MVVM, Paging, Dagger, RxJava, Coroutines, Jetpack Compose, Retrofit, DataBinding, MotionLayout, Espresso and Unit test.
Flutter_Todo_app 📝
Android Persian Calendar / تقویم فارسی اندروید
NMock is an application that you can use to mock your trips with fake locations. This application uses Neshan SDK and Neshan API for Map and location infromation.