Package com.ayvytr.ktx.context

Functions

getAccessibilityManager
Link copied to clipboard
fun Context.getAccessibilityManager(): AccessibilityManager
getAccountManager
Link copied to clipboard
fun Context.getAccountManager(): AccountManager
getActivityManager
Link copied to clipboard
fun Context.getActivityManager(): ActivityManager
getAlarmManager
Link copied to clipboard
fun Context.getAlarmManager(): AlarmManager
getAppOpsManager
Link copied to clipboard
fun Context.getAppOpsManager(): AppOpsManager
getAppWidgetManager
Link copied to clipboard
fun Context.getAppWidgetManager(): AppWidgetManager
getAudioManager
Link copied to clipboard
fun Context.getAudioManager(): AudioManager
getBatteryManager
Link copied to clipboard
fun Context.getBatteryManager(): BatteryManager
getBluetoothManager
Link copied to clipboard
fun Context.getBluetoothManager(): BluetoothManager
getCameraManager
Link copied to clipboard
fun Context.getCameraManager(): CameraManager
getCaptioningManager
Link copied to clipboard
fun Context.getCaptioningManager(): CaptioningManager
getCarrierConfigManager
Link copied to clipboard
fun Context.getCarrierConfigManager(): CarrierConfigManager
getClipboardManager
Link copied to clipboard
fun Context.getClipboardManager(): ClipboardManager
getColorCompat
Link copied to clipboard
fun Context.getColorCompat(@ColorRes id: Int): Int
fun Fragment.getColorCompat(@ColorRes id: Int): Int
getConfiguration
Link copied to clipboard
fun Context.getConfiguration(): Configuration
fun Fragment.getConfiguration(): Configuration
getConnectivityManager
Link copied to clipboard
fun getConnectivityManager(): ConnectivityManager

Return ConnectivityManager.

fun Context.getConnectivityManager(): ConnectivityManager
getConsumerIrManager
Link copied to clipboard
fun Context.getConsumerIrManager(): ConsumerIrManager
getDimen
Link copied to clipboard
fun Context.getDimen(@DimenRes id: Int): Float
fun Fragment.getDimen(@DimenRes id: Int): Float
getDisplayManagerCompat
Link copied to clipboard
fun Context.getDisplayManagerCompat(): DisplayManager
getDisplayMetrics
Link copied to clipboard
fun Context.getDisplayMetrics(): DisplayMetrics
getDisplaySize
Link copied to clipboard
fun Context.getDisplaySize(): Point
getDownloadManager
Link copied to clipboard
fun Context.getDownloadManager(): DownloadManager
getDrawableArray
Link copied to clipboard
fun Context.getDrawableArray(@ArrayRes id: Int): Array<Drawable?>
fun Fragment.getDrawableArray(@ArrayRes id: Int): Array<Drawable?>

获取返回 Drawable array

getDrawableCompat
Link copied to clipboard
fun Context.getDrawableCompat(@DrawableRes id: Int): Drawable?
fun Fragment.getDrawableCompat(@DrawableRes id: Int): Drawable?
getDrawableIdArray
Link copied to clipboard
fun Context.getDrawableIdArray(@ArrayRes id: Int): IntArray
fun Fragment.getDrawableIdArray(@ArrayRes id: Int): IntArray

获取返回 Drawable id array

getFingerprintManager
Link copied to clipboard
fun Context.getFingerprintManager(): FingerprintManager
getHardwarePropertiesManager
Link copied to clipboard
fun Context.getHardwarePropertiesManager(): HardwarePropertiesManager
getInputMethodManager
Link copied to clipboard
fun Context.getInputMethodManager(): InputMethodManager
getIntArray
Link copied to clipboard
fun Context.getIntArray(@ArrayRes id: Int): IntArray
fun Fragment.getIntArray(@ArrayRes id: Int): IntArray
getIntent
Link copied to clipboard
fun ClipboardManager.getIntent(): Intent?
getJobScheduler
Link copied to clipboard
fun Context.getJobScheduler(): JobScheduler
getKeyguardManager
Link copied to clipboard
fun Context.getKeyguardManager(): KeyguardManager
getLauncherApps
Link copied to clipboard
fun Context.getLauncherApps(): LauncherApps
getLayoutInflater
Link copied to clipboard
fun Context.getLayoutInflater(): LayoutInflater
getLocationManager
Link copied to clipboard
fun Context.getLocationManager(): LocationManager
getMediaRouter
Link copied to clipboard
fun Context.getMediaRouter(): MediaRouter
getMediaSessionManager
Link copied to clipboard
fun Context.getMediaSessionManager(): MediaSessionManager
getMidiManager
Link copied to clipboard
fun Context.getMidiManager(): MidiManager
getNfcManager
Link copied to clipboard
fun Context.getNfcManager(): NfcManager
getNotificationManager
Link copied to clipboard
fun Context.getNotificationManager(): NotificationManager
getNsdManager
Link copied to clipboard
fun Context.getNsdManager(): NsdManager
getPlainText
Link copied to clipboard
fun ClipboardManager.getPlainText(): String?
getPowerManager
Link copied to clipboard
fun Context.getPowerManager(): PowerManager
getPrintManager
Link copied to clipboard
fun Context.getPrintManager(): PrintManager
getRestrictionsManager
Link copied to clipboard
fun Context.getRestrictionsManager(): RestrictionsManager
getScreenHeight
Link copied to clipboard
fun Context.getScreenHeight(): Int
getScreenWidth
Link copied to clipboard
fun Context.getScreenWidth(): Int
getSensorManager
Link copied to clipboard
fun Context.getSensorManager(): SensorManager
getShortcutManager
Link copied to clipboard
fun Context.getShortcutManager(): ShortcutManager
getStatusBarHeight
Link copied to clipboard
fun Context.getStatusBarHeight(): Int

获取状态栏高度

getStorageManage
Link copied to clipboard
fun Context.getStorageManage(): StorageManager
getStringArray
Link copied to clipboard
fun Context.getStringArray(@ArrayRes id: Int): Array<String>
fun Fragment.getStringArray(@ArrayRes id: Int): Array<String>
getTelecomManager
Link copied to clipboard
fun Context.getTelecomManager(): TelecomManager
getTelephonyManager
Link copied to clipboard
fun Context.getTelephonyManager(): TelephonyManager
getTextArray
Link copied to clipboard
fun Context.getTextArray(@ArrayRes id: Int): Array<CharSequence>
fun Fragment.getTextArray(@ArrayRes id: Int): Array<CharSequence>
getTextServicesManager
Link copied to clipboard
fun Context.getTextServicesManager(): TextServicesManager
getTypedArray
Link copied to clipboard
fun Context.getTypedArray(@ArrayRes id: Int): TypedArray
fun Fragment.getTypedArray(@ArrayRes id: Int): TypedArray
getUiModeManager
Link copied to clipboard
fun Context.getUiModeManager(): UiModeManager
getUri
Link copied to clipboard
fun ClipboardManager.getUri(): Uri?
getUserManager
Link copied to clipboard
fun Context.getUserManager(): UserManager
getVibrator
Link copied to clipboard
fun Context.getVibrator(): Vibrator
getWallpaperManager
Link copied to clipboard
fun Context.getWallpaperManager(): WallpaperManager
getWindowManager
Link copied to clipboard
fun Context.getWindowManager(): WindowManager
hideStatusBar
Link copied to clipboard
fun Activity.hideStatusBar()

隐藏状态栏

inflate
Link copied to clipboard
fun Context.inflate(@LayoutRes id: Int, parent: ViewGroup? = null, attachToParent: Boolean = parent != null): View

使用Context初始化布局

fun Fragment.inflate(@LayoutRes id: Int, parent: ViewGroup? = null, attachToParent: Boolean = parent != null): View

使用Fragment初始化布局

isLandscape
Link copied to clipboard
fun Context.isLandscape(): Boolean
isMobileDataConnected
Link copied to clipboard
fun isMobileDataConnected(): Boolean
isNetworkAvailable
Link copied to clipboard
fun isNetworkAvailable(): Boolean

判断网络是否可用

isNetworkConnected
Link copied to clipboard
fun isNetworkConnected(): Boolean

判断网络是否连接

isNightMode
Link copied to clipboard
fun Context.isNightMode(): Boolean

判断是不是黑夜模式

isPortrait
Link copied to clipboard
fun Context.isPortrait(): Boolean
isStatusBarShowing
Link copied to clipboard
fun Activity.isStatusBarShowing(): Boolean

状态栏是否显示

isWifiConnected
Link copied to clipboard
fun isWifiConnected(): Boolean
setIntent
Link copied to clipboard
fun ClipboardManager.setIntent(intent: Intent, label: CharSequence = INTENT_LABEL)
setPlainText
Link copied to clipboard
fun ClipboardManager.setPlainText(text: CharSequence, label: CharSequence = PLAIN_TEXT_LABEL)
setUri
Link copied to clipboard
fun ClipboardManager.setUri(uri: Uri, label: CharSequence = URI_LABEL)
showStatusBar
Link copied to clipboard
fun Activity.showStatusBar(isShow: Boolean = true)

显示状态栏

toast
Link copied to clipboard
fun Context.toast(@StringRes textId: Int)
fun Context.toast(text: String)

显示Toast,时长Toast.LENGTH_SHORT

fun Fragment.toast(@StringRes textId: Int)
fun Fragment.toast(text: String)
toastLong
Link copied to clipboard
fun Context.toastLong(@StringRes textId: Int)
fun Context.toastLong(text: String)

显示Toast,时长Toast.LENGTH_LONG

fun Fragment.toastLong(@StringRes textId: Int)
fun Fragment.toastLong(text: String)

Properties

dp
Link copied to clipboard
val Float.dp: Int

dp转px

dp
Link copied to clipboard
val Int.dp: Int

dp转px

dp2px
Link copied to clipboard
val Float.dp2px: Int

dp转px

dp2px
Link copied to clipboard
val Int.dp2px: Int

dp转px

INTENT_LABEL
Link copied to clipboard
const val INTENT_LABEL: String
PLAIN_TEXT_LABEL
Link copied to clipboard
const val PLAIN_TEXT_LABEL: String

ClipboardManager 相关的Kotlin扩展方法,包含设置/获取剪贴板文本/Uri/Intent.

px2dp
Link copied to clipboard
val Float.px2dp: Int

px转dp

px2dp
Link copied to clipboard
val Int.px2dp: Int

px转dp

px2sp
Link copied to clipboard
val Float.px2sp: Int

px转sp

px2sp
Link copied to clipboard
val Int.px2sp: Int

px转sp

sp
Link copied to clipboard
val Float.sp: Int

sp转px

sp
Link copied to clipboard
val Int.sp: Int

sp转px

sp2px
Link copied to clipboard
val Float.sp2px: Int

sp转px

sp2px
Link copied to clipboard
val Int.sp2px: Int

sp转px

URI_LABEL
Link copied to clipboard
const val URI_LABEL: String