panpf / tools4a

Extensions to the Android standard library and support libraries and some basic tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tools4a

Platform Platform API TargetSdk Download License

Extensions to the Android standard library and support libraries and some basic tools

Getting Started

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}: Download (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

Modules

tools4a-activity

  • Activityx: Activityx.java (Test) | Activityx.kt (Test)
    • isDestroyedCompat, convertToTranslucentCompat, convertFromTranslucentCompat, getImplFromParent
    • canStart, safeStart, safeStartByClass

tools4a-args

  • 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

tools4a-build

  • Buildx: Buildx.java (Test)
    • isAtLeastJ/isAtLeast16/isAtLeast4_1..., getVersionName, getVersionCodeName

tools4a-clipboard

  • 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

tools4a-context

  • Contextx: Contextx.java (Test) | Contextx.kt (Test)
    • appContext, requireContext, requireAppContext, systemService, systemServiceOrNull,
    • systemServiceOnUiThread, systemServiceOrNullOnUiThread, *Manager

tools4a-device

  • 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

tools4a-dialog

tools4a-dimen

  • Dimenx: Dimenx.java (Test) | Dimenx.kt (Test)
    • dp2px, dp2pxF, sp2px, sp2pxF, pt2px, pt2pxF, in2px, in2pxF, mm2px, mm2pxF
    • px2dp, px2sp, px2pt, px2in, px2mm

tools4a-display

  • Displayx: Displayx.java (Test) | Displayx.kt (Test)
    • getScreenSize, getScreenWidth, getScreenHeight, getActionBarSize, getMetrics, getDensity,
    • getDisplayRotation, getDensityDpi, isOrientationPortrait, isOrientationLandscape,
    • isOrientationUndefined, getRotation, hasNavigationBar, getStatusBarHeight,
    • getNavigationBarHeight, getNavigationBarWidth

tools4a-fileprovider

tools4a-fragment

  • 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

tools4a-graphics

tools4a-inputmethod

tools4a-intent

  • Intentx: Intentx.java (Test) | Intentx.kt (Test)
    • createRecordingIntent, createLaunchDialingIntent, createCallPhoneIntent, createLaunchSendSmsIntent,
    • createLaunchWebBrowserIntent, createScanFileBroadcastIntent, createActivityIntentByResolveInfo,
    • createTakePhotoIntent, createPickImageIntent, createCropImageIntent, createSendTextIntent,
    • createSendTextFileIntent, createSendImageFileIntent, createSendFileIntent

tools4a-network

  • 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

tools4a-packages

  • 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

tools4a-permission

tools4a-prefsdelegate

tools4a-rom

  • Romx: Romx.java (Test)
    • isMiuiType, isEmuiType, isFlymeType, isColorType, isFuntouchOSType, isSmartisanOSType, isH2OSType,
    • getType, isType, getTypeName, getVersionName, getVersionCode, getVersionIncremental

tools4a-root

tools4a-run

  • Runx: Runx.java (Test) | Runx.kt (Test)
    • getMainHandler, isOnMainThread, isOnNotMainThread, checkMainThread, checkNotMainThread,
    • runOnMainThread, runOnMainThreadSync, runOnMainThreadSyncResult,
    • runOnMainThreadSyncResultNullable, isOnMainProcess, isOnNotMainProcess,
    • getOnProcessNameOrNull, getOnProcessNameSuffixOrNull

tools4a-service

tools4a-settings

  • Settingsx: Settingsx.java (Test) | Settingsx.kt (Test)
    • isScreenBrightnessModeAutomatic, setScreenBrightnessModeAutomatic,
    • getScreenBrightness, setScreenBrightness, getScreenOffTimeout, setScreenOffTimeout,
    • isAirplaneModeOn, setAirplaneModeOn, isBluetoothOn, setBluetoothOn

tools4a-storage

  • 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

tools4a-systemproperties

  • SystemPropertiesx: SystemPropertiesx.java (Test)
    • get, getOr, getIntOr, getLongOr, getBooleanOr, set, addChangeCallbacks, callChangeCallbacks

tools4a-toast

  • Toastx: Toastx.java (Test) | Toastx.kt (Test)
    • showLong, showWithFormatLong, showShort, showWithFormatShort,
    • showLongWithView, showShortWithView

tools4a-test

  • Testx: Testx.java | Testx.kt
    • launchActivity, launchActivityWithOn, launchActivityWithOnUse, launchActivityWithUse,
    • getActivitySync, getActivityOrNullSync, onActivitySleep, onActivitySleep100ms, onActivitySleep200ms,
    • launchFragment, launchFragmentInContainer, launchFragmentWithOn, launchFragmentInContainerWithOn,
    • getFragmentSync, onFragmentSleep, onFragmentSleep100ms, onFragmentSleep200ms

tools4a-utils

tools4a-view

  • 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

tools4a-other(Not available for the time being)

  • 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

Change Log

Please view the CHANGELOG.md file

License

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.

About

Extensions to the Android standard library and support libraries and some basic tools


Languages

Language:Java 51.0%Language:Kotlin 49.0%