mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 05:13:53 +01:00
* Inserted missing spaces between `if` and `(` to improve code style, in line with GSG 4.6.2
This commit is contained in:
parent
0cf2299e49
commit
7b7d17a33b
69 changed files with 126 additions and 126 deletions
|
|
@ -51,7 +51,7 @@ public class QuizActivity extends AppCompatActivity {
|
|||
*/
|
||||
@OnClick(R.id.next_button)
|
||||
public void setNextQuestion(){
|
||||
if( questionIndex <= quiz.size() && (positiveAnswer.isChecked() || negativeAnswer.isChecked())) {
|
||||
if ( questionIndex <= quiz.size() && (positiveAnswer.isChecked() || negativeAnswer.isChecked())) {
|
||||
evaluateScore();
|
||||
} else if ( !positiveAnswer.isChecked() && !negativeAnswer.isChecked()){
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||
|
|
@ -107,11 +107,11 @@ public class QuizActivity extends AppCompatActivity {
|
|||
* to evaluate score and check whether answer is correct or wrong
|
||||
*/
|
||||
public void evaluateScore() {
|
||||
if((quiz.get(questionIndex).isAnswer() && positiveAnswer.isChecked()) ||
|
||||
if ((quiz.get(questionIndex).isAnswer() && positiveAnswer.isChecked()) ||
|
||||
(!quiz.get(questionIndex).isAnswer() && negativeAnswer.isChecked()) ){
|
||||
customAlert(getResources().getString(R.string.correct),quiz.get(questionIndex).getAnswerMessage() );
|
||||
score++;
|
||||
} else{
|
||||
} else {
|
||||
customAlert(getResources().getString(R.string.wrong), quiz.get(questionIndex).getAnswerMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -127,12 +127,12 @@ public class QuizActivity extends AppCompatActivity {
|
|||
alert.setMessage(Message);
|
||||
alert.setPositiveButton(R.string.continue_message, (dialog, which) -> {
|
||||
questionIndex++;
|
||||
if(questionIndex == quiz.size()){
|
||||
if (questionIndex == quiz.size()) {
|
||||
Intent i = new Intent(QuizActivity.this, QuizResultActivity.class);
|
||||
dialog.dismiss();
|
||||
i.putExtra("QuizResult",score);
|
||||
startActivity(i);
|
||||
}else {
|
||||
} else {
|
||||
displayQuestion();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class QuizChecker {
|
|||
*/
|
||||
private void setTotalUploadCount(int uploadCount) {
|
||||
totalUploadCount = uploadCount - countPref.getInt(UPLOAD_SHARED_PREFERENCE,0);
|
||||
if( totalUploadCount < 0){
|
||||
if ( totalUploadCount < 0){
|
||||
totalUploadCount = 0;
|
||||
countPref.edit().putInt(UPLOAD_SHARED_PREFERENCE,0).apply();
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ public class QuizChecker {
|
|||
*/
|
||||
private void setRevertParameter(int revertCountFetched) {
|
||||
revertCount = revertCountFetched - revertPref.getInt(REVERT_SHARED_PREFERENCE,0);
|
||||
if(revertCount < 0){
|
||||
if (revertCount < 0){
|
||||
revertCount = 0;
|
||||
revertPref.edit().putInt(REVERT_SHARED_PREFERENCE, 0).apply();
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ public class QuizChecker {
|
|||
* to check whether the criterion to call quiz is satisfied
|
||||
*/
|
||||
private void calculateRevertParameter() {
|
||||
if( revertCount < 0 || totalUploadCount < 0){
|
||||
if ( revertCount < 0 || totalUploadCount < 0){
|
||||
revertPref.edit().putInt(REVERT_SHARED_PREFERENCE, 0).apply();
|
||||
countPref.edit().putInt(UPLOAD_SHARED_PREFERENCE,0).apply();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class QuizResultActivity extends AppCompatActivity {
|
|||
ButterKnife.bind(this);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
if( getIntent() != null) {
|
||||
if ( getIntent() != null) {
|
||||
Bundle extras = getIntent().getExtras();
|
||||
int score = extras.getInt("QuizResult");
|
||||
setScore(score);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class RadioGroupHelper {
|
|||
*/
|
||||
View.OnClickListener onClickListener = v -> {
|
||||
for (CompoundButton rb : radioButtons) {
|
||||
if(rb != v) rb.setChecked(false);
|
||||
if (rb != v) rb.setChecked(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue