// Path: app/src/main/java/org/xdty/gallery/utils/OkHttp.java
// public class OkHttp {
//     private OkHttpClient.Builder mOkHttpBuilder;
// 
//     private OkHttp() {
//         HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
//         loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.NONE);
// 
//         Interceptor interceptor = new Interceptor() {
//             @Override
//             public Response intercept(Chain chain) throws IOException {
//                 Request request = chain.request();
//                 HttpUrl url = request.url()
//                         .newBuilder()
//                         //.addQueryParameter("timestamp",
//                         //        Long.toString(System.currentTimeMillis() / 1000 / 60))
//                         .build();
//                 request = request.newBuilder().url(url).build();
//                 return chain.proceed(request);
//             }
//         };
// 
//         mOkHttpBuilder = new OkHttpClient.Builder()
//                 .addInterceptor(loggingInterceptor)
//                 .addInterceptor(interceptor);
//     }
// 
//     public static OkHttp getInstance() {
//         return SingletonHelper.INSTANCE;
//     }
// 
//     public void addNetworkInterceptor(Interceptor interceptor) {
//         mOkHttpBuilder.addNetworkInterceptor(interceptor);
//     }
// 
//     public OkHttpClient client() {
//         OkHttpClient client = mOkHttpBuilder.build();
//         org.xdty.http.OkHttp.getInstance().setClient(client);
//         return client;
//     }
// 
//     private static class SingletonHelper {
//         private final static OkHttp INSTANCE = new OkHttp();
//     }
// }


import android.os.StrictMode;
import com.facebook.stetho.Stetho;
import com.facebook.stetho.okhttp3.StethoInterceptor;
import org.xdty.gallery.utils.OkHttp;
import io.reactivex.Completable;
package org.xdty.gallery.application;





public class DebugApplication extends Application {
    private final static String TAG = DebugApplication.class.getSimpleName();

    @Override
    public void onCreate() {

        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                .detectAll()
                .penaltyLog()
                .build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectLeakedSqlLiteObjects()
                .detectLeakedClosableObjects()
                .penaltyLog()
                //.penaltyDeath()
                .build());

        Completable.fromRunnable(() ->
                Stetho.initialize(Stetho.newInitializerBuilder(DebugApplication.this)
                        .enableDumpapp(
                                Stetho.defaultDumperPluginsProvider(DebugApplication.this))
                        .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(
                                DebugApplication.this))
                        .build())
        ).subscribe();

// Path: app/src/main/java/org/xdty/gallery/utils/OkHttp.java
// public class OkHttp {
//     private OkHttpClient.Builder mOkHttpBuilder;
// 
//     private OkHttp() {
//         HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
//         loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.NONE);
// 
//         Interceptor interceptor = new Interceptor() {
//             @Override
//             public Response intercept(Chain chain) throws IOException {
//                 Request request = chain.request();
//                 HttpUrl url = request.url()
//                         .newBuilder()
//                         //.addQueryParameter("timestamp",
//                         //        Long.toString(System.currentTimeMillis() / 1000 / 60))
//                         .build();
//                 request = request.newBuilder().url(url).build();
//                 return chain.proceed(request);
//             }
//         };
// 
//         mOkHttpBuilder = new OkHttpClient.Builder()
//                 .addInterceptor(loggingInterceptor)
//                 .addInterceptor(interceptor);
//     }
// 
//     public static OkHttp getInstance() {
//         return SingletonHelper.INSTANCE;
//     }
// 
//     public void addNetworkInterceptor(Interceptor interceptor) {
//         mOkHttpBuilder.addNetworkInterceptor(interceptor);
//     }
// 
//     public OkHttpClient client() {
//         OkHttpClient client = mOkHttpBuilder.build();
//         org.xdty.http.OkHttp.getInstance().setClient(client);
//         return client;
//     }
// 
//     private static class SingletonHelper {
//         private final static OkHttp INSTANCE = new OkHttp();
//     }
// }


// Path: app/src/debug/java/org/xdty/gallery/application/DebugApplication.java
import android.os.StrictMode;
import com.facebook.stetho.Stetho;
import com.facebook.stetho.okhttp3.StethoInterceptor;
import org.xdty.gallery.utils.OkHttp;
import io.reactivex.Completable;

package org.xdty.gallery.application;





public class DebugApplication extends Application {
    private final static String TAG = DebugApplication.class.getSimpleName();

    @Override
    public void onCreate() {

        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                .detectAll()
                .penaltyLog()
                .build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectLeakedSqlLiteObjects()
                .detectLeakedClosableObjects()
                .penaltyLog()
                //.penaltyDeath()
                .build());

        Completable.fromRunnable(() ->
                Stetho.initialize(Stetho.newInitializerBuilder(DebugApplication.this)
                        .enableDumpapp(
                                Stetho.defaultDumperPluginsProvider(DebugApplication.this))
                        .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(
                                DebugApplication.this))
                        .build())
        ).subscribe();

        OkHttp.getInstance().addNetworkInterceptor(new StethoInterceptor());