package tw.idv.laiis.ezretrofitdemo;

import android.app.Application;

import java.net.CookieManager;

import tw.idv.laiis.ezretrofit.EZRetrofit;
import tw.idv.laiis.ezretrofit.RetrofitConf;

/**
 * Created by laiis on 2017/4/30.
 */

public class EZRetrofitApp extends Application {

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

    private void initialEZRetrofit() {
        // I want to use this pattern to call api.
        EZRetrofit.initial(new RetrofitConf.Builder(this)
                .setCookieHandler(CookieManager.getDefault())
                .timeout(15L)
                .baseUrls(JsonWebservice.class, "http://data.taipei/")
                .build());
    }
}

@@ -278,16 +278,167 @@
 tion %7B%0A%0A
+    private static volatile EZRetrofitApp sEZRetrofitApp;%0A%0A    private static EZRetrofitApp getEZRetrofitApp() %7B%0A        return sEZRetrofitApp;%0A    %7D%0A%0A
     @Ove
@@ -443,16 +443,16 @@
 verride%0A
-
     publ
@@ -494,24 +494,55 @@
 onCreate();%0A
+        sEZRetrofitApp = this;%0A
         init
@@ -570,22 +570,28 @@
 %7D%0A%0A    p
-rivate
+ublic static
  void in
@@ -713,20 +713,34 @@
 Builder(
-this
+getEZRetrofitApp()
 )%0A      

update demo