<commit_before>package com.github.gfx.hankei_n;

import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;

import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.net.Uri;
import android.os.Bundle;
import android.os.Vibrator;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.InputType;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import butterknife.ButterKnife;
import butterknife.InjectView;
import rx.Observable;
import rx.Observer;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Func1;
import rx.schedulers.Schedulers;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = MainActivity.class.getSimpleName();

    static final float MAP_ZOOM = 14f;

    static final float DEFAULT_RADIUS = 1.5f;

    static final int MARKER_COLOR = 0x00ff66;

    private Geocoder geocoder;

    private Prefs prefs;

    private boolean cameraInitialized = false;

    private GoogleMap map;

    private SingleMarker marker;

    @InjectView(R.id.status)
    TextView statusView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ButterKnife.inject(this);

        geocoder = new Geocoder(this, Locale.JAPAN);
        prefs = new Prefs(this);

        final MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
        assert mapFragment != null;

        map = mapFragment.getMap();
        map.setMyLocationEnabled(true);

        map.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener() {
            @Override
            public void onMyLocationChange(Location location) {
                MainActivity.this.onMyLocationChange(location);
            }
        });
        map.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
            @Override
            public void onMapLongClick(LatLng latLng) {
                MainActivity.this.onMapLongClick(latLng);
            }
        });

        marker = new SingleMarker(map, getRadius(), MARKER_COLOR);

        setAppTitle(getRadius());
    }

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

        final CameraPosition pos = map.getCameraPosition();
        prefs.put("prevLatitude", (float) pos.target.latitude);
        prefs.put("prevLongitude", (float) pos.target.longitude);
        prefs.put("prevCameraZoom", pos.zoom);
        cameraInitialized = false;
    }

    /**
     * Initialize the camera position.
     * (1) initial start -> Does nothing. Changes camera position on onMyLocationChange().
     * (2) resume        -> Starts with the saved position and then moves to my location on onMyLocationChange().
     */
    @Override
    protected void onResume() {
        super.onResume();

        /* marker location */
        final float pointedLatitude = prefs.get("pointedLatitude", 0.0f);
        final float pointedLongitude = prefs.get("pointedLongitude", 0.0f);

        if (pointedLatitude != 0.0f || pointedLongitude != 0.0) {
            updatePoint(new LatLng(pointedLatitude, pointedLongitude));
        }

        /* camera location */
        final float prevLatitude = prefs.get("prevLatitude", 0.0f);
        final float prevLongitude = prefs.get("prevLongitude", 0.0f);

        if (prevLatitude != 0.0f || prevLongitude != 0.0) {
            final float zoom = prefs.get("prevCameraZoom", MAP_ZOOM);
            setMyLocation(prevLatitude, prevLongitude, false, zoom);

            final String addressName = prefs.get("addressName", (String) null);
            if (addressName != null) {
                setStatusText(addressName);
            }
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
<commit_msg>use getMapAsync() because getMap() is deprecated.<commit_after>package com.github.gfx.hankei_n;

import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;

import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.net.Uri;
import android.os.Bundle;
import android.os.Vibrator;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.InputType;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import butterknife.ButterKnife;
import butterknife.InjectView;
import rx.Observable;
import rx.Observer;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Func1;
import rx.schedulers.Schedulers;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = MainActivity.class.getSimpleName();

    static final float MAP_ZOOM = 14f;

    static final float DEFAULT_RADIUS = 1.5f;

    static final int MARKER_COLOR = 0x00ff66;

    private Geocoder geocoder;

    private Prefs prefs;

    private boolean cameraInitialized = false;

    private GoogleMap map;

    private SingleMarker marker;

    @InjectView(R.id.status)
    TextView statusView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ButterKnife.inject(this);

        geocoder = new Geocoder(this, Locale.JAPAN);
        prefs = new Prefs(this);

        setAppTitle(getRadius());

        final MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
        assert mapFragment != null;

        mapFragment.getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(GoogleMap googleMap) {
                map = googleMap;
                map.setMyLocationEnabled(true);

                map.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener() {
                    @Override
                    public void onMyLocationChange(Location location) {
                        MainActivity.this.onMyLocationChange(location);
                    }
                });
                map.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
                    @Override
                    public void onMapLongClick(LatLng latLng) {
                        MainActivity.this.onMapLongClick(latLng);
                    }
                });

                marker = new SingleMarker(map, getRadius(), MARKER_COLOR);

                load();
            }
        });
    }

    /**
     * Initialize the camera position.
     * (1) initial start -> Does nothing. Changes camera position on onMyLocationChange().
     * (2) resume        -> Starts with the saved position and then moves to my location on onMyLocationChange().
     */
    @Override
    protected void onResume() {
        super.onResume();

        if (map != null) {
            load();
        }
    }

    void load() {
        final float pointedLatitude = prefs.get("pointedLatitude", 0.0f);
        final float pointedLongitude = prefs.get("pointedLongitude", 0.0f);

        if (pointedLatitude != 0.0f || pointedLongitude != 0.0) {
            updatePoint(new LatLng(pointedLatitude, pointedLongitude));
        }

        final float prevLatitude = prefs.get("prevLatitude", 0.0f);
        final float prevLongitude = prefs.get("prevLongitude", 0.0f);

        if (prevLatitude != 0.0f || prevLongitude != 0.0) {
            final float zoom = prefs.get("prevCameraZoom", MAP_ZOOM);
            setMyLocation(prevLatitude, prevLongitude, false, zoom);

            final String addressName = prefs.get("addressName", (String) null);
            if (addressName != null) {
                setStatusText(addressName);
            }
        }
    }


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

        final CameraPosition pos = map.getCameraPosition();
        prefs.put("prevLatitude", (float) pos.target.latitude);
        prefs.put("prevLongitude", (float) pos.target.longitude);
        prefs.put("prevCameraZoom", pos.zoom);
        cameraInitialized = false;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

{'fraction_non_alphanumeric': 0.09924920292090919, 'fraction_numerical': 0.006170934896636841, 'mean_word_length': 2.9083601286173635, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3632259', 'n_tokens_mistral': 2847, 'n_tokens_neox': 2718, 'n_words': 591}