<commit_before>package com.strengthcoach.strengthcoach.activities;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.BounceInterpolator;
import android.widget.Toast;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CameraPosition;
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.parse.FindCallback;
import com.parse.ParseGeoPoint;
import com.parse.ParseQuery;
import com.pnikosis.materialishprogress.ProgressWheel;
import com.strengthcoach.strengthcoach.R;
import com.strengthcoach.strengthcoach.models.Gym;

import java.util.List;

public class MapActivity extends ActionBarActivity {

    GoogleMap m_map;
    // Location of 24 hour fitness gym
    // Hardcoding to fix the zoom point
    double latitude = 37.404324;
    double longitude = -122.108046;
    final LatLng point = new LatLng(latitude, longitude);
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);
        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().setNavigationBarColor(getResources().getColor(R.color.navigationBarColor));
        }

        SupportMapFragment mapFragment = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map));
        final ProgressWheel progressWheel = (ProgressWheel) findViewById(R.id.progress_wheel);

        if (mapFragment != null) {
            mapFragment.getMapAsync(new OnMapReadyCallback() {
                @Override
                public void onMapReady(GoogleMap map) {
                    m_map = map;

                    m_map.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
                        @Override
                        public void onInfoWindowClick(Marker marker) {
                            // TODO: pass gym information to main activity to show trainers only from there
                            String title = marker.getTitle();
                            String gymName = title.substring(0, title.indexOf("(") - 1);
                            Intent intent = new Intent();
                            intent.putExtra("gymName", gymName);
                            setResult(RESULT_OK, intent);
                            finish();
                            overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
                        }
                    });

                    // Start zoom
                    CameraPosition cameraPosition = new CameraPosition.Builder()
                            .target(point)      // Sets the center of the map to Mountain View
                            .zoom(14)                   // Sets the zoom
                            .tilt(45)
                            .build();                   // Creates a CameraPosition from the builder
                    m_map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), new GoogleMap.CancelableCallback() {
                        @Override
                        public void onFinish() {
                            progressWheel.setVisibility(View.VISIBLE);
                            ParseQuery<Gym> query = ParseQuery.getQuery("Gym");
                            query.include("address");
                            query.include("trainers");
                            query.findInBackground(new FindCallback<Gym>() {
                                public void done(List<Gym> gyms, com.parse.ParseException e) {
                                    progressWheel.setVisibility(View.INVISIBLE);
                                    for (int i = 0; i < gyms.size(); i++) {

                                        int count = gyms.get(i).getTrainers().size();

                                        // Extract content from alert dialog
                                        String title = gyms.get(i).getName() + " (" + count + " trainers)";
                                        String snippet = gyms.get(i).getAddress().toString();
                                        ParseGeoPoint parseGeoPoint = gyms.get(i).point();
                                        LatLng point = new LatLng(parseGeoPoint.getLatitude(), parseGeoPoint.getLongitude());


                                        Bitmap icon = null;
                                        icon = drawTextToBitmap(getBaseContext(), R.drawable.pin_map, String.valueOf(count));

                                        // Creates and adds marker to the map
                                        Marker marker = m_map.addMarker(new MarkerOptions()
                                                .position(point)
                                                .title(title)
                                                .snippet(snippet)
                                                .icon(BitmapDescriptorFactory.fromBitmap(icon)));

                                        // Make the markers drop and bounce
                                        dropPinEffect(marker);
                                    }

                                }
                            });

                        }

                        @Override
                        public void onCancel() {

                        }
                    });
                }
            });
        } else {
            Toast.makeText(this, "Error - Map Fragment was null!!", Toast.LENGTH_SHORT).show();<commit_msg>Temporarily disabling the error message: at times  you see the error message in maps activity even if the maps load fine. Doing this for the sake of demo<commit_after>package com.strengthcoach.strengthcoach.activities;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.BounceInterpolator;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CameraPosition;
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.parse.FindCallback;
import com.parse.ParseGeoPoint;
import com.parse.ParseQuery;
import com.pnikosis.materialishprogress.ProgressWheel;
import com.strengthcoach.strengthcoach.R;
import com.strengthcoach.strengthcoach.models.Gym;

import java.util.List;

public class MapActivity extends ActionBarActivity {

    GoogleMap m_map;
    // Location of 24 hour fitness gym
    // Hardcoding to fix the zoom point
    double latitude = 37.404324;
    double longitude = -122.108046;
    final LatLng point = new LatLng(latitude, longitude);
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);
        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().setNavigationBarColor(getResources().getColor(R.color.navigationBarColor));
        }

        SupportMapFragment mapFragment = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map));
        final ProgressWheel progressWheel = (ProgressWheel) findViewById(R.id.progress_wheel);

        if (mapFragment != null) {
            mapFragment.getMapAsync(new OnMapReadyCallback() {
                @Override
                public void onMapReady(GoogleMap map) {
                    m_map = map;

                    m_map.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
                        @Override
                        public void onInfoWindowClick(Marker marker) {
                            // TODO: pass gym information to main activity to show trainers only from there
                            String title = marker.getTitle();
                            String gymName = title.substring(0, title.indexOf("(") - 1);
                            Intent intent = new Intent();
                            intent.putExtra("gymName", gymName);
                            setResult(RESULT_OK, intent);
                            finish();
                            overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
                        }
                    });

                    // Start zoom
                    CameraPosition cameraPosition = new CameraPosition.Builder()
                            .target(point)      // Sets the center of the map to Mountain View
                            .zoom(14)                   // Sets the zoom
                            .tilt(45)
                            .build();                   // Creates a CameraPosition from the builder
                    m_map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), new GoogleMap.CancelableCallback() {
                        @Override
                        public void onFinish() {
                            progressWheel.setVisibility(View.VISIBLE);
                            ParseQuery<Gym> query = ParseQuery.getQuery("Gym");
                            query.include("address");
                            query.include("trainers");
                            query.findInBackground(new FindCallback<Gym>() {
                                public void done(List<Gym> gyms, com.parse.ParseException e) {
                                    progressWheel.setVisibility(View.INVISIBLE);
                                    for (int i = 0; i < gyms.size(); i++) {

                                        int count = gyms.get(i).getTrainers().size();

                                        // Extract content from alert dialog
                                        String title = gyms.get(i).getName() + " (" + count + " trainers)";
                                        String snippet = gyms.get(i).getAddress().toString();
                                        ParseGeoPoint parseGeoPoint = gyms.get(i).point();
                                        LatLng point = new LatLng(parseGeoPoint.getLatitude(), parseGeoPoint.getLongitude());


                                        Bitmap icon = null;
                                        icon = drawTextToBitmap(getBaseContext(), R.drawable.pin_map, String.valueOf(count));

                                        // Creates and adds marker to the map
                                        Marker marker = m_map.addMarker(new MarkerOptions()
                                                .position(point)
                                                .title(title)
                                                .snippet(snippet)
                                                .icon(BitmapDescriptorFactory.fromBitmap(icon)));

                                        // Make the markers drop and bounce
                                        dropPinEffect(marker);
                                    }

                                }
                            });

                        }

                        @Override
                        public void onCancel() {

                        }
                    });
                }
            });
        } else {
            //Toast.makeText(this, "Error - Map Fragment was null!!", Toast.LENGTH_SHORT).show();
{'fraction_non_alphanumeric': 0.08459427675421403, 'fraction_numerical': 0.004233633869070953, 'mean_word_length': 1.5120126033871604, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 58, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5664601', 'n_tokens_mistral': 3009, 'n_tokens_neox': 2828, 'n_words': 612}