Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.xihadulislam:AndroidUtils:2.0.5'
}
val sharePrefSettings = AndroidUtils.getSharePrefSetting(this);
sharePrefSettings.setBoolValue("key", false)
val kBoolean = sharePrefSettings.getBoolValue("key")
Log.d(TAG, "onCreate: $kBoolean")
sharePrefSettings.setStringValue("key2", "xihad islam")
val xd = sharePrefSettings.getStringValue("key2")
Log.d(TAG, "onCreate: $xd")
AndroidUtils.applyClickEffect(view)
view.setOnClickListener{}
val uId: String = AndroidUtils.uId() // example: 42N35260Y390345AM
AndroidUtils.isInternetAvailable(context) // it will return true or false
var image : Bitmap = AndroidUtils.takeScreenshotOfView(rootView,200,200) // height & width is optional
var image2 : Bitmap = AndroidUtils.takeScreenshotOfView(rootView) // height & width is optional
AndroidUtils.protectToScreenshot(this) //
val numberUtils: NumberUtils = AndroidUtils.getNumberUtils()
numberUtils.numberToWords(100)
numberUtils.numberInBangla("100")
// or you can use it with Quick Access
val word = AndroidUtils.numberToWords(100)
val banglaNumber = AndroidUtils.numberInBangla("12-10-2022")
val banNumber = AndroidUtils.getDigitBanglaFromEnglish("1234")
val enNumber = AndroidUtils.getDigitEnglishFromBangla(banNumber)
val includingTax = AndroidUtils.getIncludingTax(100,20)
val excludingTax = AndroidUtils.getExcludingTax(100,25)
val num = AndroidUtils.twoDigitDouble(14.4444334343)
val str:String = AndroidUtils.twoDigitString(14.364433)
val num = AndroidUtils.stringToNumber("13")
val encrypt = AndroidUtils.encrypt("hello from xihad")
val decrypt = AndroidUtils.decrypt(encrypt) // hello from xihad
AndroidUtils.setWebView(url, webView) // load webview
val systemApplications : List<ApplicationInfo> = AndroidUtils.getSystemApplications(context)
val installApplications : List<ApplicationInfo> = AndroidUtils.getInstallApplications(context)
val allApplications : List<ApplicationInfo> = AndroidUtils.getAllApplications(context)
val is = AndroidUtils.isAppOnForeground(context)
val isPack= AndroidUtils.isSystemPackage(context)
toast.setOnClickListener {
AndroidUtils.toast(this, "show something")
}
showSnack.setOnClickListener {
AndroidUtils.getSnackBar(this).snackBar("show something")
}
showSnackSuccess.setOnClickListener {
AndroidUtils.getSnackBar(this).successSnack(root, "show something")
}
showSnackInfo.setOnClickListener {
AndroidUtils.getSnackBar(this).infoSnack(root, "show something", Gravity.BOTTOM, fun() {
AndroidUtils.toast(this, "click")
})
}
showSnackWarning.setOnClickListener {
AndroidUtils.getSnackBar(this).warningSnack(root, "show something")
}
showSnackError.setOnClickListener {
AndroidUtils.getSnackBar(this).errorSnack(root, "show something")
}
startNextActivity.setOnClickListener {
AndroidUtils.getIntent().startNextActivity(this, SecondActivity::class.java)
}
afterNextActivity.setOnClickListener {
AndroidUtils.getIntent().afterNextActivity(this, 2000, SecondActivity::class.java)
}
startFacebookIntent.setOnClickListener {
AndroidUtils.getIntent().startFacebookIntent(this, "url")
}
Clone this repo and check out the app module.
This is my First built library, so if you face any issues or errors feel free to tell me. I will update it continuously.
Like this project? Why not share to your friend :)
Copyright 2021 @xihad islam.
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.