Skip to content

Commit

Permalink
Code tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
IanField90 committed Mar 1, 2012
1 parent 9c02ed1 commit a9d6591
Showing 1 changed file with 1 addition and 40 deletions.
41 changes: 1 addition & 40 deletions android/src/uk/ac/reading/dp005570/TeachReach/QuizActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ public void onCreate(Bundle savedInstanceState){
mLl = (LinearLayout) findViewById(R.id.question_options);
loadQuestion(mQuestions.get(0));
}

shuffleOptions();

}

@Override
Expand Down Expand Up @@ -137,33 +134,6 @@ private void shuffleOptions(){
}while(!flag);
mOptionPositions[i] = pos;
}

// int pos;
// mOptionPositions = new Integer[5];
//
// //Initialise shuffle to -1
// for(int i = 0; i < 5; i++){
// mOptionPositions[i] = -1;
// }
//
// Random generator = new Random(System.currentTimeMillis());
// boolean flag;
//
// //TODO paper out this logic
// for(int i = 0; i < 5; i++){
// do{
// pos = generator.nextInt(5);
// flag = true;
// for(int j = 0; j < 5; j++){
// if(mOptionPositions[j] == pos){
// flag = false;
// }
// }
// }while(!flag);
// mOptionPositions[i] = pos;
// }
//
// Log.i("QuizActivity", "Shuffle: " + mOptionPositions[0] + "," + mOptionPositions[1] + "," + mOptionPositions[2] + "," + mOptionPositions[3] + "," + mOptionPositions[4]);
}

/**
Expand Down Expand Up @@ -214,7 +184,7 @@ private void addAnswerToIntent(){
value = 'X';// X for N/A
break;
}
//TODO question correctness logic here
// question correctness answer
mIntent.putExtra(ANSWER_STATUS_STRING + mQuestionNumber, value);
}

Expand Down Expand Up @@ -254,7 +224,6 @@ public void loadQuestion(Question q){
mLl.addView(rg);
break;
case 2:
//TODO shuffle
shuffleOptions();
//Fill-in-the-blanks
mLetter = 'A';
Expand All @@ -265,15 +234,12 @@ public void loadQuestion(Question q){
String[] optns = new String[mOptions.size()];
for(int j = 0; j < mOptions.size(); j++){
if(Locale.getDefault().getDisplayLanguage().equalsIgnoreCase("franais")){
// optns[j] = mOptions.get(j).getFR(); //TODO use shuffled value here instead in 'get'
optns[j] = mOptions.get(mOptionPositions[j]).getFR();
}
else if(Locale.getDefault().getDisplayLanguage().equalsIgnoreCase("espa–ol")){
// optns[j] = mOptions.get(j).getES();
optns[j] = mOptions.get(mOptionPositions[j]).getES();
}
else{
// optns[j] = mOptions.get(j).getEN();
optns[j] = mOptions.get(mOptionPositions[j]).getEN();
}
}
Expand All @@ -287,7 +253,6 @@ public void loadQuestion(Question q){
}
break;
case 3:
///TODO shuffle
shuffleOptions();
//Match up
mLetter = 'A';
Expand All @@ -298,16 +263,12 @@ public void loadQuestion(Question q){
String[] optns = new String[mOptions.size()];
for(int j = 0; j < mOptions.size(); j++){
if(Locale.getDefault().getDisplayLanguage().equalsIgnoreCase("franais")){
// optns[j] = mOptions.get(j).getFR(); //TODO use shuffled value here instead in 'get'
optns[j] = mOptions.get(mOptionPositions[j]).getFR();

}
else if(Locale.getDefault().getDisplayLanguage().equalsIgnoreCase("espa–ol")){
// optns[j] = mOptions.get(j).getES();
optns[j] = mOptions.get(mOptionPositions[j]).getES();
}
else{
// optns[j] = mOptions.get(j).getEN();
optns[j] = mOptions.get(mOptionPositions[j]).getEN();
}
}
Expand Down

0 comments on commit a9d6591

Please sign in to comment.