Skip to content

itachi1706/AndroidHelperLib

Repository files navigation

AndroidHelperLib

Maven Central GitHub Actions GitHub release GitHub license Code Climate Test Coverage Issue Count

This library contains various helper classes for use in Android-based projects

Usage - Maven Central

To use this library in an Android Project, add the following lines into your app-level build.gradle file

repositories {
	mavenCentral()
}
…
dependencies {
  implementation 'com.itachi1706.helpers:helperlib:<latest-version>' // See badge for latest version
}

Usage - GitHub Packages

To use this library in an Android Project, add the following lines into your app-level build.gradle file

repositories {
	maven {
		url "https://maven.pkg.github.com/itachi1706"
	}
}

dependencies {
  implementation 'com.itachi1706.helpers:helperlib:<latest-version>' // See badge for latest version
}

API Helper Usage

To use the API Helper, you will need to add the following lines into your AndroidManifest.xml file

<uses-permission android:name="android.permission.INTERNET" />

Helper Classes in the library

Deprecation Classes

These classes act basically as a compatibility layer for versions of Android, using the newer APIs when possible and falling back to deprecated APIs when the new APIs are not available

  • HTML - Handles HTML text formatting for TextViews
  • StatFs - Compatibility methods for handling file sizes
  • TextView - Handles the method of setting text appearance of a TextView

Helper classes

These classes provides some helper methods for various tasks that you may use when developing an Android Project

  • Connectivity - Handles check for internet/WiFi/Cellular connections and whether Data Saver is enabled on the device
  • Log Helper - Helps handle logging with possible external logging to be added
  • Preference - Various helper methods to handle day/night themes and dark mode switching, as well as the ability to access SharedPreference on the MainThread without triggering StrictMode
  • URL - Helper methods for connecting to a HTTP/HTTPS url (with fallback support) and retrieving a String of its data (More return types coming soon)
  • App Validation - Validates where the application has been installed from. Useful to help check if the app is installed from places like Google Play Store to disable features that may be against the ToS of the respective stores. Also allows you to obtain the application signature for further verification

Utility classes

These classes provides utility methods for aiding in specific tasks such as conversion of file types or retrieval from resource files

  • Bitmap - Retrieve bitmap from various places (drawable, vectors etc)
  • Color - Obtain color from attributes
  • User Notification - Quick Snackbar and Toast messages notifications