Extensions to the Android standard library and support libraries and some basic tools
This library has been published to mavenCentral
. Add the following dependencies to your module build.gradle
file:
implementation "io.github.panpf.tools4a:tools4a:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-ktx:$LAST_VERSION" // Kotlin extension, not required
${LAST_VERSION}
: (No include 'v')
The io.github.panpf.tools4a:tools4a:$LAST_VERSION
dependency will add all the modules included in tools4a to your project (Except for 'tools4a-test'). If you only need of one of the modules, you can just add it to your project, all supported modules as follows:
implementation "io.github.panpf.tools4a:tools4a-activity:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-activity-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-args:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-args-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-build:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-clipboard:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-clipboard-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-content:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-content-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-device:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-device-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-dialog:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-dialog-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-dimen:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-dimen-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-display:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-display-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-fileprovider:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-fileprovider-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-fragment:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-fragment-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-graphics:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-graphics-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-inputmethod:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-inputmethod-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-network:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-network-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-packages:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-packages-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-permission:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-permission-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-prefsdelegate:$LAST_VERSION" // All written by Kotlin
implementation "io.github.panpf.tools4a:tools4a-rom:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-root:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-run:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-run-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-service:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-service-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-settings:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-settings-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-storage:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-storage-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-systemproperties:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-test:$LAST_VERSION" // Not included in 'io.github.panpf.tools4a:tools4a'
implementation "io.github.panpf.tools4a:tools4a-test-ktx:$LAST_VERSION" // Kotlin extension, not required, Not included in 'io.github.panpf.tools4a:tools4a'
implementation "io.github.panpf.tools4a:tools4a-toast:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-toast-ktx:$LAST_VERSION" // Kotlin extension, not required
implementation "io.github.panpf.tools4a:tools4a-utils:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-view:$LAST_VERSION"
implementation "io.github.panpf.tools4a:tools4a-view-ktx:$LAST_VERSION" // Kotlin extension, not required
- Activityx: Activityx.java (Test) | Activityx.kt (Test)
- isDestroyedCompat, convertToTranslucentCompat, convertFromTranslucentCompat, getImplFromParent
- canStart, safeStart, safeStartByClass
- Argsx: Argsx.java (Test) | Argsx.kt (Test)
- read*ArgOrThrow, read*ArgOr, read*ArgOrNull, read*UriArgOrThrow, read*UriArgOr,
- read*UriArgOrNull, read*IntentUriArgOrThrow, read*IntentUriArgOr,read*IntentUriArgOrNull,
- read*UriIntentArgOrThrow, read*UriIntentArgOr, read*UriIntentArgOrNull
- ArgsBinder: ArgsBinder.kt (Test)
- bind*Arg, bind*ArgOr, bind*UriArg, bind*UriArgOr, bind*IntentUriArg,
- bind*IntentUriArgOr, bind*UriIntentArg, bind*UriIntentArgOr
- Buildx: Buildx.java (Test)
- isAtLeastJ/isAtLeast16/isAtLeast4_1..., getVersionName, getVersionCodeName
- Clipboardx: Clipboardx.java (Test) | Clipboardx.kt (Test)
- copy, copyText, copyHtmlText, copyIntent, copyUri, copyRawUri, copyMimeTypeUri,
- copyContents, get, getLabel, getContents, getText, getHtmlText, getIntent, getUri,
- addPrimaryClipChangedListener, removePrimaryClipChangedListener, clear
- Contextx: Contextx.java (Test) | Contextx.kt (Test)
- appContext, requireContext, requireAppContext, systemService, systemServiceOrNull,
- systemServiceOnUiThread, systemServiceOrNullOnUiThread, *Manager
- Devicex: Devicex.java (Test) | Devicex.kt (Test)
- isEmulator, getProduct, getBrand, getModel, getDevice, getHardware, getSupportedAbis,
- getPhoneNumberOr, getPhoneNumberOrThrow, getPhoneNumberOrNull, getDeviceIdOr,
- getDeviceIdOrThrow, getDeviceIdOrNull, getAndroidIdOr, getAndroidIdOrThrow,
- getAndroidIdOrNull, getSubscriberIdOr, getSubscriberIdOrThrow, getSubscriberIdOrNull,
- getSimSerialNumberOr, getSimSerialNumberOrThrow, getSimSerialNumberOrNull,
- getSerialOr, getSerialOrThrow, getSerialOrNull, getIMEIOr, getIMEIOrThrow,
- getIMEIOrNull, getIMSIOr, getIMSIOrThrow, getIMSIOrNull, getMacAddressOr, getMacAddress
- Dialogx: Dialogx.java (Test) | Dialogx.kt (Test)
- setClickButtonClosable, showProgressDialog
- Dimenx: Dimenx.java (Test) | Dimenx.kt (Test)
- dp2px, dp2pxF, sp2px, sp2pxF, pt2px, pt2pxF, in2px, in2pxF, mm2px, mm2pxF
- px2dp, px2sp, px2pt, px2in, px2mm
- Displayx: Displayx.java (Test) | Displayx.kt (Test)
- getScreenSize, getScreenWidth, getScreenHeight, getActionBarSize, getMetrics, getDensity,
- getDisplayRotation, getDensityDpi, isOrientationPortrait, isOrientationLandscape,
- isOrientationUndefined, getRotation, hasNavigationBar, getStatusBarHeight,
- getNavigationBarHeight, getNavigationBarWidth
- FileProviderx: FileProviderx.java (Test) | FileProviderx.kt (Test)
- getShareFileUri
- Fragmentx: Fragmentx.java (Test) | Fragmentx.kt (Test)
- getApplication, requireApplication, isDestroyed, getImplFromParent, instantiate,
- findUserVisibleFragmentByUserVisibleHint, findUserVisibleChildFragmentByUserVisibleHint,
- findUserVisibleFragmentRecursivelyByUserVisibleHint, findUserVisibleChildFragmentRecursivelyByUserVisibleHint,
- findUserVisibleFragmentByResumed, findUserVisibleChildFragmentByResumed,
- findUserVisibleFragmentRecursivelyByResumed, findUserVisibleChildFragmentRecursivelyByResumed,
- findFragmentByViewPagerCurrentItem, isUserVisibleHintWithParent, isResumedWithParent
- FragmentInsider: FragmentInsider.java (Test) | FragmentInsider.kt (Test)
- getMaxState, getMaxStateWithParent
- Drawablex: Drawablex.java (Test) | Drawablex.kt (Test)
- toBitmapWithIntrinsicSize, toBitmapWithBoundsSize, changeColor, changeResDrawableColor
- Bitmapx: Bitmapx.java (Test) | Bitmapx.kt (Test)
- crop, cropTo, centerCrop, centerCropTo, circular, circularTo, tint, createByColor, toByteArray,
- writeToFile, readBitmap, toDrawable, use, calculateSamplingSize,
- calculateSamplingSizeForRegion, textToBitmap
- Imagex: Imagex.java (Test) | Imagex.kt (Test)
- getMimeType, getMimeSubType
- Colorx: Colorx.java (Test) | Colorx.kt (Test)
- WHITE/BLACK/RED..., getAlpha, setAlpha, addAlpha, getHSVHue, setHSVHue, getHSVSaturation,
- setHSVSaturation, addHSVSaturation, getHSVValue, setHSVValue, addHSVValue, isLight,
- createMatrixColorFilter, argbEvaluate
- Matrixx: Matrixx.java (Test) | Matrixx.kt (Test)
- getValue, getScale
- OpenGlx: OpenGlx.java (Test) | OpenGlx.kt Matrixx.kt (Test)
- getVersion, getMaxTextureSize,
- Paintx: Paintx.java (Test) | Paintx.kt (Test)
- getTextWidth, getTextHeight, getTextWidthByBounds, getTextHeightByBounds, getTextLeading
- Resizex: Resizex.java (Test)
- srcMappingStartRect, srcMappingCenterRect, srcMappingEndRect, srcMatrixRect,
- scaleTargetSize, calculator
- InputMethodx: InputMethodx.java (Test) | InputMethodx.kt (Test)
- showSoftInput, delayShowSoftInput, hideSoftInput, moveCursorToEnd, moveCursorToStart, moveCursorTo
- Intentx: Intentx.java (Test) | Intentx.kt (Test)
- createRecordingIntent, createLaunchDialingIntent, createCallPhoneIntent, createLaunchSendSmsIntent,
- createLaunchWebBrowserIntent, createScanFileBroadcastIntent, createActivityIntentByResolveInfo,
- createTakePhotoIntent, createPickImageIntent, createCropImageIntent, createSendTextIntent,
- createSendTextFileIntent, createSendImageFileIntent, createSendFileIntent
- Networkx: Networkx.java (Test) | Networkx.kt (Test)
- connectivity, activeNetwork, networkCapabilitiesCompat, isConnected, isWifiConnected,
- isCellularConnected, isNotMetered, isMetered, isNotRoaming, isRoaming, getTransportNames,
- getCapabilityNames, getWifiState, isWifiEnabled, setWifiEnabled, getWifiGateway, getDNS1, getDNS2
- Packagex: Packagex.java (Test) | Packagex.kt (Test)
- isPackageInstalledByInfoFlags, isPackageInstalled, isSystemPackageByInfoFlags, isSystemPackage,
- isSystemPackageByInfoFlagsOr, isSystemPackageOr, isDebuggablePackageByInfoFlags, isDebuggablePackage,
- isDebuggablePackageByInfoFlagsOr, isDebuggablePackageOr, isJunitTestPackageByInfoFlags, isJunitTestPackage,
- isJunitTestPackageByInfoFlagsOr, isJunitTestPackageOr, getPackageInfoByInfoFlags, getPackageInfo,
- getPackageInfoByInfoFlagsOrNull, getPackageInfoOrNull, getSimplePackageInfoByInfoFlags,
- getSimplePackageInfo, getSimplePackageInfoByInfoFlagsOrNull, getSimplePackageInfoOrNull
- getPackageVersionCodeByInfoFlags, getPackageVersionCode, getPackageVersionCodeByInfoFlagsOr,
- getPackageVersionCodeOr, getPackageLongVersionCodeByInfoFlags, getPackageLongVersionCode,
- getPackageLongVersionCodeByInfoFlagsOr, getPackageLongVersionCodeOr, getPackageVersionNameByInfoFlags,
- getPackageVersionName, getPackageVersionNameByInfoFlagsOr, getPackageVersionNameOr,
- getPackageVersionNameByInfoFlagsOrEmpty, getPackageVersionNameOrEmpty, getPackageVersionNameByInfoFlagsOrNull,
- getPackageVersionNameOrNull, listPackageInfoByFilterInfoFlags, listPackageInfoByTypeInfoFlags,
- listPackageInfoByFilter, listPackageInfoByTypeFlags, listPackageInfoByInfoFlags, listPackageInfo,
- listSimplePackageInfoByFilterInfoFlags, listSimplePackageInfoByTypeInfoFlags, listSimplePackageInfoByFilter,
- listSimplePackageInfoByTypeFlags, listSimplePackageInfoByInfoFlags, listSimplePackageInfo,
- listPackageNameByFilterInfoFlags, listPackageNameByTypeInfoFlags, listPackageNameByFilter,
- listPackageNameByTypeFlags, listPackageNameByInfoFlags, listPackageName, countPackageByFilterInfoFlags,
- countPackageByTypeInfoFlags, countPackageByFilter, countPackageByTypeFlags, countPackageByInfoFlags,
- countPackage, getAllPackageVersionCodeMapByFilterInfoFlags, getAllPackageVersionCodeMapByTypeInfoFlags,
- getAllPackageVersionCodeMapByFilter, getAllPackageVersionCodeMapByTypeFlags,
- getAllPackageVersionCodeMapByInfoFlags, getAllPackageVersionCodeMap
- getPackageApkFile, getPackageApkFileOrNull, getPackageSignatureBytes,
- getPackageSignatureBytesOrNull, getPackageIconDrawable, getPackageIconDrawableOrNull,
- getApkIconDrawable, getApkIconDrawableOrNull, createInstallPackageIntent,
- createUninstallPackageIntent, createLaunchPackageIntent, createApplicationDetailsSettingsIntent,
- requestInstallPackage, requestUninstallPackage,
- PackageInfox: PackageInfox.java (Test) | PackageInfox.kt (Test)
- findActivityInfo, findActivityInfoByName, findServiceInfo, findServiceInfoByName
- findReceiverInfo, findReceiverInfoByName, findProviderInfo, findProviderInfoByName
- findPermissionInfo, findPermissionInfoByName, findRequestedPermission,
- findRequestedPermissionByName, findMetaDataWithName, findMetaDataByName,
- findMetaDataWithValue, findMetaDataByValue
- Permissionx: Permissionx.java (Test) | Permissionx.kt (Test)
- isGrantPermissions, filterDeniedPermissions
- PrefsDelegateTest.kt
- BeanListNullablePrefsDelegate.kt, BeanListPrefsDelegate.kt,
- BeanNullablePrefsDelegate.kt, BeanPrefsDelegate.kt,
- BooleanNullablePrefsDelegate.kt, BooleanPrefsDelegate.kt,
- EnumNullablePrefsDelegate.kt, EnumPrefsDelegate.kt,
- FloatNullablePrefsDelegate.kt, FloatPrefsDelegate.kt,
- IntNullablePrefsDelegate.kt, IntPrefsDelegate.kt,
- LongNullablePrefsDelegate.kt, LongPrefsDelegate.kt,
- StringListNullablePrefsDelegate.kt, StringListPrefsDelegate.kt,
- StringNullablePrefsDelegate.kt, StringPrefsDelegate.kt,
- StringSetNullablePrefsDelegate.kt, StringSetPrefsDelegate.kt,
- Romx: Romx.java (Test)
- isMiuiType, isEmuiType, isFlymeType, isColorType, isFuntouchOSType, isSmartisanOSType, isH2OSType,
- getType, isType, getTypeName, getVersionName, getVersionCode, getVersionIncremental
- Rootx: Rootx.java (Test)
- isRooted
- Runx: Runx.java (Test) | Runx.kt (Test)
- getMainHandler, isOnMainThread, isOnNotMainThread, checkMainThread, checkNotMainThread,
- runOnMainThread, runOnMainThreadSync, runOnMainThreadSyncResult,
- runOnMainThreadSyncResultNullable, isOnMainProcess, isOnNotMainProcess,
- getOnProcessNameOrNull, getOnProcessNameSuffixOrNull
- Servicex: Servicex.java (Test) | Servicex.kt (Test)
- isRunning, start, stop, isAccessibilityServiceEnabled
- Settingsx: Settingsx.java (Test) | Settingsx.kt (Test)
- isScreenBrightnessModeAutomatic, setScreenBrightnessModeAutomatic,
- getScreenBrightness, setScreenBrightness, getScreenOffTimeout, setScreenOffTimeout,
- isAirplaneModeOn, setAirplaneModeOn, isBluetoothOn, setBluetoothOn
- Storagex: Storagex.java (Test) | Storagex.kt (Test)
- getFreeBytesOr, getTotalBytesOr, getAvailableBytesOr, getVolumeState, isVolumeMounted,
- isPrimaryVolume, isVolumeEmulated, isVolumeRemovable, getVolumePaths, getMountedVolumePaths,
- getVolumeFiles, getMountedVolumeFiles, getVolumeList, getMountedVolumeList,
- getVolumes, getMountedVolumes, getVolume, getExternalStorageState, isExternalStorageMounted,
- isPrimaryExternalStorage, isExternalStorageEmulated, isExternalStorageEmulated,
- isExternalStorageRemovable, isExternalStorageRemovable, getExternalStorageDirectory,
- getMountedExternalStorageDirectory, getExternalStorageDirectorys,
- getMountedExternalStorageDirectorys, getExternalStorageDirectorys,
- getMountedExternalStorageDirectorys, getExternalStorageDirectorysWithPath,
- getMountedExternalStorageDirectorysWithPath, getAppExternalCacheDir, getAppExternalCacheDirs,
- getAppInternalCacheDir, getAppCacheDirs, lengthAppCacheDirs, cleanAppCacheDirs,
- getAppExternalFilesDir, getAppExternalFilesDirs, getAppInternalFilesDir, getAppFilesDirs,
- lengthAppFilesDirs, cleanAppFilesDirs, getAppObbDir, getAppObbDirs, lengthAppObbDirs,
- cleanAppObbDirs, filterByMinBytes, getFileIn
- StatFs: StatFsx.java (Test) | StatFsx.kt (Test)
- getCompatAvailableBytes, getCompatFreeBytes, getCompatTotalBytes
- StorageManagerCompat: StorageManagerCompat.java (Test)
- getVolumeList, getVolumes, getVolumePaths, getVolumeState, getVolume
- StorageVolumeCompat: StorageVolumeCompat.java (Test)
- getPath, getPathFile, isPrimary, isRemovable, isEmulated, getState, allowMassStorage, getMaxFileSize
- SystemPropertiesx: SystemPropertiesx.java (Test)
- get, getOr, getIntOr, getLongOr, getBooleanOr, set, addChangeCallbacks, callChangeCallbacks
- Toastx: Toastx.java (Test) | Toastx.kt (Test)
- showLong, showWithFormatLong, showShort, showWithFormatShort,
- showLongWithView, showShortWithView
- Testx: Testx.java | Testx.kt
- launchActivity, launchActivityWithOn, launchActivityWithOnUse, launchActivityWithUse,
- getActivitySync, getActivityOrNullSync, onActivitySleep, onActivitySleep100ms, onActivitySleep200ms,
- launchFragment, launchFragmentInContainer, launchFragmentWithOn, launchFragmentInContainerWithOn,
- getFragmentSync, onFragmentSleep, onFragmentSleep100ms, onFragmentSleep200ms
- LifecycleBroadcastReceiver: LifecycleBroadcastReceiver.java (Test)
- WeakAsyncTask: WeakAsyncTask.java (Test)
- ViewAnim: ViewAnimx.java (Test) | ViewAnimx.kt (Test)
- animAlpha, animTranslate, shake, shock, startAnimFromRes, invisibleByAnimAlpha,
- goneByAnimAlpha, visibleByAnimAlpha,
- View: Viewx.java (Test) | Viewx.kt (Test)
- setLongClickToastHint, setLayoutWidth, setLayoutHeight, setLayoutSize, setLayoutMarginTop,
- addLayoutHeight, addLayoutWidth, addLayoutSize, addLayoutMarginTop, toBitmap, toBitmapByMaxWidth,
- toBitmapByMaxHeight, inflateLayout, addPaddingTopByStatusBarHeight
- Window: Windowx.java (Test) | Windowx.kt (Test)
- getBrightness, setBrightness, isBrightnessFlowSystem
- Preferencex: Preferencex.java (Test) | Preferencex.kt (Test)
- getPreferences, getDefaultPreferences, putIntTo, putInt, putIntsTo, putInts,
- putLongTo, putLong, putLongsTo, putLongs, putBooleanTo, putBoolean, putBooleansTo, putBooleans,
- putFloatTo, putFloat, putFloatsTo, putFloats, putStringTo, putString, putStringsTo, putStrings,
- putStringSetTo, putStringSet, putStringSetsTo, putStringSets, getIntFrom, getInt, getLongFrom,
- getLong, getBooleanFrom, getBoolean, getFloatFrom, getFloat, getStringFrom, getStringOrNullFrom,
- getString, getStringOrNull, getStringSetFrom, getStringSetOrNullFrom, getStringSet,
- getStringSetOrNull, getAllFrom, getAll, removeFrom, remove, contains, containsAny, containsAll,
- containsFrom, containsAnyFrom, containsAllFrom, isEmpty, isEmptyFrom, clear,
- registerOnChangeListener, registerOnChangeListenerTo, unregisterOnChangeListener,
- unregisterOnChangeListenerFrom
- SingletonLazy: SingletonLazy.java
- Textx: Textx.java (Test) | Textx.kt (Test)
- changeColorByHtml, changeColorToRedByHtml, changeKeywordColorByHtml,
- changeKeywordColorToRedByHtml, changeColorBySpannable, changeColorToRedBySpannable,
- changeKeywordColorBySpannable, changeKeywordColorToRedBySpannable
Please view the CHANGELOG.md file
Copyright (C) 2020 panpf <panpfpanpf@outlook.com>
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.