Extension functions which I found can be useful and save time and code
Add to your build.gradle (Module) file in dependencies:
implementation 'com.andruid.magic:eezetensions:1.0.3'
- buildTetherSettingsIntent(): Intent
- color(@ColorRes color: Int): Int
- drawable(@DrawableRes res: Int): Drawable?
- startFgOrBgService(intent: Intent)
- hasInternet(): Boolean (requires Manifest.permission.ACCESS_NETWORK_STATE)
- getPackageVersion(): String?
- toast(msg: String, duration: Int = Toast.LENGTH_SHORT, fromBg: Boolean = false)
- toast(@StringRes msgRes: Int, duration: Int = Toast.LENGTH_SHORT, fromBg: Boolean = false)
- getUserDeviceName(): String
- buildSettingsIntent(): Intent
- getApplicationName(): String
- isMobileDataEnabled(): Boolean
- color(@ColorRes color: Int): Int
- drawable(@DrawableRes res: Int): Drawable?
- startFgOrBgService(intent: Intent)
- hasInternet(): Boolean (requires Manifest.permission.ACCESS_NETWORK_STATE)
- toast(msg: String, duration: Int = Toast.LENGTH_SHORT, fromBg: Boolean = false)
- toast(@StringRes msgRes: Int, duration: Int = Toast.LENGTH_SHORT, fromBg: Boolean = false)
- getMapsUrl(): String
- hide()
- show()