<commit_before>package gc.david.dfm.ui;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.app.SearchManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Color;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.SearchView;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnInfoWindowClickListener;
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolylineOptions;
import com.google.common.collect.Lists;
import com.inmobi.commons.InMobi;
import com.inmobi.monetization.IMBanner;
import com.inmobi.monetization.IMBannerListener;
import com.inmobi.monetization.IMErrorCode;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.GraphViewSeries;
import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle;
import com.jjoe64.graphview.LineGraphView;
import com.splunk.mint.Mint;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import butterknife.InjectView;
import gc.david.dfm.DFMApplication;
import gc.david.dfm.R;
import gc.david.dfm.adapter.DistanceAdapter;
import gc.david.dfm.adapter.MarkerInfoWindowAdapter;
import gc.david.dfm.adapter.NavigationDrawerItemAdapter;
import gc.david.dfm.map.Haversine;
import gc.david.dfm.map.LocationUtils;
import gc.david.dfm.model.DaoSession;
import gc.david.dfm.model.Distance;
import gc.david.dfm.model.Position;

import static butterknife.ButterKnife.inject;
import static gc.david.dfm.Utils.isOnline;
import static gc.david.dfm.Utils.showAlertDialog;
import static gc.david.dfm.Utils.toastIt;

/**
 * Implements the app main Activity.
 *
 * @author David
 */
public class MainActivity extends ActionBarActivity implements LocationListener,
                                                               GoogleApiClient.ConnectionCallbacks,
                                                               GoogleApiClient.OnConnectionFailedListener {

    private static final int ELEVATION_SAMPLES       = 100;
    private final        int FIRST_DRAWER_ITEM_INDEX = 1;

    @InjectView(R.id.elevationchart)
    protected RelativeLayout rlElevationChart;
    @InjectView(R.id.closeChart)
    protected ImageView      ivCloseElevationChart;

    private GoogleMap       googleMap                             = null;
    // A request to connect to Location Services
    private LocationRequest locationRequest                       = null;
    // Stores the current instantiation of the location client in this object
    private GoogleApiClient googleApiClient                       = null;
    private Location        currentLocation                       = null;
    // Moves to current position if app has just started
    private boolean         appHasJustStarted                     = true;
    private String          distanceMeasuredAsText                = "";
    private MenuItem        searchMenuItem                        = null;
    // Show position if we come from other app (p.e. Whatsapp)
    private boolean         mustShowPositionWhenComingFromOutside = false;
    private LatLng          sendDestinationPosition               = null;
    private IMBanner        banner                                = null;
    private boolean         bannerShown                           = false;
    private boolean         elevationChartShown                   = false;
    @SuppressWarnings("rawtypes")
    private AsyncTask       showingElevationTask                  = null;
    private GraphView       graphView                             = null;
    private float                 DEVICE_DENSITY;
    private ActionBarDrawerToggle actionBarDrawerToggle;
    private DrawerLayout          drawerLayout;
    private ListView              drawerList;
    private DistanceMode          distanceMode;
    private List<LatLng>          coordinates;
    private boolean               calculatingDistance;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Mint.initAndStartSession(MainActivity.this, "6f2149e6");
        // Enable logging
        Mint.enableLogging(true);

        setContentView(R.layout.activity_main);
        inject(this);

        DEVICE_DENSITY = getResources().getDisplayMetrics().density;

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

        final SupportMapFragment fragment = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map));
        googleMap = fragment.getMap();

        if (googleMap != null) {
            googleMap.setMyLocationEnabled(true);
            googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
<commit_msg>Re-enabling map zoom buttons<commit_after>package gc.david.dfm.ui;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.app.SearchManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Color;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.SearchView;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnInfoWindowClickListener;
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolylineOptions;
import com.google.common.collect.Lists;
import com.inmobi.commons.InMobi;
import com.inmobi.monetization.IMBanner;
import com.inmobi.monetization.IMBannerListener;
import com.inmobi.monetization.IMErrorCode;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.GraphViewSeries;
import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle;
import com.jjoe64.graphview.LineGraphView;
import com.splunk.mint.Mint;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import butterknife.InjectView;
import gc.david.dfm.DFMApplication;
import gc.david.dfm.R;
import gc.david.dfm.adapter.DistanceAdapter;
import gc.david.dfm.adapter.MarkerInfoWindowAdapter;
import gc.david.dfm.adapter.NavigationDrawerItemAdapter;
import gc.david.dfm.map.Haversine;
import gc.david.dfm.map.LocationUtils;
import gc.david.dfm.model.DaoSession;
import gc.david.dfm.model.Distance;
import gc.david.dfm.model.Position;

import static butterknife.ButterKnife.inject;
import static gc.david.dfm.Utils.isOnline;
import static gc.david.dfm.Utils.showAlertDialog;
import static gc.david.dfm.Utils.toastIt;

/**
 * Implements the app main Activity.
 *
 * @author David
 */
public class MainActivity extends ActionBarActivity implements LocationListener,
                                                               GoogleApiClient.ConnectionCallbacks,
                                                               GoogleApiClient.OnConnectionFailedListener {

    private static final int ELEVATION_SAMPLES       = 100;
    private final        int FIRST_DRAWER_ITEM_INDEX = 1;

    @InjectView(R.id.elevationchart)
    protected RelativeLayout rlElevationChart;
    @InjectView(R.id.closeChart)
    protected ImageView      ivCloseElevationChart;

    private GoogleMap       googleMap                             = null;
    // A request to connect to Location Services
    private LocationRequest locationRequest                       = null;
    // Stores the current instantiation of the location client in this object
    private GoogleApiClient googleApiClient                       = null;
    private Location        currentLocation                       = null;
    // Moves to current position if app has just started
    private boolean         appHasJustStarted                     = true;
    private String          distanceMeasuredAsText                = "";
    private MenuItem        searchMenuItem                        = null;
    // Show position if we come from other app (p.e. Whatsapp)
    private boolean         mustShowPositionWhenComingFromOutside = false;
    private LatLng          sendDestinationPosition               = null;
    private IMBanner        banner                                = null;
    private boolean         bannerShown                           = false;
    private boolean         elevationChartShown                   = false;
    @SuppressWarnings("rawtypes")
    private AsyncTask       showingElevationTask                  = null;
    private GraphView       graphView                             = null;
    private float                 DEVICE_DENSITY;
    private ActionBarDrawerToggle actionBarDrawerToggle;
    private DrawerLayout          drawerLayout;
    private ListView              drawerList;
    private DistanceMode          distanceMode;
    private List<LatLng>          coordinates;
    private boolean               calculatingDistance;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Mint.initAndStartSession(MainActivity.this, "6f2149e6");
        // Enable logging
        Mint.enableLogging(true);

        setContentView(R.layout.activity_main);
        inject(this);

        DEVICE_DENSITY = getResources().getDisplayMetrics().density;

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

        final SupportMapFragment fragment = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map));
        googleMap = fragment.getMap();

        if (googleMap != null) {
            googleMap.setMyLocationEnabled(true);
            googleMap.getUiSettings().setZoomControlsEnabled(true);
            googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);

{'fraction_non_alphanumeric': 0.08029247430502863, 'fraction_numerical': 0.0031730702904049115, 'mean_word_length': 3.018292682926829, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7552575', 'n_tokens_mistral': 3949, 'n_tokens_neox': 3858, 'n_words': 760}