Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 854 Bytes

README.md

File metadata and controls

36 lines (30 loc) · 854 Bytes

retrofit-plus

function

ErrorPolicyCallback - retrofit common error handling for restful API

api = retrofit.create(GreetingApi.class);
api.getGreeting().enqueue(new ErrorPolicyCallback<GreetingResponse>(
        ErrorPolicy.createDialog(MainActivity.this),
        ErrorPolicy.createDialog(MainActivity.this)
) {
    @Override
    public void onSuccessfulStatus(Call<GreetingResponse> call, GreetingResponse response) {
        String greeting = response.greeting + " " + response.name + " at " + new Date();

        textView.setText(greeting);
    }
});

ViewType of ErrorPolicy

public enum ViewType {
    TOAST,
    SNACKBAR,
    DIALOG,
    INVIEW
}

Gradle

compile 'com.purestation:retrofit-plus:0.0.1'