// Path: app/src/prod/java/com/iph/directly/domain/Injector.java
// public class Injector {
//     public static LocationRepository provideLocationRepository(Fragment fragment, Activity activity, int requestCode) {
//         return new LocationRepositoryImpl(fragment, activity, requestCode);
//     }
// 
//     public static ToiletRepository provideToiletRepository(Activity activity) {
//         return new ToiletRepositoryImpl(activity);
//     }
// 
//     public static DirectionRepository provideDirectionRepository(Context activity) {
//         return new DirectionRepositoryImpl(activity);
//     }
// 
//     public static DeviceInfo provideDeviceInfo(Context context) {
//         return new DeviceInfoImpl(context);
//     }
// 
//     public static StrikeRepository provideStrikeRepository() {
//         return new StrikeRepositoryImpl();
//     }
// 
//     public static FeedbackRepository provideFeedbackRepository(){
//         return new FeedbackRepositoryImpl();
//     }
// }
// 
// Path: app/src/main/java/com/iph/directly/domain/model/Location.java
// public class Location implements Parcelable{
//     private LatLng latLng;
// 
//     private String city;
//     private String country;
//     private String street;
//     private String buildingNumber;
// 
//     public Location(double latitude, double longitude, String city, String country) {
//         this.latLng = new LatLng(latitude, longitude);
//         this.city = city;
//         this.country = country;
//     }
// 
//     public Location(double latitude, double longitude, String city, String country, String street, String buildingNumber) {
//         this.latLng = new LatLng(latitude, longitude);
//         this.city = city;
//         this.country = country;
//         this.street = street;
//         this.buildingNumber = buildingNumber;
//     }
// 
//     protected Location(Parcel in) {
//         latLng = in.readParcelable(LatLng.class.getClassLoader());
//         city = in.readString();
//         country = in.readString();
//         this.street = in.readString();
//         this.buildingNumber = in.readString();
//     }
// 
//     public static final Creator<Location> CREATOR = new Creator<Location>() {
//         @Override
//         public Location createFromParcel(Parcel in) {
//             return new Location(in);
//         }
// 
//         @Override
//         public Location[] newArray(int size) {
//             return new Location[size];
//         }
//     };
// 
//     public LatLng getLatLng() {
//         return latLng;
//     }
// 
//     public void setLatLng(LatLng latLng) {
//         this.latLng = latLng;
//     }
// 
//     public String getCity() {
//         return city;
//     }
// 
//     public void setCity(String city) {
//         this.city = city;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeParcelable(latLng, flags);
//         dest.writeString(city);
//         dest.writeString(country);
//         dest.writeString(street);
//         dest.writeString(buildingNumber);
//     }
// 
//     public String getCountry() {
//         return country;
//     }
// 
//     public void setCountry(String country) {
//         this.country = country;
//     }
// 
//     public String getStreet() {
//         return street;
//     }
// 
//     public String getBuildingNumber() {
//         return buildingNumber;
//     }
// }
// 
// Path: app/src/main/java/com/iph/directly/presenter/LoadingPresenter.java
// public class LoadingPresenter {
//     private LoadingView loadingView;
// 
//     private LocationRepository locationRepository;
// 
//     private Subscription currentSubscription;
// 
//     public LoadingPresenter(LoadingView loadingView, LocationRepository locationRepository) {
//         this.loadingView = loadingView;
//         this.locationRepository = locationRepository;
//     }
// 
//     public void start() {
//         loadingView.showProgress();
//         currentSubscription = locationRepository.getCurrentLocation().subscribe(location -> {
//             loadingView.navigateToToilets(location);
//         }, throwable -> {
//             if (throwable instanceof SecurityException) {
//                 loadingView.showRequestLocationPermission();
//             } else {
//                 Timber.e(throwable, throwable.getMessage());
//             }
//         });
//     }
// 
//     public void stop() {
//         if (currentSubscription != null) {
//             currentSubscription.unsubscribe();
//             currentSubscription = null;
//         }
//     }
// 
//     public void locationPermissionSuccess() {
//         start();
//     }
// 
//     public void locationPermissionFailed() {
//         loadingView.navigateToToilets(null);
//     }
// 
//     public void locationEnabledSuccess() {
//         start();
//     }
// 
//     public void locationEnabledFailed() {
//         loadingView.navigateToToilets(null);
//     }
// }
// 
// Path: app/src/main/java/com/iph/directly/view/LoadingView.java
// public interface LoadingView {
//     void showProgress();
// 
//     void navigateToToilets(Location location);
// 
//     void showRequestLocationPermission();
// }


import android.Manifest;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.directly.iph.directly.R;
import com.google.android.gms.common.api.Status;
import com.iph.directly.domain.Injector;
import com.iph.directly.domain.model.Location;
import com.iph.directly.presenter.LoadingPresenter;
import com.iph.directly.view.LoadingView;
import timber.log.Timber;
package com.iph.directly.fragment;




/**
 * Created by vanya on 10/8/2016.
 */

public class LoadingFragment extends Fragment implements LoadingView {
    private static final int LOCATION_PERMISSION_REQUEST_CODE = 1001;
    private static final int LOCATION_ENABLE_REQUEST_CODE = 1002;
// Path: app/src/prod/java/com/iph/directly/domain/Injector.java
// public class Injector {
//     public static LocationRepository provideLocationRepository(Fragment fragment, Activity activity, int requestCode) {
//         return new LocationRepositoryImpl(fragment, activity, requestCode);
//     }
// 
//     public static ToiletRepository provideToiletRepository(Activity activity) {
//         return new ToiletRepositoryImpl(activity);
//     }
// 
//     public static DirectionRepository provideDirectionRepository(Context activity) {
//         return new DirectionRepositoryImpl(activity);
//     }
// 
//     public static DeviceInfo provideDeviceInfo(Context context) {
//         return new DeviceInfoImpl(context);
//     }
// 
//     public static StrikeRepository provideStrikeRepository() {
//         return new StrikeRepositoryImpl();
//     }
// 
//     public static FeedbackRepository provideFeedbackRepository(){
//         return new FeedbackRepositoryImpl();
//     }
// }
// 
// Path: app/src/main/java/com/iph/directly/domain/model/Location.java
// public class Location implements Parcelable{
//     private LatLng latLng;
// 
//     private String city;
//     private String country;
//     private String street;
//     private String buildingNumber;
// 
//     public Location(double latitude, double longitude, String city, String country) {
//         this.latLng = new LatLng(latitude, longitude);
//         this.city = city;
//         this.country = country;
//     }
// 
//     public Location(double latitude, double longitude, String city, String country, String street, String buildingNumber) {
//         this.latLng = new LatLng(latitude, longitude);
//         this.city = city;
//         this.country = country;
//         this.street = street;
//         this.buildingNumber = buildingNumber;
//     }
// 
//     protected Location(Parcel in) {
//         latLng = in.readParcelable(LatLng.class.getClassLoader());
//         city = in.readString();
//         country = in.readString();
//         this.street = in.readString();
//         this.buildingNumber = in.readString();
//     }
// 
//     public static final Creator<Location> CREATOR = new Creator<Location>() {
//         @Override
//         public Location createFromParcel(Parcel in) {
//             return new Location(in);
//         }
// 
//         @Override
//         public Location[] newArray(int size) {
//             return new Location[size];
//         }
//     };
// 
//     public LatLng getLatLng() {
//         return latLng;
//     }
// 
//     public void setLatLng(LatLng latLng) {
//         this.latLng = latLng;
//     }
// 
//     public String getCity() {
//         return city;
//     }
// 
//     public void setCity(String city) {
//         this.city = city;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeParcelable(latLng, flags);
//         dest.writeString(city);
//         dest.writeString(country);
//         dest.writeString(street);
//         dest.writeString(buildingNumber);
//     }
// 
//     public String getCountry() {
//         return country;
//     }
// 
//     public void setCountry(String country) {
//         this.country = country;
//     }
// 
//     public String getStreet() {
//         return street;
//     }
// 
//     public String getBuildingNumber() {
//         return buildingNumber;
//     }
// }
// 
// Path: app/src/main/java/com/iph/directly/presenter/LoadingPresenter.java
// public class LoadingPresenter {
//     private LoadingView loadingView;
// 
//     private LocationRepository locationRepository;
// 
//     private Subscription currentSubscription;
// 
//     public LoadingPresenter(LoadingView loadingView, LocationRepository locationRepository) {
//         this.loadingView = loadingView;
//         this.locationRepository = locationRepository;
//     }
// 
//     public void start() {
//         loadingView.showProgress();
//         currentSubscription = locationRepository.getCurrentLocation().subscribe(location -> {
//             loadingView.navigateToToilets(location);
//         }, throwable -> {
//             if (throwable instanceof SecurityException) {
//                 loadingView.showRequestLocationPermission();
//             } else {
//                 Timber.e(throwable, throwable.getMessage());
//             }
//         });
//     }
// 
//     public void stop() {
//         if (currentSubscription != null) {
//             currentSubscription.unsubscribe();
//             currentSubscription = null;
//         }
//     }
// 
//     public void locationPermissionSuccess() {
//         start();
//     }
// 
//     public void locationPermissionFailed() {
//         loadingView.navigateToToilets(null);
//     }
// 
//     public void locationEnabledSuccess() {
//         start();
//     }
// 
//     public void locationEnabledFailed() {
//         loadingView.navigateToToilets(null);
//     }
// }
// 
// Path: app/src/main/java/com/iph/directly/view/LoadingView.java
// public interface LoadingView {
//     void showProgress();
// 
//     void navigateToToilets(Location location);
// 
//     void showRequestLocationPermission();
// }


// Path: app/src/main/java/com/iph/directly/fragment/LoadingFragment.java
import android.Manifest;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.directly.iph.directly.R;
import com.google.android.gms.common.api.Status;
import com.iph.directly.domain.Injector;
import com.iph.directly.domain.model.Location;
import com.iph.directly.presenter.LoadingPresenter;
import com.iph.directly.view.LoadingView;
import timber.log.Timber;

package com.iph.directly.fragment;




/**
 * Created by vanya on 10/8/2016.
 */

public class LoadingFragment extends Fragment implements LoadingView {
    private static final int LOCATION_PERMISSION_REQUEST_CODE = 1001;
    private static final int LOCATION_ENABLE_REQUEST_CODE = 1002;
    private LoadingPresenter loadingPresenter;