// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java
// public class Logger {
// 
//     private static final String TAG = "Surveyor";
// 
//     public static void e(String message, Throwable t) {
//         Log.e(TAG, message, t);
//     }
// 
//     public static void w(String message) {
//         Log.w(TAG, message);
//     }
// 
//     public static void d(String message) {
//         Log.d(TAG, message);
//     }
// }
// 
// Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java
// public class IconTextView extends TextView {
//     public IconTextView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//         setTypeface(Typefaces.get(getContext(), "material.ttf"));
//     }
// 
//     public void setIconColor(int color) {
//         setTextColor(getResources().getColor(color));
//     }
// }


import android.Manifest;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationServices;
import com.greysonparrelli.permiso.Permiso;
import io.rapidpro.surveyor.Logger;
import io.rapidpro.surveyor.R;
import io.rapidpro.surveyor.ui.IconTextView;

    @Override
    public boolean requireLogin() {
        return false;
    }

    @Override
    public void onPause() {
        super.onPause();

        stopLocationUpdates();
    }

    protected void connectGoogleApi() {
        googleApiClient = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(LocationServices.API)
                .build();

        googleApiClient.connect();
    }

    /**
     * Start receiving location updates
     */
    @SuppressWarnings("ResourceType")
    private void startLocationUpdates() {
        Logger.d("Starting location updates...");

// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java
// public class Logger {
// 
//     private static final String TAG = "Surveyor";
// 
//     public static void e(String message, Throwable t) {
//         Log.e(TAG, message, t);
//     }
// 
//     public static void w(String message) {
//         Log.w(TAG, message);
//     }
// 
//     public static void d(String message) {
//         Log.d(TAG, message);
//     }
// }
// 
// Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java
// public class IconTextView extends TextView {
//     public IconTextView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//         setTypeface(Typefaces.get(getContext(), "material.ttf"));
//     }
// 
//     public void setIconColor(int color) {
//         setTextColor(getResources().getColor(color));
//     }
// }


// Path: app/src/main/java/io/rapidpro/surveyor/activity/CaptureLocationActivity.java
import android.Manifest;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationServices;
import com.greysonparrelli.permiso.Permiso;
import io.rapidpro.surveyor.Logger;
import io.rapidpro.surveyor.R;
import io.rapidpro.surveyor.ui.IconTextView;


    @Override
    public boolean requireLogin() {
        return false;
    }

    @Override
    public void onPause() {
        super.onPause();

        stopLocationUpdates();
    }

    protected void connectGoogleApi() {
        googleApiClient = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(LocationServices.API)
                .build();

        googleApiClient.connect();
    }

    /**
     * Start receiving location updates
     */
    @SuppressWarnings("ResourceType")
    private void startLocationUpdates() {
        Logger.d("Starting location updates...");

        IconTextView button = (IconTextView) getViewCache().getView(R.id.button_capture);