Skip to content

Commit

Permalink
changed layout so does not bump into logo, score problem fixed, array
Browse files Browse the repository at this point in the history
list bug fixed
  • Loading branch information
euanong committed Aug 2, 2014
1 parent 981ac84 commit fe99921
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
11 changes: 7 additions & 4 deletions WikiQuiz/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/button1"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_centerVertical="false"
android:onClick="onClickB"
android:text="Answer B"
android:textColor="#FFFFFF" />
Expand All @@ -31,7 +32,7 @@
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/button2"
android:layout_below="@id/button2"
android:layout_centerHorizontal="true"
android:onClick="onClickC"
android:text="Answer C"
Expand All @@ -41,7 +42,7 @@
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button2"
android:layout_below="@id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
Expand All @@ -53,8 +54,9 @@
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button1"
android:layout_below="@id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="Question"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
Expand All @@ -65,6 +67,7 @@
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView1"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:scaleType="centerInside"
android:src="@drawable/ic_launcher" />

Expand Down
12 changes: 10 additions & 2 deletions WikiQuiz/src/com/homegrownapps/wikiquiz/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -53,7 +54,6 @@ protected void onPreExecute() {
pdz.setCancelable(false);
pdz.setIndeterminate(true);
pdz.show();
Global.score = 0;
if (Global.question != 1){
Button b = (Button)findViewById(R.id.button1);
b.setBackgroundResource(android.R.drawable.btn_default);
Expand Down Expand Up @@ -210,7 +210,9 @@ public void buttonClick(int button) {
Button b0 = (Button)findViewById(id);
b0.setBackgroundColor(Color.GREEN);
b0.invalidate();
Global.score = Global.score + 1;
Log.i("Score", Integer.toString(Global.score));
Global.score = Global.score+1;
Log.i("Score", Integer.toString(Global.score));
TextView tv = (TextView)findViewById(R.id.textView3);
tv.setText("Score: "+Integer.toString(Global.score));
//log tags for score (diagnostics)
Expand Down Expand Up @@ -255,6 +257,12 @@ public void onClick(View btn) {
}
}

@Override
public void onPause(){
finish();
super.onPause();
}

public void onClickB(View v){
buttonClick(2);
}
Expand Down
5 changes: 5 additions & 0 deletions WikiQuiz/src/wikiParse/QuestionFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ public String[] sentenceParse(String article){
photoend = article_newer.indexOf(">");
int str_len = article_newer.length()-1;
}
try {
article_newer.delete(photoindex, photoend+6);
} catch (java.lang.StringIndexOutOfBoundsException e){
e.printStackTrace();
break;
}


} else {
Expand Down

0 comments on commit fe99921

Please sign in to comment.