AndroidツールクラスRxToolの使用



Android Tool Class Rxtool Use



使用環境:



プロジェクト作成開始時の迅速な開発と使用

指示:



1プロジェクトオブジェクトの下にbuild.gradleを追加します。

allprojects { repositories { maven{url 'https://jitpack.io'} } }

2 APP build.gradleが追加されました:

implementation 'com.github.vondear:RxTools:v1.7.3.4'

3初期化:



public class GRApplication extends Application { @Override public void onCreate() { super.onCreate() / / Use detailed explanation: https://github.com/vondear/RxTool RxUtils.init(this) } }

ハイライトを使用する

カスタムコントロール:

RxToast: Toast package RxTitle : Custom Title Control RxTextAutoZoom : Text automatically scales effects based on layout size RxRunTextView : TextView implements marquee effect RxTextviewVertical : Single-line text scrolling up and down RxTextViewVerticalMore : Multi-line text scrolling up and down RxAutoImageView : ImageView implements automatic left and right movement effects RxBarCode : Barcode control (copy jniLibs directory) RxQRCode : QR code control (copy jniLibs directory) RxNetSpeedView : Display current speed control RxToolTip : Implement popupWindow effect RxRoundProgress : Implementing an arc progress bar RxProgressBar : Custom progress bar RxShoppingView : Item Quantity Addition and Subtraction Control RxSeatMovie : Cinema Selector RxSeatAirplane : Airline ticket selection control RxRulerWheelView : Scale horizontal scrolling control RxCaptcha : Captcha Control

ダイアログパッケージ:

skipTools : hide the head navigation bar status bar setFullScreen : text automatically scales the effect according to the layout size setFullScreenWidth : set the width match_parent setFullScreenHeight : set the height to match_parent setOnWhole : set to global Dialog

アクティビティ関連パッケージ:

ActivityBase : encapsulates FragmentActivity and Context member parameters ActivityCodeTool : Encapsulates the activity that generates the QR code and barcode ActivityScanerCode : Encapsulates the activity of scanning QR code and barcode ActivityWebView : Encapsulates the activity that can play the video, get the page title and automatically adapt to the size of the WebView according to the content. isExistActivity : Determines whether the specified Activity exists. launchActivity : Open the specified Activity skipActivity : jump to the specified Activity skipActivityAndFinish : Jump to the specified Activity and close the current Activity skipActivityAndFinishAll : all activities before Finish after jumping skipActivityForResult : activityForResult package getLauncherActivity : get the launcher activity

関連する使用法:

QRコード:

hideKeyboard : Click to hide the soft keyboard countDown : countdown (get verification code countdown) showToast : The method that encapsulates Toast fixListViewHeight : manually calculate the height of the listView, but no longer has a scrolling effect createQRImage : generate a QR code drawLinecode : generate barcode Md5: Generate MD5 encrypted 32-bit string

関連する画像:

Unit conversion Dp2px : dp to px Dip2px : dip to px Px2dp : px to dp Px2dip : px to dip Sp2px : sp to px Px2sp : px to sp Image processing related bitmap2Bytes : bitmap to byteArr bytes2Bitmap : byteArr to bitmap drawable2Bitmap : drawable to bitmap bitmap2Drawable : bitmap to drawable drawable2Bytes : drawable to byteArr bytes2Drawable : byteArr to drawable calculateInSampleSize : Calculate the sample size getBitmap : Get the bitmap from the file /InputStream stream /resId Scale : zoom image Clip : cropping pictures Skew : tilt image Rotate : rotate the image getRotateDegree : Get the angle of rotation of the image toRound : turn to a round picture toRoundCorner : Turn to rounded corners fastBlur : fast blur renderScriptBlur : renderScript blur image (API is greater than 17) stackBlur : stack blurred image addFrame : add a color border addReflection : add reflection addTextWatermark : Add a text watermark addImageWatermark : add image watermark toAlpha : turn to alpha bitmap toGray : Turn to grayscale image Save : save the picture isImage : Determines whether the file is a picture based on the file name getImageType : Get the image type Image compression related compressByScale : compression by zoom compressByQuality : Compressed by quality compressBySampleSize : Compress by sample size GetLocalOrNetBitmap : Get a bitmap on the local or network getColorByInt : Convert hexadecimal color to decimal FilpAnimation : Interface Flip Animation

データ判定処理:

Data judgment isNullString : Determines whether the string is empty. isEmpty : Determines whether the object is empty. isInteger : Determines whether the string is an integer isDouble : Determine if the string is a floating point number isNumber : Determines if the string is a number getAstro : judge the constellation according to the date Data conversion stringToInt : The string is converted to an integer, and the conversion will return 0 stringToLong : The string is converted to long, and the conversion will return 0 stringToDouble : The string is converted to double and the conversion will return 0 simpleDateFormat : the date to convert date to format Date2Timestamp : Converts the date string to the DATE according to the specified format getDate : timestamp converted to date in the specified format string2Timestamp : converts yyyy year MM month dd day into timestamp getCurrentDateTime : Get current date and time / Get today's date getYestoryDate : get the date of yesterday formatTime : video time is converted to 'mm:ss' formatSeconds :'mm:ss' convert to video time getDaysByYearMonth : Get the corresponding month according to the year month StringToInputStream : String to InputStream upperFirstLetter : initial capitalization lowerFirstLetter : initial lowercase Reverse : reverse the string toDBC : Convert to a half-width character toSBC : Convert to full-width characters oneCn2ASCII: single Chinese characters into ASCII code oneCn2PY: single Chinese characters into pinyin getPYFirstLetter : get the first Chinese initial cn2PY: Chinese to Pinyin bytes2HexString : byteArr to hexString hexString2Bytes : hexString to byteArr hex2Dec : hexChar to int chars2Bytes : charArr to byteArr bytes2Chars : byteArr to charArr byte2Size : size of bytes to unit size size2Byte : size to bytes in unit byte2FitSize : the number of bytes to the appropriate size input2OutputStream : inputStream to outputStream output2InputStream :outputStream to inputStream inputStream2Bytes :inputStream to byteArr bytes2InputStream : byteArr to inputStream outputStream2Bytes :outputStream to byteArr bytes2OutputStream :outputStream to byteArr inputStream2String : inputStream to string by encoding string2InputStream : string to inputStream by encoding outputStream2String : outputStream to string by encoding string2OutputStream : string to outputStream by encoding Regular judgment isMobile : determine whether it is a real mobile phone number isMobileSimple : Verify phone number (simple) isMobileExact : Verify phone number (accurate) isTel : Verify phone number isBankCard : Verify Silver Card Number validateIdCard : Regular expression for 15-digit and 18-digit ID number ID verification isIDCard15: Verify ID number 15 digits isIDCard18 : Verify ID number 18 digits isEmail : Verify Email isURL : verify URL isChz : verify Chinese characters isUsername : Verify username isDate : Verifies the date check in yyyy-MM-dd format. isIP : Verify IP address isMatch :string matches regex stringFormat : The encapsulation of the String.Format method hideMobilePhone : hide the middle 4 digits of the phone formatCard : format bank card hide middle 8 digit number formatCardEndFour : Get the four digits after the bank card format2Decimals : format the string as a string with two decimals

アニメーション:

animationColorGradient : color gradient animation cardFilpAnimation : Card flip animation

APK関連:

InstallAPK : Install APK installApp : Install App (Support 6.0) installAppSilent : silently install the app uninstallApp : Uninstall App uninstallAppSilent : Silently uninstall App isAppRoot : Determine if the app has root privileges launchApp : Open the app getAppPackageName : Get the app package name getAppDetailsSettings : Get App specific settings getAppName : Get the App name getAppIcon : Get the App icon getAppPath : Get the App path getAppVersionName : Get the app version number getAppVersionCode : Get the app version code isSystemApp : Determine if the app is a system application isAppDebug : Determine if the app is a Debug version getAppSignature : Get the App signature getAppSignatureSHA1 : Get the SHA1 value of the application signature isInstallApp : Determine if the app is installed getAppInfo : Get current App information getBean : get the AppInfo bean getAllAppsInfo : Get all installed app information isAppBackground : Determine whether the current App is in the foreground or background

関連するステータスバー:

setTransparentStatusBar : Set the transparent status bar (api can be used if it is greater than 19) hideStatusBar : Hide the status bar noTitle : hide the Title FLAG_FULLSCREEN : set full screen getStatusBarHeight : Get the status bar height isStatusBarExists : Determine if the status bar exists getActionBarHeight : Get the height of the ActionBar showNotificationBar : display notification bar hideNotificationBar : Hide notification bar invokePanels : reflection wakeup notification bar

カメラ関連:

getOpenCameraIntent : Get the Intent to open the program interface getImagePickerIntent : Get the [In jump to the album selection interface, and jump to the cropping interface, you can specify whether to scale the cropping area] Intent getCameraIntent : Get the Intent of [Go to the album selection interface and jump to the cropping interface, the default scalable cropping area] getCropImageIntent : Get the [In jump to the clipping interface] Intent getChoosedImage : Get the image of the selected album getChoosedImagePath : Get the image path of the selected album getTakePictureFile : Get the photo file after taking the photo (JPG format) openCameraImage : call system camera openLocalImage : call system album cropImage : crop image createImagePathUri : Create a picture address uri to save the photo after taking the photo getRealFilePath : Get the real file address of the picture uri

コーデックツールクラス:

urlEncode : URL encoding urlDecode : URL decoding base64Encode : Base64 encoding base64Encode2String : Base64 encoding base64Decode : Base64 decoding base64UrlSafeEncode :Base64URL secure encoding htmlEncode :Html encoding htmlDecode :Html decoding

暗号化および復号化ツール:

Hash encryption related encryptMD2ToString : MD2 encryption encryptMD2: MD2 encryption encryptMD5ToString : MD5 encryption encryptMD5: MD5 encryption encryptMD5File2String : MD5 encrypted file encryptMD5File : MD5 encrypted file encryptSHA1ToString : SHA1 encryption encryptSHA1 : SHA1 encryption encryptSHA224ToString : SHA224 encryption encryptSHA224 : SHA224 encryption encryptSHA256ToString : SHA256 encryption encryptSHA256 : SHA256 encryption encryptSHA384ToString : SHA384 encryption encryptSHA384 : SHA384 encryption encryptSHA512ToString : SHA512 encryption encryptSHA512 : SHA512 encryption encryptAlgorithm : Encrypt algorithm for data algorithm DES encryption related DESTemplet : DES encryption encryptDES : DES encryption encryptDES2Base64 : DES encrypted and converted to Base64 encoding encryptDES2HexString : DES is encrypted and converted to hexadecimal decryptBase64DES : DES decrypts Base64 encoded ciphertext decryptHexStringDES : DES decrypts hexadecimal ciphertext decryptDES : DES decryption 3DES encryption related encrypt3DES2Base64 : 3DES encrypted and converted to Base64 encoding encrypt3DES2HexString : 3DES encrypted and converted to hexadecimal encrypt3DES: 3DES encryption decryptBase64_3DES : 3DES decrypts Base64 encoded ciphertext decryptHexString3DES : 3DES decrypts hexadecimal ciphertext decrypt3DES : 3DES decryption AES encryption related encryptAES2Base64 : AES encrypted and converted to Base64 encoding encryptAES2HexString : AES is encrypted and converted to hexadecimal encryptAES : AES encryption decryptBase64AES : AES decrypts Base64 encoded ciphertext decryptHexStringAES : AES decrypts hexadecimal ciphertext decryptAES : AES decryption

ファイルファイル操作:

SD card operation getRootPath : Get the SD card root directory getCecheFolder : Get this application image cache directory isSDCardEnable : Determines if the SD card is open. getSDCardPath : Get the SD card path getDataPath : Get the SD card Data path getFreeSpace : Get the remaining space of the SD card sdCardIsAvailable : Is the SD card available? fileExists : whether the file or folder exists delAllFile : Delete all files in the specified folder, do not keep the folder. Copy : file copy (file path) copyFile : copy file (file / InputStream stream) copyFolder : copy the entire folder renameFile : rename file getSDCardAvailaleSize : Get disk free space getDirSize : Get the available size of a directory getFileAllSize : Get the file or folder size initFile : create a file initDirectory : create a folder saveFile : save the InputStream stream to the file saveFileUTF8 : save a file with UTF8 getFileUTF8 : read a file with UTF8 getFileIntent : get a file Intent getDiskCacheDir : Get the cache directory getDiskFileDir : Get the cached video file directory mergeFiles : Multiple files are merged and merged getNativeM3u : Replace m3u8 online with m3u8 Write : save the string as a file TextToFile : Pass in the file name and string, save the string information to the file GetAllFileName : Get all suffixed files under the search path readFileByLines : Reads files in rows, often used to read line-oriented formatted files getFileByPath : Get the file according to the file path isFileExists : Determine if the file exists isDir : determine whether it is a directory isFile : determine whether it is a file createOrExistsDir : Determines whether the directory exists. If it does not exist, it determines whether the creation is successful. createOrExistsFile : Determines whether the file exists. If it does not exist, it determines whether the creation is successful. createFileByDeleteOldFile : Determines whether the file exists, and exists to delete it before creation copyOrMoveDir : copy or move the directory copyOrMoveFile : copy or move files copyDir : copy directory copyFile : copy files moveDir : move directory moveFile : move files deleteDir : delete directory deleteFile : delete file listFilesInDir : Get all files in the directory listFilesInDirWithFilter : Get all the files in the directory with the suffix suffix searchFileInDir : Get the file name of the specified file in the directory including subdirectories writeFileFromIS : write the input stream to the file writeFileFromString : writes a string to a file readFile2List : specifies the encoding to read the file to the list by row readFile2String : specifies that the encoding reads the file into the string by line readFile2Bytes : specifies that the encoding reads the file into the character array by line getFileCharsetSimple : Simply get the file encoding format getFileLines : Get the number of file lines getFileSize : Get the file size getFileMD5 : Get the MD5 checksum of the file closeIO : close IO getDirName : Get the longest directory in the full path getFileName : Get the file name in the full path getFileNameNoExtension : Get the file name without extension in the full path getFileExtension : Get the file extension in the full path clear data cleanInternalCache : clear internal cache cleanInternalFiles : clear internal files cleanInternalDbs : clear internal database cleanInternalDbByName : clear the database by name cleanInternalSP : Clear internal SP cleanExternalCache : clear external cache cleanCustomCache : clear files in the custom directory

関連するコピーアンドペースト:

copyText : copy text to clipboard getText : get the text of the clipboard copyUri : copy uri to clipboard getUri : Get the uri of the clipboard copyIntent : copy the intent to the clipboard getIntent : Get the intent of the clipboard

インテント共有またはその他の関連:

getInstallAppIntent : Get the intent to install the app (support 6.0) getUninstallAppIntent : Get the intent to uninstall the app getLaunchAppItent : Get the intent to open the app getAppInfoIntent : Get the intent of the App information getShareInfoIntent : Get the intent of the app information sharing getIntentByPackageName : Get the intent based on the package name getComponentNameIntent : Get the Intent of other apps

キーボード関連:

hideSoftInput : Dynamically hide the soft keyboard showSoftInput : Dynamic display soft keyboard toggleSoftInput : toggle keyboard display status

ネットワーク関連:

Ping : determine if there is an external network connection isWifiEnabled : Determine if WIFI is turned on Is3rd : Determine whether it is a 3G network isWifi : Determine if the network connection method is WIFI isNetworkAvailable : Determines if a network connection is available isGpsEnabled : Is the GPS turned on? getNetWork : Get the current network status openWirelessSettings : Open the network settings interface getActiveNetworkInfo : Get active network information isAvailable : Determine if the network is available isConnected : Determine if the network is connected is4G : Determine if the network is 4G isWifiConnected : Determine if wifi is connected getNetworkOperatorName : Get the mobile network operator name getPhoneType : Get the mobile terminal type getNetWorkType : Get the current network type getNetWorkTypeName : Get the current network type name

サービス関連:

isRunningService : Get the service is enabled

ルート関連:

isRoot : Determine if the device is root execCmd : Whether to execute the command under root

キャッシュ関連:

putContent : Save a single way to SharedPreferences getContent : Get the value marked as tag putJSONCache : store JSON cache data readJSONCache : read JSON cache data clearPreference : Clear the specified information (if it is null, delete all the key values ​​under name)

時間関連:

putContent : Save a single way to SharedPreferences getContent : Get the value marked as tag putJSONCache : store JSON cache data readJSONCache : read JSON cache data clearPreference : Clear the specified information (if it is null, delete all the key values ​​under name)

圧縮関連:

zipFiles : bulk compressed files zipFile : compressed file unzipFiles : bulk extract files unzipFile : Unzip the file unzipFileByKeyword : Unzip files with keywords getFilesPath : Get the file path list in the compressed file getComments : Get the list of comments in the compressed file getEntries : Get the file object in the compressed file

関連するスレッドプール:

RxThreadPoolUtils : ThreadPoolUtils constructor Execute : Execute the given command (chain list) at some time in the future shutDown : closes the thread pool after the previously submitted task is executed shutDownNow : Attempt to stop all active activities being executed isShutDown : Determines if the thread pool is closed isTerminated : Determines whether all tasks have been completed after closing the thread pool awaitTermination : request to close, timeout occurred or current thread interrupted Submit : Submit a Runnable task for execution invokeAll : Execute the given task invokeAny : Execute the given task Schedule : Delay execution of the Runnable command scheduleWithFixedRate : delays and loops through commands scheduleWithFixedDelay : delays and cycles through the command with a fixed break

関連するデバイスツールクラス:

Screen related getScreenHeight : get the height of the screen getScreenWidth : get the width of the screen getScreenWidths : get the width of the device screen getScreenHeights : get the height of the device screen getScreenDensity : get the density of the device setLandscape : set the screen to landscape setPortrait : set the screen to portrait isLandscape : determine whether horizontal screen isPortrait : determine whether the screen is vertical getScreenRotation : Get the screen rotation angle captureWithStatusBar : Get the current screenshot with the status bar captureWithoutStatusBar : Get the current screenshot without the status bar getDisplayMetrics : Get the DisplayMetrics object isScreenLock : Determine whether to lock the screen Hardware information related getUniqueSerialNumber : Get the unique ID number of the phone getIMEI : Get the IMEI of the device getIMSI : Get the IMSI of the device getDeviceSoftwareVersion : Get the software version number of the device getLine1Number : Get the phone number getNetworkCountryIso : Get the ISO standard country code, ie the international long distance area code getNetworkOperator : Get the device's MCC + MNC getNetworkOperatorName : Get the name of the (currently registered user) getNetworkType : Get the current network type used getPhoneType : Get the phone type getSimCountryIso : Get the country code of the SIM card getSimOperator : Get the mobile country code and mobile network code provided by the SIM card. 5 or 6 digit decimal digits getSimOperatorName : Get the name of the service provider getSimSerialNumber : Get the serial number of the SIM card getSimState : Get the status information of the SIM getSubscriberId : Get a unique user ID getVoiceMailNumber : Get the voicemail number getAndroid_id : Get the ANDROID ID getBuildBrandModel : Get the device model, such as MI2SC getBuildBrand : Get the device brand name getBuildMANUFACTURER : Get device vendors such as Xiaomi getSerialNumber : Get the serial number getAppVersionNo : Get the app version number getAppVersionName : Get the app version name checkPermission : check permissions getDeviceInfo : Get device information ThroughArray : traversing the LOG output HashMap getMacAddress : Get the device MAC address Mobile phone related isPhone: determine whether the device is a mobile phone getPhoneStatus : Get phone status information Dial : jump to the dialing interface filled with phoneNumber callPhone: call sendSms : send SMS getAllContactInfo : Get phone contact getContantNum : Open the phone contact interface and click the contact to get the number getAllSMS : Get the SMS message and save it to xml

転載されたコンテンツ: https://blog.csdn.net/m0_37314675/article/details/77850849

rxToolsはフル機能のツールです。正直なところ、それを使うと怠惰になりますが、急速な発展は排除されます。

共有してくれてありがとう!