Android Development Utils

Overview

QuickUtils

QuickUtils Maven Central Android Arsenal

This repository offers a set of random useful classes to deal with repetitive tasks in the Android Framework. Intended to help you getting your Android applications off the ground quickly, by offering ready-to-use components and utility classes that wrap a lot of the boilerplate that’s involved when writing Android apps.

Header

Main features

  • REST - Simple REST requests and automatic parse
  • Cache Magic - Easily serialize and cache your objects to disk using key/value pairs
  • Async Image Loader - Image downloading and caching

Installation

Including in your project via Gradle:

dependencies {
    compile 'com.cesarferreira.quickutils:library:2.+'
}

Usage

Init the library in your Application class

public class SampleApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        QuickUtils.init(this);
    }
}

REST

Simple REST requests and automatic parse

Gson Entity

public class Tweet {
    @SerializedName("title")
    public String title;
    @SerializedName("amount_of_retweets")
    public long retweetsTotal;
}

The Request

 QuickUtils.rest.connect()
            .GET() // POST() // PUT()
            .load("https://path/to/the/tweets")
            .as(new TypeToken<List<Tweet>>() {})
            .withCallback(callback);

Post with Header and Body params

Header requestHeader = new Header.Builder()
                .add("Authorization", "Bearer Jhahdau2819ajsbdkasdkasdkashjdkahs")
                .build();

Body requestBody = new Body.Builder()
            .add("email", "[email protected]")
            .build();

QuickUtils.rest.connect()
            .POST(requestHeader, requestBody)
            .load(url)
            .as(new TypeToken<List<Person>>() {})
            .withCallback(callback);

Cache magic!

Easily serialize and cache your objects to disk using key/value pairs.

Save

sync

QuickUtils.cacheMagic.save("somePerson", new Person("john doe"));

async

QuickUtils.cacheMagic.save("somePerson", new Person("john doe"), new SaveToCacheCallback() {(...)});

Read

sync

QuickUtils.cacheMagic.read("somePerson", null);

async

QuickUtils.cacheMagic.readAsync("somePerson", new TypeToken<Person>() {}, new ReadFromCacheCallback<Person>() {(...)});

Delete

QuickUtils.cacheMagic.delete("somePerson"); // deleteAsync also works

Erases ALL the key/values that are stored

QuickUtils.cacheMagic.deleteAll();

Exists

Check if a key/value exists

boolean personExists = QuickUtils.cacheMagic.existsKey("somePerson");

Async Image Loader

Image downloading and caching

// Simple
QuickUtils.imageCache.load(IMAGE_URL, imageView);

// or more complete
QuickUtils.imageCache.load(IMAGE_URL, imageView, R.drawable.dummy, R.drawable.error);

Using the util methods

All you need to do is to specify the category and the method you want to use.

QuickUtils.__category__.__method__

E.g.

// Log something
QuickUtils.log.e("this is an error");
// Make the smartphone vibrate for the amount of time you want
QuickUtils.system.vibrate(1000);
// Convert pounds to KG
QuickUtils.math.poundsToKg(weight);
// Does that file exists?
QuickUtils.sdcard.exists(someFile);
// Encode a string
QuickUtils.security.encodeBase64(someString);
// Save data
QuickUtils.prefs.save(key, value);
// Retrieve saved data
QuickUtils.prefs.getString(key, defaultValue);
QuickUtils.prefs.getInt(key, defaultValue);
// Remove saved data
QuickUtils.prefs.remove(key);
//  Etc. (hundreds more methods)

More Documentation

Take a look at our wiki.

Contributing

Contributions welcome via Github pull requests.

License

QuickUtils is available under the MIT license. See the LICENSE file for more info.

Comments
  • ATTENTION: com.android.volley.TimeoutError

    ATTENTION: com.android.volley.TimeoutError

    Hii...I am getting this error...sometimes works and sometimes no....my request haven't nothing special....how can I set a timeout?

    ATTENTION: com.android.volley.TimeoutError

    opened by diogo10 2
  • Error initing cache

    Error initing cache

    This error message appears every time I run my app 02-28 03:42:01.385 32709-32709/me.branded.hossamhassan.ojreetel5eer E/بوابة النقل: Error initing cache

    public class OjreetApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        HossLocaleHelper.onCreate(this);
        QuickUtils.init(this);
        initImageLoader(this);
    
    
    }
    
    opened by DevHossamHassan 1
  • a lot of static method and class ,may be Spend a lot of performance.....

    a lot of static method and class ,may be Spend a lot of performance.....

    like this:

           public static class date extends quickutils.core.categories.date {
           }
    
          public class date {
    
    
              public static final int YESTERDAY = -1;
              public static final int TODAY = 0;
              public static final int TOMORROW = 1;
    
    
              public static int getCurrentYear() {
                      Calendar c = Calendar.getInstance();
                       return c.get(Calendar.YEAR);
               }
    
    
                ....a lot of static method...
           }
    
    opened by xiaomeixw 1
  • RequestError does not provide a way for access the error message

    RequestError does not provide a way for access the error message

    https://github.com/cesarferreira/AndroidQuickUtils/blob/master/library/src/main/java/quickutils/core/rest/RequestError.java

    The RequestError constructor initializes the errorMessage field, but the class does not have a public method for accessing this value, making impossible to the rest api access the result of the request

    I will make a pull request for it

    UPDATE https://github.com/cesarferreira/AndroidQuickUtils/pull/3

    opened by YuriHeupa 1
  • Added public get method for error message at RequestError

    Added public get method for error message at RequestError

    The RequestError constructor initializes the errorMessage field, but the class does not have a public method for accessing this value, making impossible to the rest api access the result of the request

    opened by YuriHeupa 0
Releases(2.4.3)
Owner
César Ferreira
Senior Android Developer, currently working as a Tech Lead @GlueHome
César Ferreira
Kick-starts Android application development.

Synopsis If you've made it here, chances are you are not quite as satisfied with the Android application framework as you could be. Same for us, that'

Matthias Käppler 1.3k Dec 4, 2022
🔪 AOP development framework implemented through *Annotation + ASM + Gradle Transform API* for Android🤖

?? AOP development framework implemented through *Annotation + ASM + Gradle Transform API* for Android??

Pumpkin 325 Nov 22, 2022
UltimateAndroid is a rapid development framework for developing your apps

UltimateAndroid Version:0.10.2 UltimateAndroid is a rapid development framework for developing apps Master branch: Dev branch: V0.7.0 Ui Demo screensh

MarshalChen 2.1k Dec 26, 2022
Android part of the Android Studio(IntellijIDEA) OkHttp Profiler plugin

OkHttpProfiler Android Library Created by LocaleBro.com - Android Localization Platform The OkHttp Profiler plugin can show requests from the OkHttp l

Ievgenii 261 Dec 8, 2022
A Model-View-Presenter / Model-View-Intent library for modern Android apps

Mosby A Model-View-Presenter and Model-View-Intent library for Android apps. Dependency dependencies { compile 'com.hannesdorfmann.mosby3:mvi:3.1.1

Hannes Dorfmann 5.5k Dec 25, 2022
dexposed enable 'god' mode for single android application.

What is it? Dexposed is a powerful yet non-invasive runtime AOP (Aspect-oriented Programming) framework for Android app development, based on the work

Alibaba 4.5k Dec 28, 2022
A small, yet full-featured framework that allows building View-based Android applications

Conductor A small, yet full-featured framework that allows building View-based Android applications. Conductor provides a light-weight wrapper around

BlueLine Labs 3.9k Jan 6, 2023
A Job Queue specifically written for Android to easily schedule jobs (tasks) that run in the background, improving UX and application stability.

This Project is Deprecated! Thanks to everybody who've used Android Priority JobQueue. It was designed in a world where there was no JobScheduler, RxJ

Yigit Boyar 3.4k Dec 31, 2022
A plugin system that runs like a browser, but instead of load web pages, it load apk plugins which runs natively on Android system.

Android Dynamic Loader Android Dynamic Loader is a plugin system. The host application is like a browser, but instead of load web pages, it load plugi

Tu Yimin 1.4k Dec 28, 2022
Nucleus is an Android library, which utilizes the Model-View-Presenter pattern to properly connect background tasks with visual parts of an application.

Nucleus Deprecation notice Nucleus is not under develpment anymore. It turns out that Redux architecture scales way better than MVP/MVI/MVVM/MVxxx and

Konstantin Mikheev 2k Nov 18, 2022
LiteOrm is a fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line of code efficiently.

#LiteOrm:Android高性能数据库框架 A fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line

马天宇 1.5k Nov 19, 2022
🚀Plugin for Android Studio And IntelliJ Idea to generate Kotlin data class code from JSON text ( Json to Kotlin )

JsonToKotlinClass Hi, Welcome! This is a plugin to generate Kotlin data class from JSON string, in another word, a plugin that converts JSON string to

Seal 2.8k Jan 3, 2023
Rosie is an Android framework to create applications following the principles of Clean Architecture.

Rosie The only way to make the deadline—the only way to go fast—is to keep the code as clean as possible at all times. — Robert C. Martin in Clean Cod

Karumi 1.8k Dec 28, 2022
Create kotlin android project with one line of command.

README This is an android application template project built with kotlin language and some useful libraries. It provides a creator script to quickly c

nekocode 1.6k Dec 20, 2022
Moxy is MVP library for Android

Moxy This Moxy repository is deprecated and no longer supported. Please migrate to the actual version of the Moxy framework at Moxy communuty repo. De

Arello Mobile 1.6k Dec 28, 2022
A data-binding Presentation Model(MVVM) framework for the Android platform.

PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED. As personal time contraints, I am currently unable to keep up. Please use official android da

RoboBinding open source 1.3k Dec 9, 2022
Minimal UI library for Android inspired by React

Anvil - reactive views for Android Anvil is a small Java library for creating reactive user interfaces. Originally inspired by React, it suits well as

null 1.4k Dec 23, 2022
A full-featured framework that allows building android applications following the principles of Clean Architecture.

EasyMVP A powerful, and very simple MVP library with annotation processing and bytecode weaving. EasyMVP eliminates the boilerplate code for dealing w

null 1.3k Nov 19, 2022
a MVP library for Android favoring a stateful Presenter

DEPRECATED - no longer actively maintained ThirtyInch - a MVP library for Android This library adds Presenters to Activities and Fragments. It favors

HCI @ gcx 1k Dec 15, 2022