Skip to content

A utility based package for Android/Java programming.

Notifications You must be signed in to change notification settings

H4zh4n/HaxHanTools

Repository files navigation

Documentation

Partial documentation available here : documentation

Components

Implementation

Jitpack required in settings.gradle

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

}

Implementation in build.gradle Module :

implementation 'com.github.H4zh4n:HaxHanTools:1.0.15.2'

Usage

For the whole process to work properly, Utils() must be initialized before any of the ui/ context based components to be used.

I Recommend that you write below line in first activities onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    new Utils(this); // <--- have this

    // ... other codes
}

For the dialogs/toast and such to work and display data properly, make sure that for each activity you have below line in it's onResume

@Override
protected void onResume() {
    super.onResume();

    Utils.activeContext = this;

    // ... other codes
}

This is so that the app knows on which screen the dialogs should be shown.


Known Errors

-- Duplicate Class Found

  • If you faced duplicate Class found for lifecycle-viewmodel or androidx.lifecycle or lifecycle-viewmodel-ktx then implement as following
implementation('com.github.H4zh4n:HaxHanTools:1.0.15.2') {
        exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel'
        exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
}

-- More than one file was found

  • below code might be needed in build.grade Module to avoid More than one file was found with OS independent path 'META-INF/DEPENDENCIES'
android {
 // ...
    packagingOptions {
        exclude 'META-INF/*'
    }
   //...
}