kutils / com.celites.kutils / android.content.Context

Extensions for android.content.Context

accessibilityManager

val Context.accessibilityManager: AccessibilityManager?

accountManager

val Context.accountManager: AccountManager?

activityManager

val Context.activityManager: ActivityManager?

alarmManager

val Context.alarmManager: AlarmManager?

appOpsManager

val Context.appOpsManager: AppOpsManager?

appWidgetManager

val Context.appWidgetManager: AppWidgetManager?

audioManager

val Context.audioManager: AudioManager?

batteryManager

val Context.batteryManager: BatteryManager?

bluetoothAdapter

val Context.bluetoothAdapter: BluetoothManager?

browseUrl

fun Context.browseUrl(url: String): Boolean

Opens browser from Given URL

cameraManager

val Context.cameraManager: CameraManager?

captioningManager

val Context.captioningManager: CaptioningManager?

clipboardManager

val Context.clipboardManager: ClipboardManager?

connectivityManager

val Context.connectivityManager: ConnectivityManager?

consumerIrManager

val Context.consumerIrManager: ConsumerIrManager?

devicePolicyManager

val Context.devicePolicyManager: DevicePolicyManager?

displayManager

val Context.displayManager: DisplayManager?

displayMetrics

val Context.displayMetrics: DisplayMetrics

Gets Display Metrics

downloadManager

val Context.downloadManager: DownloadManager?

dropBoxManager

val Context.dropBoxManager: DropBoxManager?

fetchAnimation

fun Context.fetchAnimation(animResId: Int): XmlResourceParser

Fetches animation from Given animation resource id.

fetchBoolean

fun Context.fetchBoolean(booleanResId: Int): Boolean

Fetches boolean from Given boolean resource id.

fetchColor

fun Context.fetchColor(colorResId: Int): Int

Fetches Color from Given Color resource id.

fetchColorStateListCompat

fun Context.fetchColorStateListCompat(stateListResId: Int): ColorStateList

Fetches ColorStateList from Given State List resource id.

fetchDimension

fun Context.fetchDimension(dimenResId: Int): Float

Fetches Dimension from Given Dimension resource id.

fetchDrawable

fun Context.fetchDrawable(id: Int): Drawable

Fetches Drawable from Given Drawable resource id.

fetchFont

fun Context.fetchFont(id: Int): Typeface

Fetches animation from Given animation resource id

fetchIntArray

fun Context.fetchIntArray(id: Int): IntArray

Fetches Int Array from Given id.

fetchInteger

fun Context.fetchInteger(id: Int): Int

Fetches Integer Resource from Given Integer resource id.

fetchLayout

fun Context.fetchLayout(id: Int): XmlResourceParser

fetchMovie

fun Context.fetchMovie(id: Int): Movie

fetchQuantityString

fun Context.fetchQuantityString(id: Int, quantity: Int, vararg formatArgs: Any): String

Fetches Quantity String from Given Quantity String resource id.

fetchQuantityText

fun Context.fetchQuantityText(id: Int, quantity: Int): CharSequence

fetchStringArray

fun Context.fetchStringArray(arrayResId: Int): Array<String>

formatDateAccordingToDevice

fun Context.formatDateAccordingToDevice(date: Date): String

Formats date according to device's default date format

formatTimeAccordingToDevice

fun Context.formatTimeAccordingToDevice(date: Date): String

Formats time according to device's default time format

getDataColumn

fun Context.getDataColumn(uri: Uri, selection: String?, selectionArg: Array<String>?): String

getFilePath

fun Context.getFilePath(uri: Uri): String

getIntent

fun <T : Context> Context.getIntent(flags: Int = 0, bundle: Bundle? = null, data: Uri? = null): Intent

Gets intent from Context

inflateLayout

fun Context.inflateLayout(layoutResId: Int, parent: ViewGroup?, attachToRoot: Boolean = false): View

inputManager

val Context.inputManager: InputManager?

inputMethodManager

val Context.inputMethodManager: InputMethodManager?

isIntentAvailable

fun Context.isIntentAvailable(intent: Intent, matchConstant: Int = PackageManager.MATCH_DEFAULT_ONLY): Boolean

Checks if given intent is available or not

isOnline

fun Context.isOnline(): Boolean

checks if device is online or not

jobScheduler

val Context.jobScheduler: JobScheduler?

keyguardManager

val Context.keyguardManager: KeyguardManager?

launcherApps

val Context.launcherApps: LauncherApps?

layoutInflater

val Context.layoutInflater: LayoutInflater?

locationManager

val Context.locationManager: LocationManager?

makeCall

fun Context.makeCall(number: String): Boolean

Makes call to given phone number

mediaProjectionManager

val Context.mediaProjectionManager: MediaProjectionManager?

mediaRouter

val Context.mediaRouter: MediaRouter?

mediaSessionManager

val Context.mediaSessionManager: MediaSessionManager?

nfcManager

val Context.nfcManager: NfcManager?

notificationManager

val Context.notificationManager: NotificationManager?

nsdManager

val Context.nsdManager: NsdManager?

powerManager

val Context.powerManager: PowerManager?

printManager

val Context.printManager: PrintManager?

removeNotification

fun Context.removeNotification(id: Int = 0): Unit

Removes notification

restrictionsManager

val Context.restrictionsManager: RestrictionsManager?

searchManager

val Context.searchManager: SearchManager?

sendEmail

fun Context.sendEmail(email: String, subject: String = "", text: String = "", attachment: Uri? = null): Boolean

Sends Email- This app open Email sending Intent

sensorManager

val Context.sensorManager: SensorManager?

setNotification

fun Context.setNotification(id: Int = 0, channelName: String = "Default", builderMethod: Builder.() -> Any): Unit

Sends notifications

share

fun Context.share(text: String): Boolean

Open Android's Share menu to share any Text

sharedPreferences

val Context.sharedPreferences: SharedPreferences

showDialog

fun Context.showDialog(themeId: Int = 0, cancelable: Boolean = false, cancelableTouchOutside: Boolean = false, builderFunction: Builder.() -> Any): Unit

Shows AlertDialog

startActivity

fun <T : Activity> Context.startActivity(flags: Int = 0, data: Uri? = null, extras: Bundle? = null): Unit

Starts activity from Context.

startService

fun <T : Service> Context.startService(flags: Int = 0, data: Uri? = null, extras: Bundle? = null): ComponentName

Starts Service

storageManager

val Context.storageManager: StorageManager?

telecomManager

val Context.telecomManager: TelecomManager?

telephonyManager

val Context.telephonyManager: TelephonyManager?

textServicesManager

val Context.textServicesManager: TextServicesManager?

toast

fun Context.toast(tag: String, message: String, duration: Int = Toast.LENGTH_LONG): Unit

Shows toast

tvInputManager

val Context.tvInputManager: TvInputManager?

typefaceFromAssets

fun Context.typefaceFromAssets(assetPathResId: Int): Typeface
fun Context.typefaceFromAssets(assetPath: String): Typeface

uiModeManager

val Context.uiModeManager: UiModeManager?

usbManager

val Context.usbManager: UsbManager?

userManager

val Context.userManager: UserManager?

versionCode

val Context.versionCode: Int

versionName

val Context.versionName: String?

vibrator

val Context.vibrator: Vibrator?

wallpaperService

val Context.wallpaperService: WallpaperService?

wifiManager

val Context.wifiManager: WifiManager?

wifiP2pManager

val Context.wifiP2pManager: WifiP2pManager?

windowService

val Context.windowService: WindowManager?