Permalink
Browse files

Fixed bug with score not being reduced.

Tweaked text styling.
Added new release package and screenshots.
  • Loading branch information...
1 parent 6d33d37 commit fb8a8c08000b38340e4346673e925a85222206bd @MikeHook committed Jan 22, 2012
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- android:versionCode="1" android:versionName="0.1" package="mhook.FootyLinks">
- <application android:icon="@drawable/icon" android:label="@string/app_name">
+ android:versionCode="1" android:versionName="Alpha 1" package="mhook.FootyLinks">
+ <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="8" />
+ <application android:icon="@drawable/icon" android:label="@string/app_name"
+ android:debuggable="false">
<activity android:name=".StartGame"
android:label="@string/app_name"
- android:noHistory="true">
+ android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -50,10 +50,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
+ android:layout_marginBottom="16dip"
android:layout_below="@id/text_previously_played"
android:text="@string/guess_string"
- android:textSize="18dip"
+ android:textSize="22dip"
android:textColor="#4876FF"
+ android:textStyle="italic"
/>
<TextView
android:id="@+id/text_squad_includes"
@@ -48,14 +48,13 @@ public int getScore() {
long rows = DatabaseUtils.queryNumEntries(sqlLiteDatabase, FootyLinksSQLLiteHelper.Tables.Score);
- long rowId;
if (rows == 0)
{
//If no score exists then insert one
ContentValues initialValues = new ContentValues();
initialValues.put(FootyLinksSQLLiteHelper.ScoreColumns._id, 0);
initialValues.put(FootyLinksSQLLiteHelper.ScoreColumns.HighScore, 0);
- rowId = sqlLiteDatabase.insert(FootyLinksSQLLiteHelper.Tables.Score, null, initialValues);
+ sqlLiteDatabase.insert(FootyLinksSQLLiteHelper.Tables.Score, null, initialValues);
}
Cursor mCursor =
@@ -4,7 +4,6 @@
import java.io.InputStream;
import java.io.OutputStream;
-import android.content.ContentValues;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
@@ -1,17 +1,17 @@
package mhook.FootyLinks;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mhook.FootyLinks.Data.DatabaseAdapter;
import mhook.FootyLinks.Data.FootyLinksSQLLiteHelper;
import android.app.Activity;
import android.content.Intent;
-import android.content.res.ColorStateList;
import android.database.Cursor;
import android.graphics.Color;
import android.os.Bundle;
+import android.text.SpannableString;
+import android.text.style.UnderlineSpan;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
@@ -20,11 +20,10 @@
public class OneDegree extends Activity {
- public Integer ScorePenalty = 1;
- public Integer ClubIndex;
-
+ private Integer ScorePenalty;
+ private Integer ClubIndex;
//Note, the order of this array is crucial as it is used in the lookup from the PickClub view
- public String[] Clubs = {
+ private String[] Clubs = {
"Arsenal",
"Aston Villa",
"Birmingham",
@@ -45,11 +44,9 @@
"West Ham",
"Wigan",
"Wolves"
- };
-
+ };
//These are the 'top six' clubs in the Clubs array
- public List<Integer> TopClubIndexes = Arrays.asList(0, 6, 9, 10, 11, 15);
-
+ private List<Integer> TopClubIndexes = Arrays.asList(0, 6, 9, 10, 11, 15);
private DatabaseAdapter footyLinksDbAdapter;
/** Called when the activity is first created. */
@@ -71,45 +68,7 @@ public void onCreate(Bundle savedInstanceState) {
restartButton.setOnClickListener(new RestartButtonClickListener());
}
- private void populateFields() {
-
- //Generate a random int between 0 and 19, representing the index of the club answer
- ClubIndex = (int)(Math.random() * 20);
-
- //Hard code this for now
- int clubId = footyLinksDbAdapter.getClubId(Clubs[ClubIndex]);
-
- //Start player
- Cursor startPlayerDbCursor = footyLinksDbAdapter.getPlayerByFormerClub(clubId);
- String startPlayerName = startPlayerDbCursor.getString(
- startPlayerDbCursor.getColumnIndexOrThrow(FootyLinksSQLLiteHelper.PlayerColumns.Name));
-
- TextView startPlayerTextView = (TextView) findViewById(R.id.text_start_player);
- startPlayerTextView.setText(startPlayerName);
-
- //Guess button
- //Update the guess button with the answer and disable clicking
- TextView guess1Button = (TextView) findViewById(R.id.button_guess1);
- guess1Button.setText("what club?");
- guess1Button.setClickable(true);
- guess1Button.setTextColor(Color.parseColor("#4876FF"));
-
- //End player
- Cursor endPlayerDbCursor = footyLinksDbAdapter.getPlayerByCurrentClub(clubId);
- String endPlayerName = endPlayerDbCursor.getString(
- endPlayerDbCursor.getColumnIndexOrThrow(FootyLinksSQLLiteHelper.PlayerColumns.Name));
-
- TextView endPlayerTextView = (TextView) findViewById(R.id.text_end_player);
- endPlayerTextView.setText(endPlayerName);
- }
-
- private void populateScore()
- {
- String scoreText = "Your score: " + footyLinksDbAdapter.getScore();
- TextView scoreTextView = (TextView) findViewById(R.id.text_score);
- scoreTextView.setText(scoreText);
- }
-
+ /** Button Listeners */
public class Guess1ButtonClickListener implements OnClickListener {
public void onClick(View v) {
@@ -130,6 +89,7 @@ public void onClick(View v) {
}
}
+ /** Called from PickClub to pass back the selected guess ID */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
@@ -159,7 +119,51 @@ protected void onActivityResult(int requestCode, int resultCode, Intent intent)
}
}
- protected void updateViewForCorrectAnswer()
+ /** private helper methods */
+ private void populateFields() {
+
+ ScorePenalty = 1;
+
+ //Generate a random int between 0 and 19, representing the index of the club answer
+ ClubIndex = (int)(Math.random() * 20);
+
+ //Hard code this for now
+ int clubId = footyLinksDbAdapter.getClubId(Clubs[ClubIndex]);
+
+ //Start player
+ Cursor startPlayerDbCursor = footyLinksDbAdapter.getPlayerByFormerClub(clubId);
+ String startPlayerName = startPlayerDbCursor.getString(
+ startPlayerDbCursor.getColumnIndexOrThrow(FootyLinksSQLLiteHelper.PlayerColumns.Name));
+
+ TextView startPlayerTextView = (TextView) findViewById(R.id.text_start_player);
+ startPlayerTextView.setText(startPlayerName);
+
+ //Guess button
+ //Update the guess button with the question and enable clicking
+ TextView guess1Button = (TextView) findViewById(R.id.button_guess1);
+ SpannableString content = new SpannableString("what club? ");
+ content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
+ guess1Button.setText(content);
+ guess1Button.setClickable(true);
+ guess1Button.setTextColor(Color.parseColor("#4876FF"));
+
+ //End player
+ Cursor endPlayerDbCursor = footyLinksDbAdapter.getPlayerByCurrentClub(clubId);
+ String endPlayerName = endPlayerDbCursor.getString(
+ endPlayerDbCursor.getColumnIndexOrThrow(FootyLinksSQLLiteHelper.PlayerColumns.Name));
+
+ TextView endPlayerTextView = (TextView) findViewById(R.id.text_end_player);
+ endPlayerTextView.setText(endPlayerName);
+ }
+
+ private void populateScore()
+ {
+ String scoreText = "Your score: " + footyLinksDbAdapter.getScore();
+ TextView scoreTextView = (TextView) findViewById(R.id.text_score);
+ scoreTextView.setText(scoreText);
+ }
+
+ private void updateViewForCorrectAnswer()
{
Integer points = 2;
if (TopClubIndexes.contains(ClubIndex))
@@ -175,7 +179,7 @@ protected void updateViewForCorrectAnswer()
//Update the guess button with the answer and disable clicking
TextView guess1Button = (TextView) findViewById(R.id.button_guess1);
- guess1Button.setText(Clubs[ClubIndex]);
+ guess1Button.setText(Clubs[ClubIndex] + " ");
guess1Button.setClickable(false);
guess1Button.setTextColor(Color.GREEN);
@@ -7,7 +7,6 @@
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
-import android.widget.Toast;
public class PickClub extends Activity {
@@ -6,7 +6,6 @@
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
-import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fb8a8c0

Please sign in to comment.