EasyNetwork

Additional

Language
Java
Version
N/A
Created
Oct 7, 2016
Updated
Jul 27, 2020 (Retired)
Owner
Andrii Konovalenko (jaksab)
Contributors
Andrii Konovalenko (jaksab)
Phuong TRAN (tvpsoft)
killvetrov
3
Activity
Badge
Generate
Download
Source code

EasyNetwork

EasyNetwork - is powerful and easy-to-use http library for Android.
Wiki - Development guidelines

Download

dependencies {
    compile 'pro.oncreate.easynet:easynet:1.4.2'
}

Usage

Make simple request by means of Request and start execution:

   EasyNet.get("users", id)
                .addHeader("Accept", "application/json")
                .start(new NCallback() {
                    @Override
                    public void onSuccess(NResponseModel responseModel) {
                        
                    }
                });
                

Primary configuration example (with EasyNet instance):

public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        EasyNet.getInstance()
        .setWriteLogs(true) // Default
        .setDefaultNBuilderListener(new EasyNet.NBuilderDefaultListener() {
            @Override
            public Request defaultConfig(Request request) {
                return request
                        .setHost("https://example.com/api")
                        .addHeader("Accept-Language", Locale.getDefault().toString());
            }
        })
       .addOnErrorDefaultListener(new EasyNet.OnErrorDefaultListenerWithCode(404) {
            @Override
            public void onError(NResponseModel responseModel) {
                 // For example, intercepted error 404
            }
        });
    }
}

See more examples: Wiki

Features

  • Functional "from the box": without mandatory primary configuration, anywhere in the code, functionally and simply.
  • Integration with Gson library.
  • There is a flexible functionality for hiding\showing\disabled the views, progress dialogs, swipeRefresh layout when the query is executed. More
  • Visual logs.
  • Controll the tasks exucution: cancel all tasks, cancel task by tag and other. More
  • The ability to intercept the results of a request with certain parameters.
  • Separation of errors into: error (server) and failed (connection). More
  • Handling the redirects.
  • Cache responses. – Make test requests without backend for first stages of development New

License

MIT License

Copyright (c) 2016-2018 Andrii Konovalenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.