Android Utils

Standard

This is a utils library for Android Applications containing useful methods.
AndroidUtils class help you to interact with different parts of android os without writing many codes and as simple as possible.

Github_LogoGithub repo:
https://github.com/mirhoseini/android_utils

Grab via Maven:

<dependency>
 <groupId>com.mirhoseini.utils</groupId>
 <artifactId>utils</artifactId>
 <version>1.0.7</version>
 <type>pom</type>
</dependency>

or Gradle:

compile 'com.mirhoseini.utils:utils:1.0.7'

App Settings

Standard

This is a best practice for Android Applications Config Management using Shared Preferences.
AppSettings class help you to manage deferent types of data in your application and load them in memory for faster use also save them in shared preferences for next run.

  • Eliminate SharedPreferences and Editor Commits calls.
  • Different method ovverride to set and get all data types.
  • Allow to use different XML files for saving and accessing settings.

Github_LogoGithub repo:
https://github.com/mirhoseini/app_settings

// load saved values
 private void loadValues() {
 etName.setText(AppSettings.getString(this, KEY_NAME, ""));
 spAge.setSelection(AppSettings.getInt(this, KEY_AGE, 0));
 rbMale.setChecked(AppSettings.getBoolean(this, KEY_IS_MALE, true));
 rbFemale.setChecked(!AppSettings.getBoolean(this, KEY_IS_MALE, true));
 sbWeight.setProgress((int) (AppSettings.getFloat(this, KEY_WEIGHT, 0f) * WEIGHT_FACTOR));
 }

 // clear saved values
 private void clearValues() {
 AppSettings.clearValue(this, KEY_NAME);
 AppSettings.clearValue(this, KEY_AGE);
 AppSettings.clearValue(this, KEY_IS_MALE);
 AppSettings.clearValue(this, KEY_WEIGHT);

 loadValues();
 }

 // save input values
 private void saveValues() {
 AppSettings.setValue(this, KEY_NAME, etName.getText().toString().trim());
 AppSettings.setValue(this, KEY_AGE, spAge.getSelectedItemPosition());
 AppSettings.setValue(this, KEY_IS_MALE, rbMale.isChecked());
 AppSettings.setValue(this, KEY_WEIGHT, (float) sbWeight.getProgress() / WEIGHT_FACTOR);
 }

Grab via Maven:

<dependency>
 <groupId>com.mirhoseini.appsettings</groupId>
 <artifactId>appsettings</artifactId>
 <version>1.0.1</version>
 <type>pom</type>
</dependency>

or Gradle:

compile 'com.mirhoseini.appsettings:appsettings:1.0.1'