// Path: MyApplication/app/src/main/java/com/example/mikhail_sianko/myapplication/data/api/ApiManager.java
// public class ApiManager {
// 
//     public static final String APP_ENGINE_BASE_URL = "http://10.0.2.2:8080/_ah/api/";
// 
//     private static ApiManager sInstance;
//     private TrainingApi appEngineApi;
// 
//     public static ApiManager get() {
//         if (sInstance == null) {
//             sInstance = new ApiManager();
//         }
//         return sInstance;
//     }
// 
//     private ApiManager() {
//     }
// 
//     public TrainingApi trainingsApi() {
//         if (appEngineApi == null) {
//             TrainingApi.Builder builder = new TrainingApi.Builder(AndroidHttp.newCompatibleTransport(),
//                     JacksonFactory.getDefaultInstance(), null)
//                     .setApplicationName(BuildConfig.APPLICATION_ID)
//                     .setRootUrl(APP_ENGINE_BASE_URL)
//                     .setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
//                         @Override
//                         public void initialize(AbstractGoogleClientRequest<?> abstractGoogleClientRequest) throws IOException {
//                             abstractGoogleClientRequest.setDisableGZipContent(true);
//                         }
//                     });
//             appEngineApi = builder.build();
//         }
//         return appEngineApi;
//     }
// }


import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.util.Log;
import com.example.mikhail_sianko.myapplication.data.api.ApiManager;
import com.training2016.backend.trainingApi.TrainingApi;
import com.training2016.backend.trainingApi.model.DataBean;
import java.io.IOException;
import static android.content.ContentValues.TAG;
package com.example.mikhail_sianko.myapplication.ui;






public class MainPresenter implements Contract.Presenter {

    private Contract.View view;
    private Handler handler;

    public MainPresenter(@NonNull Contract.View view) {
        this.view = view;
        handler = new Handler(Looper.getMainLooper());
    }

    @Override
    public void onReady() {
        view.showProgress(true);
        loadData();
    }

    private void loadData() {

        new Thread() {
            @Override
            public void run() {

                try {
// Path: MyApplication/app/src/main/java/com/example/mikhail_sianko/myapplication/data/api/ApiManager.java
// public class ApiManager {
// 
//     public static final String APP_ENGINE_BASE_URL = "http://10.0.2.2:8080/_ah/api/";
// 
//     private static ApiManager sInstance;
//     private TrainingApi appEngineApi;
// 
//     public static ApiManager get() {
//         if (sInstance == null) {
//             sInstance = new ApiManager();
//         }
//         return sInstance;
//     }
// 
//     private ApiManager() {
//     }
// 
//     public TrainingApi trainingsApi() {
//         if (appEngineApi == null) {
//             TrainingApi.Builder builder = new TrainingApi.Builder(AndroidHttp.newCompatibleTransport(),
//                     JacksonFactory.getDefaultInstance(), null)
//                     .setApplicationName(BuildConfig.APPLICATION_ID)
//                     .setRootUrl(APP_ENGINE_BASE_URL)
//                     .setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
//                         @Override
//                         public void initialize(AbstractGoogleClientRequest<?> abstractGoogleClientRequest) throws IOException {
//                             abstractGoogleClientRequest.setDisableGZipContent(true);
//                         }
//                     });
//             appEngineApi = builder.build();
//         }
//         return appEngineApi;
//     }
// }


// Path: MyApplication/app/src/main/java/com/example/mikhail_sianko/myapplication/ui/MainPresenter.java
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.util.Log;
import com.example.mikhail_sianko.myapplication.data.api.ApiManager;
import com.training2016.backend.trainingApi.TrainingApi;
import com.training2016.backend.trainingApi.model.DataBean;
import java.io.IOException;
import static android.content.ContentValues.TAG;

package com.example.mikhail_sianko.myapplication.ui;






public class MainPresenter implements Contract.Presenter {

    private Contract.View view;
    private Handler handler;

    public MainPresenter(@NonNull Contract.View view) {
        this.view = view;
        handler = new Handler(Looper.getMainLooper());
    }

    @Override
    public void onReady() {
        view.showProgress(true);
        loadData();
    }

    private void loadData() {

        new Thread() {
            @Override
            public void run() {

                try {
                    TrainingApi.GetStats call = ApiManager.get().trainingsApi().getStats();