<commit_before>package skylight1.sevenwonders;

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

import skylight1.sevenwonders.levels.GameLevel;
import skylight1.sevenwonders.view.TextStyles;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class LevelChooserActivity extends ListActivity {

	private static class LevelScore {
		final GameLevel level;

		final int score;

		public LevelScore(GameLevel aLevel, int aScore) {
			level = aLevel;
			score = aScore;
		}
	}

	private TextStyles wonderFonts;

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

		wonderFonts = new TextStyles(this);

		final TextView heading = (TextView) findViewById(R.id.heading);
		wonderFonts.applyBodyTextStyle(heading);

		List<LevelScore> listOfLevels = new ArrayList<LevelScore>();
		for (GameLevel level : GameLevel.values()) {
			listOfLevels.add(new LevelScore(level, 1000));
		}
		ArrayAdapter<LevelScore> levelScoreAdapter = new ArrayAdapter<LevelScore>(this, R.layout.level_chooser_row, listOfLevels) {
			@Override
			public View getView(int aPosition, View aConvertView, ViewGroup aParent) {
				final View rowView;
				if (aConvertView == null) {
					rowView = LevelChooserActivity.this.getLayoutInflater().inflate(R.layout.level_chooser_row, null);
				} else {
					rowView = aConvertView;
				}
				final TextView levelNameTextView = (TextView) rowView.findViewById(R.id.levelName);
				final TextView scoreTextView = (TextView) rowView.findViewById(R.id.highScore);

				wonderFonts.applyHeaderTextStyle(levelNameTextView);
				wonderFonts.applyHeaderTextStyle(scoreTextView);

				final LevelScore levelScore = getItem(aPosition);
				levelNameTextView.setText("Level " + levelScore.level.ordinal());
				scoreTextView.setText("");

				return rowView;
			}
		};

		setListAdapter(levelScoreAdapter);
	}

	@Override
	protected void onListItemClick(ListView aL, View aV, int aPosition, long aId) {
		final LevelScore levelScore = (LevelScore) getListAdapter().getItem(aPosition);
		final Intent intent = new Intent(this, PlayActivity.class);
		intent.putExtra(ScoreActivity.KEY_LEVEL_ORDINAL, levelScore.level.ordinal());
		startActivity(intent);
	}
}
<commit_msg>Fixed level number one off on level chooser.<commit_after>package skylight1.sevenwonders;

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

import skylight1.sevenwonders.levels.GameLevel;
import skylight1.sevenwonders.view.TextStyles;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class LevelChooserActivity extends ListActivity {

	private static class LevelScore {
		final GameLevel level;

		final int score;

		public LevelScore(GameLevel aLevel, int aScore) {
			level = aLevel;
			score = aScore;
		}
	}

	private TextStyles wonderFonts;

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

		wonderFonts = new TextStyles(this);

		final TextView heading = (TextView) findViewById(R.id.heading);
		wonderFonts.applyBodyTextStyle(heading);

		List<LevelScore> listOfLevels = new ArrayList<LevelScore>();
		for (GameLevel level : GameLevel.values()) {
			listOfLevels.add(new LevelScore(level, 1000));
		}
		ArrayAdapter<LevelScore> levelScoreAdapter = new ArrayAdapter<LevelScore>(this, R.layout.level_chooser_row, listOfLevels) {
			@Override
			public View getView(int aPosition, View aConvertView, ViewGroup aParent) {
				final View rowView;
				if (aConvertView == null) {
					rowView = LevelChooserActivity.this.getLayoutInflater().inflate(R.layout.level_chooser_row, null);
				} else {
					rowView = aConvertView;
				}
				final TextView levelNameTextView = (TextView) rowView.findViewById(R.id.levelName);
				final TextView scoreTextView = (TextView) rowView.findViewById(R.id.highScore);

				wonderFonts.applyHeaderTextStyle(levelNameTextView);
				wonderFonts.applyHeaderTextStyle(scoreTextView);

				final LevelScore levelScore = getItem(aPosition);
				levelNameTextView.setText("Level " + (levelScore.level.ordinal() + 1));
				scoreTextView.setText("");

				return rowView;
			}
		};

		setListAdapter(levelScoreAdapter);
	}

	@Override
	protected void onListItemClick(ListView aL, View aV, int aPosition, long aId) {
		final LevelScore levelScore = (LevelScore) getListAdapter().getItem(aPosition);
		final Intent intent = new Intent(this, PlayActivity.class);
		intent.putExtra(ScoreActivity.KEY_LEVEL_ORDINAL, levelScore.level.ordinal());
		startActivity(intent);
	}
}

{'fraction_non_alphanumeric': 0.09549795361527967, 'fraction_numerical': 0.002923406743324888, 'mean_word_length': 4.407797681770284, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4740115', 'n_tokens_mistral': 1732, 'n_tokens_neox': 1511, 'n_words': 316}