<commit_before>package rs.elfak.mosis.marko.discounthunt;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.android.volley.Response;
import com.android.volley.VolleyError;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

import rs.elfak.mosis.marko.discounthunt.api.endpoints.FriendshipEndpoint;
import rs.elfak.mosis.marko.discounthunt.api.endpoints.UserSearchEndpoint;

public class AddFriendActivity extends AppCompatActivity {

    private static final int REQUEST_ENABLE_BT = 1;
    private static final int REQUEST_DISCOVERABLE = 2;
    private static final int DISCOVERABLE_DURATION = 300;

    private ArrayList<String> mUserNames;
    private ArrayList<JSONObject> mUsers;
    private ArrayList<BluetoothDevice> mUserDevices;
    private ArrayAdapter<String> mListAdapter;
    private ListView mList;

    private BluetoothAdapter mBluetoothAdapter;
    private BroadcastReceiver mReceiver;
    private BluetoothDevice mCurrentDevice;

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

        initList();
        initIntentReceiver();
        initBlueTooth();
    }

    private void initList() {
        mUserDevices = new ArrayList<>();
        mUserNames = new ArrayList<>();
        mUsers = new ArrayList<>();

        mList = (ListView) findViewById(R.id.list);
        mListAdapter = new ArrayAdapter<String>(getApplicationContext(),
                android.R.layout.simple_list_item_1, mUserNames);
        mList.setAdapter(mListAdapter);

        mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                BluetoothDevice device = mUserDevices.get(position);
                createBond(device);
            }
        });
    }

    private void initIntentReceiver() {
        mReceiver = new BroadcastReceiver() {
            public void onReceive(Context context, Intent intent) {<commit_msg>Use current activity as context in AddFriendActivity<commit_after>package rs.elfak.mosis.marko.discounthunt;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.android.volley.Response;
import com.android.volley.VolleyError;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

import rs.elfak.mosis.marko.discounthunt.api.endpoints.FriendshipEndpoint;
import rs.elfak.mosis.marko.discounthunt.api.endpoints.UserSearchEndpoint;

public class AddFriendActivity extends AppCompatActivity {

    private static final int REQUEST_ENABLE_BT = 1;
    private static final int REQUEST_DISCOVERABLE = 2;
    private static final int DISCOVERABLE_DURATION = 300;

    private ArrayList<String> mUserNames;
    private ArrayList<JSONObject> mUsers;
    private ArrayList<BluetoothDevice> mUserDevices;
    private ArrayAdapter<String> mListAdapter;
    private ListView mList;

    private BluetoothAdapter mBluetoothAdapter;
    private BroadcastReceiver mReceiver;
    private BluetoothDevice mCurrentDevice;

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

        initList();
        initIntentReceiver();
        initBlueTooth();
    }

    private void initList() {
        mUserDevices = new ArrayList<>();
        mUserNames = new ArrayList<>();
        mUsers = new ArrayList<>();

        mList = (ListView) findViewById(R.id.list);
        mListAdapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, mUserNames);
        mList.setAdapter(mListAdapter);

        mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                BluetoothDevice device = mUserDevices.get(position);
                createBond(device);
            }
        });
    }

    private void initIntentReceiver() {
        mReceiver = new BroadcastReceiver() {
            public void onReceive(Context context, Intent intent) {
{'fraction_non_alphanumeric': 0.08362779740871613, 'fraction_numerical': 0.0027483313702394976, 'mean_word_length': 3.766136576239476, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '5565392', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1360, 'n_words': 304}