<commit_before>package com.example.qyu4.theallswap.View;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.qyu4.theallswap.Controller.UserController;
import com.example.qyu4.theallswap.Model.User;
import com.example.qyu4.theallswap.Model.UserList;
import com.example.qyu4.theallswap.R;

import java.util.ArrayList;

public class CreateTrade extends ActionBarActivity implements View.OnClickListener {
    private CreateTrade activity = this;
    private UserController uc = new UserController();

    private UserList userList;
    private User currentUser;

    private ArrayAdapter<User> adapterMine;
    private ArrayAdapter<User> adapterFriend;
    private ListView itemListMine;
    private ListView itemListFriend;
    private ArrayList<String> resultListMine = new ArrayList<>();
    private ArrayList<String> resultListFriend = new ArrayList<>();

    private String mySelectedItem;
    private String friendsSelectedItem;

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

        userList = UserList.getUserList();
        currentUser = userList.getCurrentUser();

        //Get friend with whom we are trading
        Intent intent = getIntent();
        String friendId = intent.getStringExtra("id");
        User friend = currentUser.getFriendsList().get(uc.stringToInt(friendId));

        itemListMine = (ListView)findViewById(R.id.lv_your_items);
        itemListFriend = (ListView)findViewById(R.id.lv_friends_items);

        itemListMine.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                mySelectedItem = ((TextView) view).getText().toString();
                Toast.makeText(getApplicationContext(), "Selected: " + mySelectedItem,
                        Toast.LENGTH_SHORT).show();
            }
        });

        itemListFriend.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                friendsSelectedItem = ((TextView) view).getText().toString();
                Toast.makeText(getApplicationContext(), "Selected: " + friendsSelectedItem,
                        Toast.LENGTH_SHORT).show();
            }
        });

        resultListMine = uc.convertItemToString(currentUser, resultListMine);
        resultListFriend = uc.convertItemToString(friend, resultListFriend);<commit_msg>Fixed CreateTrade to no longer show private items of friends<commit_after>package com.example.qyu4.theallswap.View;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.qyu4.theallswap.Controller.InventoryController;
import com.example.qyu4.theallswap.Controller.UserController;
import com.example.qyu4.theallswap.Model.User;
import com.example.qyu4.theallswap.Model.UserList;
import com.example.qyu4.theallswap.R;

import java.util.ArrayList;

public class CreateTrade extends ActionBarActivity implements View.OnClickListener {
    private CreateTrade activity = this;
    private UserController uc = new UserController();
    private InventoryController ic = new InventoryController();

    private UserList userList;
    private User currentUser;

    private ArrayAdapter<User> adapterMine;
    private ArrayAdapter<User> adapterFriend;
    private ListView itemListMine;
    private ListView itemListFriend;
    private ArrayList<String> resultListMine = new ArrayList<>();
    private ArrayList<String> resultListFriend = new ArrayList<>();

    private String mySelectedItem;
    private String friendsSelectedItem;

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

        userList = UserList.getUserList();
        currentUser = userList.getCurrentUser();

        //Get friend with whom we are trading
        Intent intent = getIntent();
        String friendId = intent.getStringExtra("id");
        User friend = currentUser.getFriendsList().get(uc.stringToInt(friendId));

        itemListMine = (ListView)findViewById(R.id.lv_your_items);
        itemListFriend = (ListView)findViewById(R.id.lv_friends_items);

        itemListMine.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                mySelectedItem = ((TextView) view).getText().toString();
                Toast.makeText(getApplicationContext(), "Selected: " + mySelectedItem,
                        Toast.LENGTH_SHORT).show();
            }
        });

        itemListFriend.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                friendsSelectedItem = ((TextView) view).getText().toString();
                Toast.makeText(getApplicationContext(), "Selected: " + friendsSelectedItem,
                        Toast.LENGTH_SHORT).show();
            }
        });

        resultListMine = uc.convertItemToString(currentUser, resultListMine);
        //resultListFriend = uc.convertItemToString(friend, resultListFriend);
        resultListFriend = ic.showNonPrivateItems(friend);
{'fraction_non_alphanumeric': 0.09377566102808343, 'fraction_numerical': 0.002134997536541304, 'mean_word_length': 3.6810146041506533, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '261695', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1558, 'n_words': 339}