<commit_before>package uk.co.cntwo.pilllogger.listeners;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import java.util.List;

import uk.co.cntwo.pilllogger.R;
import uk.co.cntwo.pilllogger.activities.PillDetailActivity;
import uk.co.cntwo.pilllogger.fragments.PillDetailFragment;
import uk.co.cntwo.pilllogger.helpers.DatabaseHelper;
import uk.co.cntwo.pilllogger.models.Pill;

/**
 * Created by nick on 23/10/13.
 */
public class PillItemClickListener implements ListView.OnItemClickListener {

    FragmentActivity _activity;

    public PillItemClickListener(FragmentActivity activity) {
        _activity = activity;
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        DatabaseHelper dbHelper = DatabaseHelper.getSingleton(_activity);
        List<Pill> pills = dbHelper.getAllPills();
        onItemSelected(pills.get(i).getId());
    }

    public void onItemSelected(int id) {
            Bundle arguments = new Bundle();
            arguments.putInt(PillDetailFragment.ARG_ITEM_ID, id);
            PillDetailFragment fragment = new PillDetailFragment();
            fragment.setArguments(arguments);
            _activity.getSupportFragmentManager().beginTransaction()
                    .replace(R.id.fragment_container, fragment).commit();

    }


}<commit_msg>Added the pill details pane to the back stack<commit_after>package uk.co.cntwo.pilllogger.listeners;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import java.util.List;

import uk.co.cntwo.pilllogger.R;
import uk.co.cntwo.pilllogger.activities.PillDetailActivity;
import uk.co.cntwo.pilllogger.fragments.PillDetailFragment;
import uk.co.cntwo.pilllogger.helpers.DatabaseHelper;
import uk.co.cntwo.pilllogger.models.Pill;

/**
 * Created by nick on 23/10/13.
 */
public class PillItemClickListener implements ListView.OnItemClickListener {

    FragmentActivity _activity;

    public PillItemClickListener(FragmentActivity activity) {
        _activity = activity;
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        DatabaseHelper dbHelper = DatabaseHelper.getSingleton(_activity);
        List<Pill> pills = dbHelper.getAllPills();
        onItemSelected(pills.get(i).getId());
    }

    public void onItemSelected(int id) {
            Bundle arguments = new Bundle();
            arguments.putInt(PillDetailFragment.ARG_ITEM_ID, id);
            PillDetailFragment fragment = new PillDetailFragment();
            fragment.setArguments(arguments);
            _activity.getSupportFragmentManager().beginTransaction()
                    .replace(R.id.fragment_container, fragment)
                    .addToBackStack(fragment.toString())
                    .commit();

    }


}
{'fraction_non_alphanumeric': 0.09847522236340533, 'fraction_numerical': 0.0044472681067344345, 'mean_word_length': 3.5703918722786647, 'pattern_counts': {'":': 0, '<': 7, '<?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': '260707', 'n_tokens_mistral': 917, 'n_tokens_neox': 882, 'n_words': 172}