Android Library with a collection of Util functions and Biometric Authentications
Util_Manager is an android library which can be used to implement biometric authentications, validate data in any android application.
AppManager - include functions which related to application level (app running status, get app version).
CalendarUtilsManager - include functions which related to Date time validations and conversions.
CardNumberValidations - include functions which related to validate credit, debit card numbers, get card types with luhn algorithm.
AmountManager - collection of functions to format amounts and get clean numbers from formatted amounts.
DeviceManager - collection of functions to get device brand, model, device related functions.
EmailManager - collection of functions to validate email addresses.
BiometricAuthenticationHandler - to implement biometric validations with Face ID and Fingerprint(FaceID will support with BiometricPromts)
MobileManager - collection of functions to validate mobile numbers with careers, get career of the number.
NetworkManager - include functions which related to check internet connection in both device side and ISP side.(Both cellular data and WIFI)
NICManager - include set of functions to validate NIC numbers, get gender, get birthday etc...(supports for old(length=10 with V,X) and new(length=12) types)
SharedPreferenceManager - collection of functions to manage SharedPreference (Add, update, check, delete)
RecyclerViewLayoutManager - include functions to set item flow orientations for the recyclerview.
ObjectSerializer - collection of functions to serialize, deserialize custom bean objects.
ToastManager - collection of function for show toasts (Default toasts, Top bar toasts, SnackBars).
Utilizer - collection of functions to validate Strings and add zeropads.
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.Sumudu-Sahan:Utils_Manager:1.00.02'
}
This library packs with SDP, SSP libraries, androidx biometric library and GPS, network,vibrator, biometric related permissions. Therefore no need to add below mentioned permissions again and libraries
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" />
implementation 'androidx.biometric:biometric:1.0.0'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.androidadvance:topsnackbar:1.1.1'
BiometricAuthenticationHandler biometricAuthenticationHandler = new BiometricAuthenticationHandler(fragmentActivity, new BiometricAuthenticationHandler.BiometricAuthenticationHandlerEvents() {
@Override
public void onAuthenticationSuccess() {
ToastManager.getInstance().showTopToast(activity, "Authentication Success", ToastManager.TOP_DURATION_LONG);
}
@Override
public void onAuthenticationFailed() {
ToastManager.getInstance().showTopToast(activity, "Authentication Failed", ToastManager.TOP_DURATION_LONG);
}
@Override
public void onAuthenticationCancelled() {
ToastManager.getInstance().showTopToast(activity, "Authentication Cancelled", ToastManager.TOP_DURATION_LONG);
}
});
biometricAuthenticationHandler.startAuthentication("Title", "SubTitle", "Description", "BTNTEXT", resID); //resID - popup dialog image icon resource
CardNumberValidations.getInstance().validateCreditCardNumber("Card Number")
CardNumberValidations.getInstance().getFormattedCardNumber("Card Number", 4) //4 - Interval
CardNumberValidations.getInstance().getCardTypeFromCardNumber("Card Number")
CardNumberValidations.CARD_TYPE_VISA - VISA type
CardNumberValidations.CARD_TYPE_MASTERCARD - Master Card Type
CardNumberValidations.CARD_TYPE_AMERICAN_EXPRESS - Amex
CardNumberValidations.CARD_TYPE_DINERS_CLUB - Diners Club
CardNumberValidations.CARD_TYPE_DISCOVER - Discover
CardNumberValidations.CARD_TYPE_JCB - JCB
CardNumberValidations.CARD_TYPE_CHINA_UNION_PAY - China Union Pay
CardNumberValidations.CARD_TYPE_UNKNOWN - Invalid Card Type
ToastManager.getInstance().showTopToast(activity, "Message", ToastManager.TOP_DURATION_LONG);
ToastManager.TOP_DURATION_LONG
ToastManager.TOP_DURATION_INDEFINITE
ToastManager.TOP_DURATION_SHORT
ToastManager.getInstance().showSnackBar(view, "Test Message", "OK", new ToastManager.SnackBarButtonAction() {
@Override
public void buttonClick() {
//Do Something Here
}
});
MobileManager.getInstance().isValidMobileNumber("+94773606094", true); //if career validation is enabled, mobile number check with current available mobile IPS codes in Sri Lanka
MobileManager.getInstance().getCareerFromMobileNumber("+94773606094");
MobileManager.CAREER_DIALOG
MobileManager.CAREER_MOBITEL
MobileManager.CAREER_HUTCH
MobileManager.CAREER_AIRTEL
MobileManager.CAREER_INVALID
NICManager.getInstance().isValidNICNumber("942490259V"); // This method supports with both old and new formats
NICManager.getInstance().getBirthdayFromNIC("199410900877"); // This method supports with both old and new formats
NICManager.getInstance().getBirthYearFromNIC("942490259V") // This method supports with both old and new formats
NICManager.getInstance().getGenderFromNIC("942490259V"); // This method supports with both old and new formats
NICManager.GENDER_MALE
NICManager.GENDER_FEMALE
AmountManager.getInstance().getFormattedAmount(15548.25);
AmountManager.getInstance().getDoubleValueOfAmount("15,753.14");
EmailManager.getInstance().isValidEmailAddress("[email protected]");
CalendarUtilsManager.getInstance().getCurrentDateCustomFormat("yyyy-MMM-dd HH:mm:ss");
CalendarUtilsManager.getInstance().convertDateString("dateString", "newFormat", "parsingFormat", "AlternetParsingFormat")
CalendarUtilsManager.getInstance().getDuration(System.currentTimeMillis() - CalendarUtilsManager.getInstance().getPreviousDate(3).getTime());
NetworkManager.getInstance().isInternetOn(context);
NetworkManager.getInstance().isInternetAvailable(new NetworkManager.NetworkCheckListener() {
@Override
public void onInternetAvailable() {
System.out.println("onInternetAvailable");
}
@Override
public void onError() {
System.out.println("onError");
}
});
AppManager.getInstance().getAppVersion(context);
AppManager.getInstance().isAppRunning(context, getPackageName())
SharedPreferenceManager.getInstance().getBooleanPref(context, "PreferenceName", "Key", true);
SharedPreferenceManager.getInstance().getBooleanPref(context, "Key", true);
SharedPreferenceManager.getInstance().getStringPreference(context, "PreferenceName", "Key", "defaultValue");
SharedPreferenceManager.getInstance().getStringPreference(context, "Key", "defaultValue");
SharedPreferenceManager.getInstance().getIntPreference(context, "PreferenceName", "Key", 0);
SharedPreferenceManager.getInstance().getIntPreference(context, "Key", 0);
SharedPreferenceManager.getInstance().putStringPreference(context, "PreferenceName", "Key", "value");
SharedPreferenceManager.getInstance().putStringPreference(context, "Key", "value");
SharedPreferenceManager.getInstance().hasPreference(context, "preferenceName", "key");
SharedPreferenceManager.getInstance().hasPreference(context, "key");
You can get, add values to the Shared Preference by creating a custom preference by parsing the preference name or get default preference.
RecyclerViewLayoutManager.getInstance().setLayoutManager(context, recyclerview, RecyclerViewLayoutManager.ORIENTATION_VERTICAL);
That's it. Happy Coding 😃 😃 😃