<commit_before>package org.duckdns.raven.ttscallresponder.ui.responseTemplates;

import java.util.List;

import org.duckdns.raven.ttscallresponder.R;
import org.duckdns.raven.ttscallresponder.dataAccess.SettingsManager;
import org.duckdns.raven.ttscallresponder.domain.responseTemplate.ResponseTemplate;

import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.TextView;

public class ResponseTemplateListAdapter extends ArrayAdapter<ResponseTemplate> {
	private static final String TAG = "ResponseTemplateListAdapter";

	private final SettingsManager settingsManager;
	private final Activity parent;

	public ResponseTemplateListAdapter(Activity parent, List<ResponseTemplate> list) {
		super(parent, org.duckdns.raven.ttscallresponder.R.layout.widget_response_template, list);
		this.settingsManager = new SettingsManager(parent);
		this.parent = parent;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = this.parent.getLayoutInflater().inflate(R.layout.widget_response_template, parent, false);
		}

		TextView title = (TextView) convertView.findViewById(R.id.label_responseTemplateTitle);
		TextView text = (TextView) convertView.findViewById(R.id.label_responseTemplateText);
		CheckBox selected = (CheckBox) convertView.findViewById(R.id.checkBox_responseTemplateSelected);
		ImageButton setAsCurrent = (ImageButton) convertView.findViewById(R.id.button_setResponseTemplateAsCurrent);

		ResponseTemplate responseTemplate = this.getItem(position);
		title.setText(responseTemplate.getTitle());
		text.setText(responseTemplate.getText());
		selected.setChecked(responseTemplate.isSelected());

		// selected.setOnClickListener(new
		// OnSelectedClickListener(responseTemplate));

		selected.setTag(responseTemplate);
		selected.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				CheckBox checkBox = (CheckBox) v;
				ResponseTemplate responseTemplate = (ResponseTemplate) checkBox.getTag();
				responseTemplate.setSelected(checkBox.isChecked());
				Log.i(TAG,
						"Item " + responseTemplate.getTitle() + " selected for removal: "
								+ responseTemplate.isSelected());
			}
		});

		if (responseTemplate.getId() == this.settingsManager.getCurrentResponseTemplateId())
			setAsCurrent.setImageResource(R.drawable.ic_checkmark_holo_light_green);<commit_msg>[Cleanup] Removed commented line.<commit_after>package org.duckdns.raven.ttscallresponder.ui.responseTemplates;

import java.util.List;

import org.duckdns.raven.ttscallresponder.R;
import org.duckdns.raven.ttscallresponder.dataAccess.SettingsManager;
import org.duckdns.raven.ttscallresponder.domain.responseTemplate.ResponseTemplate;

import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.TextView;

public class ResponseTemplateListAdapter extends ArrayAdapter<ResponseTemplate> {
	private static final String TAG = "ResponseTemplateListAdapter";

	private final SettingsManager settingsManager;
	private final Activity parent;

	public ResponseTemplateListAdapter(Activity parent, List<ResponseTemplate> list) {
		super(parent, org.duckdns.raven.ttscallresponder.R.layout.widget_response_template, list);
		this.settingsManager = new SettingsManager(parent);
		this.parent = parent;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = this.parent.getLayoutInflater().inflate(R.layout.widget_response_template, parent, false);
		}

		TextView title = (TextView) convertView.findViewById(R.id.label_responseTemplateTitle);
		TextView text = (TextView) convertView.findViewById(R.id.label_responseTemplateText);
		CheckBox selected = (CheckBox) convertView.findViewById(R.id.checkBox_responseTemplateSelected);
		ImageButton setAsCurrent = (ImageButton) convertView.findViewById(R.id.button_setResponseTemplateAsCurrent);

		ResponseTemplate responseTemplate = this.getItem(position);
		title.setText(responseTemplate.getTitle());
		text.setText(responseTemplate.getText());
		selected.setChecked(responseTemplate.isSelected());

		selected.setTag(responseTemplate);
		selected.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				CheckBox checkBox = (CheckBox) v;
				ResponseTemplate responseTemplate = (ResponseTemplate) checkBox.getTag();
				responseTemplate.setSelected(checkBox.isChecked());
				Log.i(TAG,
						"Item " + responseTemplate.getTitle() + " selected for removal: "
								+ responseTemplate.isSelected());
			}
		});

		if (responseTemplate.getId() == this.settingsManager.getCurrentResponseTemplateId())
			setAsCurrent.setImageResource(R.drawable.ic_checkmark_holo_light_green);
{'fraction_non_alphanumeric': 0.09970958373668926, 'fraction_numerical': 0.0, 'mean_word_length': 6.433093525179856, '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': '2409919', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1425, 'n_words': 256}