<commit_before>package com.dgaf.happyhour.Model;
import com.dgaf.happyhour.Controller.MyLocationListener;


import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.dgaf.happyhour.DealListType;
import com.dgaf.happyhour.R;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseGeoPoint;
import com.parse.ParseImageView;
import com.parse.ParseQuery;

import java.util.ArrayList;
import java.util.List;


/**
 * Created by trentonrobison on 4/28/15.
 */
public class DealListAdapter extends RecyclerView.Adapter<DealListAdapter.ViewHolder>{
    private Activity activity;
    private ImageLoader imageLoader;
    private List<DealModel> dealItems;
    private ParseGeoPoint parseLocation;
    private MyLocationListener userLocation;


    public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
        public TextView deal;
        public TextView description;
        public TextView distance;
        public TextView restaurant;
        public TextView likes;
        public TextView hours;
        public ParseImageView thumbnail;

        public ViewHolder(View itemView) {
            super(itemView);
            itemView.setOnClickListener(this);
            deal = (TextView) itemView.findViewById(R.id.deal);
            description = (TextView) itemView.findViewById(R.id.description);
            distance = (TextView) itemView.findViewById(R.id.distance);
            restaurant = (TextView) itemView.findViewById(R.id.restaurant);
            likes = (TextView) itemView.findViewById(R.id.likes);
            hours = (TextView) itemView.findViewById(R.id.hours);
            thumbnail = (ParseImageView) itemView.findViewById(R.id.thumb_nal);
            thumbnail.setPlaceholder(ContextCompat.getDrawable(itemView.getContext(), R.drawable.llama));
        }
        @Override
        public void onClick(View v) {
            // Do clicky stuff
        }
    }

    public DealListAdapter(Activity activity, DealListType listType) {
        this.activity = activity;
        this.imageLoader = ImageLoader.getInstance();
        dealItems = new ArrayList<>();

        // Geisel Library
        double latitude = 32.881122;
        double longitude = -117.237631;
        if (!Build.FINGERPRINT.startsWith("generic")) {
            userLocation = new MyLocationListener(activity);
            // Is user location available and are we not running in an emulator
            if (userLocation.canGetLocation()) {
                latitude = userLocation.getLatitude();
                longitude = userLocation.getLongitude();
            } else {
                userLocation.showSettingsAlert();
            }
        }

        double radiusMi = 100.0;
        parseLocation = new ParseGeoPoint(latitude,longitude);

        switch(listType) {
            case DRINK:
                loadLocalDeals(parseLocation, radiusMi);
                break;
            case FOOD:
                loadLocalDeals(parseLocation, radiusMi);
                break;
            case FEATURED:
                loadLocalDeals(parseLocation, radiusMi);
                break;
        }
    }

    public void loadLocalDeals(ParseGeoPoint location, double radiusMi) {
        // Setup the database Query
        ParseQuery<RestaurantModel> localRestaurants = ParseQuery.getQuery(RestaurantModel.class);
        localRestaurants.whereWithinMiles("location", location, radiusMi);
        ParseQuery<DealModel> localDeals = ParseQuery.getQuery(DealModel.class);
        localDeals.whereMatchesQuery("restaurantId", localRestaurants);
        localDeals.include("restaurantId");
        Log.e("Parse info", "Parse query started" );
        final DealListAdapter listAdapter = this;
        localDeals.findInBackground(new FindCallback<DealModel>() {
            public void done(List<DealModel> deals, ParseException e) {
                Log.e("Parse info","Parse query returned");
                if (e == null) {
                    dealItems = deals;
                    //Log.e("Parse info",deals.toString());
                    listAdapter.notifyDataSetChanged();
                } else {
                    Log.e("Parse error: ", e.getMessage());
                }
            }
        });
    }
<commit_msg>Removed unused imports. Cleaned whitespace. Changed logging messages from errors to verbose.<commit_after>package com.dgaf.happyhour.Model;
import com.dgaf.happyhour.Controller.MyLocationListener;


import android.app.Activity;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.dgaf.happyhour.DealListType;
import com.dgaf.happyhour.R;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseGeoPoint;
import com.parse.ParseImageView;
import com.parse.ParseQuery;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by trentonrobison on 4/28/15.
 */
public class DealListAdapter extends RecyclerView.Adapter<DealListAdapter.ViewHolder>{
    private Activity activity;
    private ImageLoader imageLoader;
    private List<DealModel> dealItems;
    private ParseGeoPoint parseLocation;
    private MyLocationListener userLocation;


    public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
        public TextView deal;
        public TextView description;
        public TextView distance;
        public TextView restaurant;
        public TextView likes;
        public TextView hours;
        public ParseImageView thumbnail;

        public ViewHolder(View itemView) {
            super(itemView);
            itemView.setOnClickListener(this);
            deal = (TextView) itemView.findViewById(R.id.deal);
            description = (TextView) itemView.findViewById(R.id.description);
            distance = (TextView) itemView.findViewById(R.id.distance);
            restaurant = (TextView) itemView.findViewById(R.id.restaurant);
            likes = (TextView) itemView.findViewById(R.id.likes);
            hours = (TextView) itemView.findViewById(R.id.hours);
            thumbnail = (ParseImageView) itemView.findViewById(R.id.thumb_nal);
            thumbnail.setPlaceholder(ContextCompat.getDrawable(itemView.getContext(), R.drawable.llama));
        }
        @Override
        public void onClick(View v) {
            // Do clicky stuff
        }
    }

    public DealListAdapter(Activity activity, DealListType listType) {
        this.activity = activity;
        this.imageLoader = ImageLoader.getInstance();
        dealItems = new ArrayList<>();

        // Geisel Library
        double latitude = 32.881122;
        double longitude = -117.237631;
        if (!Build.FINGERPRINT.startsWith("generic")) {
            userLocation = new MyLocationListener(activity);
            // Is user location available and are we not running in an emulator
            if (userLocation.canGetLocation()) {
                latitude = userLocation.getLatitude();
                longitude = userLocation.getLongitude();
            } else {
                userLocation.showSettingsAlert();
            }
        }

        double radiusMi = 100.0;
        parseLocation = new ParseGeoPoint(latitude,longitude);

        switch(listType) {
            case DRINK:
                loadLocalDeals(parseLocation, radiusMi);
                break;
            case FOOD:
                loadLocalDeals(parseLocation, radiusMi);
                break;
            case FEATURED:
                loadLocalDeals(parseLocation, radiusMi);
                break;
        }
    }

    public void loadLocalDeals(ParseGeoPoint location, double radiusMi) {
        // Setup the database Query
        ParseQuery<RestaurantModel> localRestaurants = ParseQuery.getQuery(RestaurantModel.class);
        localRestaurants.whereWithinMiles("location", location, radiusMi);
        ParseQuery<DealModel> localDeals = ParseQuery.getQuery(DealModel.class);
        localDeals.whereMatchesQuery("restaurantId", localRestaurants);
        localDeals.include("restaurantId");
        Log.v("Parse info", "Parse query started" );
        final DealListAdapter listAdapter = this;
        localDeals.findInBackground(new FindCallback<DealModel>() {
            public void done(List<DealModel> deals, ParseException e) {
                Log.v("Parse info","Parse query returned");
                if (e == null) {
                    dealItems = deals;
                    //Log.e("Parse info",deals.toString());
                    listAdapter.notifyDataSetChanged();
                } else {
                    Log.e("Parse error: ", e.getMessage());
                }
            }
        });
    }

{'fraction_non_alphanumeric': 0.09108341323106424, 'fraction_numerical': 0.006391818472355385, 'mean_word_length': 2.5426415094339623, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '7058640', 'n_tokens_mistral': 2571, 'n_tokens_neox': 2410, 'n_words': 527}