Giter Club home page Giter Club logo

androidquickutils's Introduction

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

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(DEVICE_TYPE_KEY, "")
            .add(DEVICE_OS_KEY, "")
            .add(DEVICE_UUID_KEY, "")
            .add(DEVICE_PUSH_TOKEN, "")
            .build();

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

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.

Contributors (graph)

androidquickutils's People

Contributors

cesarferreira avatar luispereira avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.