commit feb862fd6e5b02f47e274cfc9f2f16581e66e07d Author: litingting Date: Fri Aug 30 17:02:14 2024 +0800 V1.0.1(2) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..6774e3e --- /dev/null +++ b/app/.gitignore @@ -0,0 +1,90 @@ +# Built application files +*.apk +#*.aar +*.ap_ +*.aab + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ +# Uncomment the following line in case you need and you don't have the release build type files in your app +# release/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +app/release/ +.safedk/ +.idea/ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +# Android Studio 3 in .gitignore file. +.idea/caches +.idea/modules.xml +# Comment next line if keeping position of elements in Navigation Editor is relevant for you +.idea/navEditor.xml + +# Keystore files +# Uncomment the following lines if you do not want to check your keystore files in. +#*.jks +#*.keystore + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild +.cxx/ + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Version control +vcs.xml + +# lint +lint/intermediates/ +lint/generated/ +lint/outputs/ +lint/tmp/ +# lint/reports/ + +app/debug diff --git a/app/BrainTest.jks b/app/BrainTest.jks new file mode 100644 index 0000000..73f4adf Binary files /dev/null and b/app/BrainTest.jks differ diff --git a/app/IntelligenceTest.jks b/app/IntelligenceTest.jks new file mode 100644 index 0000000..309e3ec Binary files /dev/null and b/app/IntelligenceTest.jks differ diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..eb23442 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,49 @@ +import java.util.Date +import java.text.SimpleDateFormat +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} +def timestamp = new SimpleDateFormat("MM_dd_HH_mm").format(new Date()) +android { + namespace 'com.braintest.brain.test' + compileSdk 34 + + defaultConfig { + //com.braintest.brain.iq + applicationId "com.braintest.brain.iq" + minSdk 23 + targetSdk 34 + versionCode 2 + versionName "1.0.1" + setProperty("archivesBaseName", "Brain Test_V" + versionName + "(${versionCode})_$timestamp") + } + + buildTypes { + release { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + buildFeatures { + viewBinding true + buildConfig true + } +} + +dependencies { + implementation 'androidx.core:core-ktx:1.7.0' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.12.0' + + implementation 'com.balysv:material-ripple:1.0.2' + implementation 'com.codemybrainsout.rating:ratingdialog:1.0.8' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..20a8078 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/braintest/brain/test/BrainTestApp.java b/app/src/main/java/com/braintest/brain/test/BrainTestApp.java new file mode 100644 index 0000000..65fa144 --- /dev/null +++ b/app/src/main/java/com/braintest/brain/test/BrainTestApp.java @@ -0,0 +1,23 @@ +package com.braintest.brain.test; + +import android.app.Activity; +import android.app.Application; +import android.view.View; + +public class BrainTestApp extends Application { + @Override + public void onCreate() { + super.onCreate(); + } + + public static void setStatusBar(Activity activity, boolean dark) { + View decor = activity.getWindow().getDecorView(); + if (dark) { + decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } else { + decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); + } + } +} diff --git a/app/src/main/java/com/braintest/brain/test/ConsValues.java b/app/src/main/java/com/braintest/brain/test/ConsValues.java new file mode 100644 index 0000000..73b1900 --- /dev/null +++ b/app/src/main/java/com/braintest/brain/test/ConsValues.java @@ -0,0 +1,14 @@ +package com.braintest.brain.test; + +public class ConsValues { + + + public static final String PRE_FILE = "Save_data"; + + public static final String LEVELS_NUMBER ="guan_number"; + + + + + +} diff --git a/app/src/main/java/com/braintest/brain/test/Data.java b/app/src/main/java/com/braintest/brain/test/Data.java new file mode 100644 index 0000000..a5f374d --- /dev/null +++ b/app/src/main/java/com/braintest/brain/test/Data.java @@ -0,0 +1,25 @@ +package com.braintest.brain.test; + +public class Data { + public Data(boolean isUnlock, int levels) { + this.isUnlock = isUnlock; + this.levels = levels; + } + + private boolean isUnlock; + private int levels; + + public void setUnlock(boolean unlock) { + isUnlock = unlock; + } + + + + public boolean isUnlock() { + return isUnlock; + } + + public int getLevels() { + return levels; + } +} diff --git a/app/src/main/java/com/braintest/brain/test/InfoActivity.java b/app/src/main/java/com/braintest/brain/test/InfoActivity.java new file mode 100644 index 0000000..8a77c61 --- /dev/null +++ b/app/src/main/java/com/braintest/brain/test/InfoActivity.java @@ -0,0 +1,382 @@ +package com.braintest.brain.test; + + +import android.annotation.SuppressLint; +import android.app.Dialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.drawable.ColorDrawable; +import android.os.Bundle; +import android.os.CountDownTimer; +import android.os.Handler; +import android.util.Log; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.ProgressBar; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +public class InfoActivity extends AppCompatActivity { + + private ProgressBar progressBar; + private CountDownTimer myTimer; + private int levelNumber; + private TextView questionText, textQuestionNumber; + private Button answer1, answer2, answer3, answer4; + + private Questions questions; + private String theCorrectAnswer; + private int questionNumber = 1; + private SharedPreferences prefs; + private SharedPreferences.Editor editor; +// private ImageView help; + private int gemsCount; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_game); + BrainTestApp.setStatusBar(this,true); + questionText = findViewById(R.id.QuestionText); + textQuestionNumber = findViewById(R.id.text_QuestionNumber); + answer1 = findViewById(R.id.Answer1_Btn); + answer2 = findViewById(R.id.Answer2_Btn); + answer3 = findViewById(R.id.Answer3_Btn); + answer4 = findViewById(R.id.Answer4_Btn); + + progressBar = findViewById(R.id.timer_progressBar); + + Bundle bundle = getIntent().getExtras(); + levelNumber = bundle.getInt(ConsValues.LEVELS_NUMBER); + questionNumber = (levelNumber-1)*5+questionNumber; + getNextQuestion(); + + + prefs = getSharedPreferences(ConsValues.PRE_FILE, Context.MODE_PRIVATE); + editor = prefs.edit(); + + answer1.setOnClickListener(v -> { + if (answer1.getText().toString().equals(theCorrectAnswer)) { + myTimer.cancel(); + delayNextQuestion(); + correctAnswer(answer1); + + } else { + myTimer.cancel(); + wrongAnswer(answer1); + delayExit(); + } + }); + + answer2.setOnClickListener(v -> { + if (answer2.getText().toString().equals(theCorrectAnswer)) { + myTimer.cancel(); + delayNextQuestion(); + correctAnswer(answer2); + + } else { + myTimer.cancel(); + wrongAnswer(answer2); + delayExit(); + } + }); + + answer3.setOnClickListener(v -> { + if (answer3.getText().toString().equals(theCorrectAnswer)) { + myTimer.cancel(); + delayNextQuestion(); + correctAnswer(answer3); + + } else { + myTimer.cancel(); + wrongAnswer(answer3); + delayExit(); + } + }); + + answer4.setOnClickListener(v -> { + if (answer4.getText().toString().equals(theCorrectAnswer)) { + myTimer.cancel(); + delayNextQuestion(); + correctAnswer(answer4); + + } else { + myTimer.cancel(); + wrongAnswer(answer4); + delayExit(); + } + }); + + + + + setProgressBar(); + } + + + + private void setHelperCount() { + gemsCount = gemsCount - 1; + prefs = getSharedPreferences("prefGem", Context.MODE_PRIVATE); + SharedPreferences.Editor editor = prefs.edit(); + editor.putInt("gems", gemsCount); + getHelpAnswer(questionNumber); + editor.apply(); + } + + private void setProgressBar() { + myTimer = new CountDownTimer(30000, 1000) { + @Override + public void onTick(long millisUntilFinished) { + long time = millisUntilFinished / 1000; + progressBar.setProgress(Integer.parseInt((String.valueOf(time)))); + + } + + @Override + public void onFinish() { + myTimer.cancel(); + showDialogTimeOut(); + } + }.start(); + } + + @SuppressLint({"SetTextI18n", "UseCompatLoadingForDrawables"}) + private void getNextQuestion() { + getQuestionNumbers(questionNumber); + + answer1.setBackground(getDrawable(R.drawable.background_item)); + answer2.setBackground(getDrawable(R.drawable.background_item)); + answer3.setBackground(getDrawable(R.drawable.background_item)); + answer4.setBackground(getDrawable(R.drawable.background_item)); + + textQuestionNumber.setText(getString(R.string.str_text_question) + " " + questionNumber); + } + + + private void getQuestionNumbers(int num) { + String[] theQuestion = questions.getQuestions(num); + questionText.setText(theQuestion[0]); + answer1.setText(theQuestion[1]); + answer2.setText(theQuestion[2]); + answer3.setText(theQuestion[3]); + answer4.setText(theQuestion[4]); + theCorrectAnswer = theQuestion[5]; + + + + } + + + private void getHelpAnswer(int num) { + String[] theQuestion = questions.getQuestions(num); + theCorrectAnswer = theQuestion[5]; + Toast.makeText(this, theCorrectAnswer.toString(), Toast.LENGTH_LONG).show(); + + } + + @SuppressLint("UseCompatLoadingForDrawables") + private void correctAnswer(Button button) { + button.setBackground(getDrawable(R.drawable.background_right)); + } + + @SuppressLint("UseCompatLoadingForDrawables") + private void wrongAnswer(Button button) { + button.setBackground(getDrawable(R.drawable.background_wrong)); + } + + private void delayExit() { + myTimer.cancel(); + disableClickButton(); + + if (answer1.getText().toString().equals(theCorrectAnswer)) { + correctAnswer(answer1); + } + if (answer2.getText().toString().equals(theCorrectAnswer)) { + correctAnswer(answer2); + } + if (answer3.getText().toString().equals(theCorrectAnswer)) { + correctAnswer(answer3); + } + if (answer4.getText().toString().equals(theCorrectAnswer)) { + correctAnswer(answer4); + } + + final Handler handler = new Handler(); + handler.postDelayed(() -> { + showDialogLose(); + }, 1000); + } + + private void delayNextQuestion() { + int i = questionNumber % 5; + if (i == 0) { + QuestionNumberFinish(questionNumber); + return; + } + final Handler handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + questionNumber++; + getNextQuestion(); + enableClickButton(); + setProgressBar(); + } + }, 1000); + + + } + + private void disableClickButton() { + answer1.setClickable(false); + answer2.setClickable(false); + answer3.setClickable(false); + answer4.setClickable(false); + } + + private void enableClickButton() { + answer1.setClickable(true); + answer2.setClickable(true); + answer3.setClickable(true); + answer4.setClickable(true); + } + + private void showDialogTimeOut() { + Dialog dialog = new Dialog(this); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before + dialog.setContentView(R.layout.layout_time_out); + dialog.setCancelable(false); + dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); + + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); + lp.copyFrom(dialog.getWindow().getAttributes()); + lp.width = WindowManager.LayoutParams.WRAP_CONTENT; + lp.height = WindowManager.LayoutParams.WRAP_CONTENT; + + dialog.findViewById(R.id.bt_play_again).setOnClickListener(v -> { + dialog.dismiss(); + finish(); + Bundle bundle = new Bundle(); + bundle.putInt(ConsValues.LEVELS_NUMBER, levelNumber); + Intent intent = new Intent(InfoActivity.this, InfoActivity.class); + intent.putExtras(bundle); + startActivity(intent); + }); + + dialog.findViewById(R.id.bt_close_icon).setOnClickListener(v -> { + dialog.dismiss(); + finish(); + }); + + dialog.findViewById(R.id.bt_close).setOnClickListener(v -> { + dialog.dismiss(); + finish(); + }); + + dialog.show(); + dialog.getWindow().setAttributes(lp); + } + + private void showDialogLose() { + Dialog dialog = new Dialog(this); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before + dialog.setContentView(R.layout.layout_lose); + dialog.setCancelable(false); + dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); + + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); + lp.copyFrom(dialog.getWindow().getAttributes()); + lp.width = WindowManager.LayoutParams.WRAP_CONTENT; + lp.height = WindowManager.LayoutParams.WRAP_CONTENT; + + dialog.findViewById(R.id.bt_play_again).setOnClickListener(v -> { + dialog.dismiss(); + finish(); + Bundle bundle = new Bundle(); + bundle.putInt(ConsValues.LEVELS_NUMBER, levelNumber); + Intent intent = new Intent(InfoActivity.this, InfoActivity.class); + intent.putExtras(bundle); + startActivity(intent); + }); + + dialog.findViewById(R.id.bt_close_icon).setOnClickListener(v -> { + dialog.dismiss(); + finish(); + }); + + dialog.findViewById(R.id.bt_close).setOnClickListener(v -> { + dialog.dismiss(); + finish(); + }); + + dialog.show(); + dialog.getWindow().setAttributes(lp); + } + + private void setDialogWon() { + Dialog dialog = new Dialog(this); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before + dialog.setContentView(R.layout.layout_win); + dialog.setCancelable(false); + dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); + + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); + lp.copyFrom(dialog.getWindow().getAttributes()); + lp.width = WindowManager.LayoutParams.WRAP_CONTENT; + lp.height = WindowManager.LayoutParams.WRAP_CONTENT; + + dialog.findViewById(R.id.bt_play_again).setOnClickListener(v -> { + finish(); + myTimer.cancel(); + levelNumber++; + Bundle bundle = new Bundle(); + bundle.putInt(ConsValues.LEVELS_NUMBER, levelNumber); + Intent intent = new Intent(InfoActivity.this, InfoActivity.class); + intent.putExtras(bundle); + startActivity(intent); + }); + + dialog.findViewById(R.id.bt_close_icon).setOnClickListener(v -> { + dialog.dismiss(); + finish(); + }); + + dialog.findViewById(R.id.bt_close).setOnClickListener(v -> { + dialog.dismiss(); + finish(); + }); + + dialog.show(); + dialog.getWindow().setAttributes(lp); + } + + private void QuestionNumberFinish(int number) { + int g = number / 6; + String format = String.format(getString(R.string.str_LevelValue), String.valueOf(levelNumber + 1)); + Log.d("-----", "----------format=" + format + "---number=" + number); + setDialogWon(); + editor.putBoolean(format, true); + editor.apply(); + + + } + + + + @Override + protected void onPause() { + super.onPause(); + myTimer.cancel(); + } + + @Override + public void onBackPressed() { + myTimer.cancel(); + super.onBackPressed(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/braintest/brain/test/LevelsPage.java b/app/src/main/java/com/braintest/brain/test/LevelsPage.java new file mode 100644 index 0000000..8f00425 --- /dev/null +++ b/app/src/main/java/com/braintest/brain/test/LevelsPage.java @@ -0,0 +1,80 @@ +package com.braintest.brain.test; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.content.Context; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.view.View; +import android.widget.ImageView; + +import java.util.ArrayList; +import java.util.List; + +public class LevelsPage extends AppCompatActivity { + + + SharedPreferences prefs; + private RecyclerView recyclerView; + private List list; + private MyAdapter myAdapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_levels); + BrainTestApp.setStatusBar(this,true); + recyclerView = findViewById(R.id.levels_list); + ImageView back = findViewById(R.id.back); + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + }); + prefs = getSharedPreferences(ConsValues.PRE_FILE, Context.MODE_PRIVATE); + + + initList(); + + } + + private void initList() { + SharedPreferences.Editor edit = prefs.edit(); + edit.putBoolean(String.format(getString(R.string.str_LevelValue), String.valueOf(1)), true); + edit.apply(); + list = new ArrayList<>(); + for (int i = 0; i < 20; i++) { + Data levelsBean; + int levels = i + 1; + String format = String.format(getString(R.string.str_LevelValue), String.valueOf(levels)); + boolean aBoolean = prefs.getBoolean(format, false); + levelsBean = new Data(aBoolean, levels); + list.add(levelsBean); + } + myAdapter = new MyAdapter(this, list); + recyclerView.setAdapter(myAdapter); + recyclerView.setLayoutManager(new GridLayoutManager(this, 3)); + + } + + + @Override + protected void onStart() { + super.onStart(); + + for (Data bean : list) { + int index = list.indexOf(bean); + String format = String.format(getString(R.string.str_LevelValue), String.valueOf(bean.getLevels())); + boolean aBoolean = prefs.getBoolean(format, false); + if (aBoolean) { + bean.setUnlock(aBoolean); + myAdapter.updateUnlock(index); + } + } + + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/braintest/brain/test/MainActivity.java b/app/src/main/java/com/braintest/brain/test/MainActivity.java new file mode 100644 index 0000000..abeb383 --- /dev/null +++ b/app/src/main/java/com/braintest/brain/test/MainActivity.java @@ -0,0 +1,47 @@ +package com.braintest.brain.test; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +public class MainActivity extends AppCompatActivity { + + TextView startBtn, exitBtn, aboutBtn; + + ImageView ImSet; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + BrainTestApp.setStatusBar(this,true); + startBtn = findViewById(R.id.btn_play); + ImSet = findViewById(R.id.im_set); + startBtn.setOnClickListener(v -> { + Intent page2 = new Intent(MainActivity.this, LevelsPage.class); + startActivity(page2); + }); + + ImSet.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent page2 = new Intent(MainActivity.this, SetActivity.class); + startActivity(page2); + } + }); + + +// +// aboutBtn.setOnClickListener(v -> showDialogAbout()); +// +// exitBtn.setOnClickListener(v -> finish()); + } + + + + +} diff --git a/app/src/main/java/com/braintest/brain/test/MyAdapter.java b/app/src/main/java/com/braintest/brain/test/MyAdapter.java new file mode 100644 index 0000000..caed048 --- /dev/null +++ b/app/src/main/java/com/braintest/brain/test/MyAdapter.java @@ -0,0 +1,78 @@ +package com.braintest.brain.test; + +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.braintest.brain.test.databinding.ItemLayoutBinding; + +import java.util.List; + +public class MyAdapter extends RecyclerView.Adapter { + + private Context mContext; + + private List list; + + public MyAdapter(Context context, List list) { + mContext = context; + this.list = list; + } + + @NonNull + @Override + public LevelsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + ItemLayoutBinding levelsBinding = ItemLayoutBinding.inflate(LayoutInflater.from(parent.getContext()), null, false); + return new LevelsViewHolder(levelsBinding); + } + + @Override + public void onBindViewHolder(@NonNull LevelsViewHolder holder, int position) { + int i = position + 1; + holder.itemLevelsBinding.levelsBtn.setOnClickListener(v -> { + Bundle bundle = new Bundle(); + bundle.putInt(ConsValues.LEVELS_NUMBER, i); + Intent quiz = new Intent(mContext, InfoActivity.class); + quiz.putExtras(bundle); + mContext.startActivity(quiz); + }); + + Data levelsBean = list.get(position); + holder.itemLevelsBinding.levelsBtn.setText(String.valueOf(levelsBean.getLevels())); + if (levelsBean.isUnlock()) { + holder.itemLevelsBinding.levelsBtn.setClickable(true); + holder.itemLevelsBinding.levelsBtn.setAlpha(1f); + } else { + holder.itemLevelsBinding.levelsBtn.setClickable(false); + holder.itemLevelsBinding.levelsBtn.setAlpha(0.64f); + } + + + + } + + public void updateUnlock(int pos) { + notifyItemChanged(pos); + } + + @Override + public int getItemCount() { + return list.size(); + } + + public static class LevelsViewHolder extends RecyclerView.ViewHolder { + + + private ItemLayoutBinding itemLevelsBinding; + + public LevelsViewHolder(@NonNull ItemLayoutBinding itemView) { + super(itemView.getRoot()); + itemLevelsBinding = itemView; + } + } +} diff --git a/app/src/main/java/com/braintest/brain/test/Questions.java b/app/src/main/java/com/braintest/brain/test/Questions.java new file mode 100644 index 0000000..477783b --- /dev/null +++ b/app/src/main/java/com/braintest/brain/test/Questions.java @@ -0,0 +1,1112 @@ +package com.braintest.brain.test; + +public class Questions { + + + public static String[] getQuestions(int questionID) { + String[] questionText = new String[6]; + { + if (questionID == 1) + { + questionText[0] = "Which shape fits best to complete the pattern?"; + questionText[1] = "Circle"; + questionText[2] = "Triangle"; + questionText[3] = "Square"; + questionText[4] = "Hexagon"; + questionText[5] = "Square"; // The Right Answer + } + + + if (questionID == 2) + { + questionText[0] = "If all Bloops are Razzies and all Razzies are Lazzies, are all Bloops definitely Lazzies?"; + questionText[1] = "No"; + questionText[2] = "Yes"; + questionText[3] = "Maybe"; + questionText[4] = "Cannot be determined"; + questionText[5] = "Yes"; // The Right Answer + } + + + if (questionID == 3) + { + questionText[0] = "Which number is missing: 3, 7, 11, ?, 19"; + questionText[1] = "13"; + questionText[2] = "15"; + questionText[3] = "17"; + questionText[4] = "21"; + questionText[5] = "15"; // The Right Answer + } + + + if (questionID == 4) + { + questionText[0] = "What is 15% of 700?"; + questionText[1] = "25"; + questionText[2] = "30"; + questionText[3] = "105"; + questionText[4] = "40"; + questionText[5] = "105"; // The Right Answer + } + + + if (questionID == 5) + { + questionText[0] = "Which word does not belong: Apple, Orange, Banana, Carrot"; + questionText[1] = "Apple"; + questionText[2] = "Orange"; + questionText[3] = "Banana"; + questionText[4] = "Carrot"; + questionText[5] = "Carrot"; // The Right Answer + } + + + if (questionID == 6) + { + questionText[0] = "Which letter comes next in the series: D, F, H, J, ?"; + questionText[1] = "K"; + questionText[2] = "L"; + questionText[3] = "M"; + questionText[4] = "N"; + questionText[5] = "L"; // The Right Answer + } + + + if (questionID == 7) + { + questionText[0] = "What is the sum of the angles in a triangle?"; + questionText[1] = "180 degrees"; + questionText[2] = "360 degrees"; + questionText[3] = "90 degrees"; + questionText[4] = "270 degrees"; + questionText[5] = "180 degrees"; // The Right Answer + } + + + if (questionID == 8) + { + questionText[0] = "What is the square root of 144?"; + questionText[1] = "10"; + questionText[2] = "11"; + questionText[3] = "12"; + questionText[4] = "13"; + questionText[5] = "12"; // The Right Answer + } + + + if (questionID == 9) + { + questionText[0] = "Which is the odd one out: Cat, Dog, Bird, Fish?"; + questionText[1] = "Cat"; + questionText[2] = "Dog"; + questionText[3] = "Bird"; + questionText[4] = "Fish"; + questionText[5] = "Fish"; // The Right Answer + } + + + if (questionID == 10) + { + questionText[0] = "Which number should come next in the pattern: 1, 4, 9, 16, ?"; + questionText[1] = "20"; + questionText[2] = "25"; + questionText[3] = "30"; + questionText[4] = "36"; + questionText[5] = "25"; // The Right Answer + } + + + if (questionID == 11) + { + questionText[0] = "What is the result of 3^3?"; + questionText[1] = "6"; + questionText[2] = "9"; + questionText[3] = "27"; + questionText[4] = "81"; + questionText[5] = "27"; // The Right Answer + } + + + if (questionID == 12) + { + questionText[0] = "If it takes 6 men 10 hours to build a wall, how long will it take 5 men to build the same wall?"; + questionText[1] = "8 hours"; + questionText[2] = "10 hours"; + questionText[3] = "12 hours"; + questionText[4] = "15 hours"; + questionText[5] = "12 hours"; // The Right Answer + } + + + if (questionID == 13) + { + questionText[0] = "Which city is the capital of France?"; + questionText[1] = "London"; + questionText[2] = "Berlin"; + questionText[3] = "Paris"; + questionText[4] = "Rome"; + questionText[5] = "Paris"; // The Right Answer + } + + + if (questionID == 14) + { + questionText[0] = "Which is the largest planet in our solar system?"; + questionText[1] = "Earth"; + questionText[2] = "Mars"; + questionText[3] = "Jupiter"; + questionText[4] = "Saturn"; + questionText[5] = "Jupiter"; // The Right Answer + } + + + if (questionID == 15) + { + questionText[0] = "What is the value of pi (π) to two decimal places?"; + questionText[1] = "3.12"; + questionText[2] = "3.14"; + questionText[3] = "3.16"; + questionText[4] = "3.18"; + questionText[5] = "3.14"; // The Right Answer + } + + + if (questionID == 16) + { + questionText[0] = "Which of the following is a prime number?"; + questionText[1] = "15"; + questionText[2] = "21"; + questionText[3] = "23"; + questionText[4] = "27"; + questionText[5] = "23"; // The Right Answer + } + + + if (questionID == 17) + { + questionText[0] = "What comes next in the sequence: Monday, Thursday, Sunday, Wednesday, ?"; + questionText[1] = "Friday"; + questionText[2] = "Tuesday"; + questionText[3] = "Saturday"; + questionText[4] = "Monday"; + questionText[5] = "Saturday"; // The Right Answer + } + + + if (questionID == 18) + { + questionText[0] = "What is the cube root of 27?"; + questionText[1] = "2"; + questionText[2] = "3"; + questionText[3] = "4"; + questionText[4] = "5"; + questionText[5] = "3"; // The Right Answer + } + + + if (questionID == 19) + { + questionText[0] = "Which word means the opposite of 'ascend'?"; + questionText[1] = "Climb"; + questionText[2] = "Increase"; + questionText[3] = "Decline"; + questionText[4] = "Rise"; + questionText[5] = "Decline"; // The Right Answer + } + + + if (questionID == 20) + { + questionText[0] = "What comes next in the sequence: 2, 4, 8, 16, ?"; + questionText[1] = "20"; + questionText[2] = "24"; + questionText[3] = "32"; + questionText[4] = "18"; + questionText[5] = "32"; // The Right Answer + } + + + if (questionID == 21) + { + questionText[0] = "Which of the following is a prime number?"; + questionText[1] = "4"; + questionText[2] = "6"; + questionText[3] = "9"; + questionText[4] = "11"; + questionText[5] = "11"; // The Right Answer + } + + + if (questionID == 22) + { + questionText[0] = "What is the square root of 81?"; + questionText[1] = "6"; + questionText[2] = "7"; + questionText[3] = "8"; + questionText[4] = "9"; + questionText[5] = "9"; // The Right Answer + } + + + if (questionID == 23) + { + questionText[0] = "Which shape has four equal sides?"; + questionText[1] = "Rectangle"; + questionText[2] = "Triangle"; + questionText[3] = "Pentagon"; + questionText[4] = "Square"; + questionText[5] = "Square"; // The Right Answer + } + + + if (questionID == 24) + { + questionText[0] = "What is the next number in the series: 1, 1, 2, 3, 5, 8, ?"; + questionText[1] = "10"; + questionText[2] = "11"; + questionText[3] = "12"; + questionText[4] = "13"; + questionText[5] = "13"; // The Right Answer + } + + + if (questionID == 25) + { + questionText[0] = "Which one of these is a mammal?"; + questionText[1] = "Shark"; + questionText[2] = "Frog"; + questionText[3] = "Eagle"; + questionText[4] = "Dolphin"; + questionText[5] = "Dolphin"; // The Right Answer + } + + + if (questionID == 26) + { + questionText[0] = "Which number is missing in the pattern? 2, 6, 12, ?, 30"; + questionText[1] = "18"; + questionText[2] = "20"; + questionText[3] = "22"; + questionText[4] = "24"; + questionText[5] = "24"; // The Right Answer + } + + + if (questionID == 27) + { + questionText[0] = "Which of the following is not an anagram of 'LISTEN'?"; + questionText[1] = "SILENT"; + questionText[2] = "TINSEL"; + questionText[3] = "ENLIST"; + questionText[4] = "INLETS"; + questionText[5] = "INLETS"; // The Right Answer + } + + + if (questionID == 28) + { + questionText[0] = "How many sides does a hexagon have?"; + questionText[1] = "4"; + questionText[2] = "5"; + questionText[3] = "7"; + questionText[4] = "6"; + questionText[5] = "6"; // The Right Answer + } + + + if (questionID == 29) + { + questionText[0] = "Which of these words is most similar to 'happy'?"; + questionText[1] = "Sad"; + questionText[2] = "Angry"; + questionText[3] = "Joyful"; + questionText[4] = "Tired"; + questionText[5] = "Joyful"; // The Right Answer + } + + + if (questionID == 30) + { + questionText[0] = "What is the capital of France?"; + questionText[1] = "Berlin"; + questionText[2] = "Madrid"; + questionText[3] = "Rome"; + questionText[4] = "Paris"; + questionText[5] = "Paris"; // The Right Answer + } + + + if (questionID == 31) + { + questionText[0] = "Which of the following is an even number?"; + questionText[1] = "9"; + questionText[2] = "11"; + questionText[3] = "15"; + questionText[4] = "20"; + questionText[5] = "20"; // The Right Answer + } + + + if (questionID == 32) + { + questionText[0] = "Which letter comes next in the sequence: A, C, E, G, ?"; + questionText[1] = "H"; + questionText[2] = "I"; + questionText[3] = "J"; + questionText[4] = "K"; + questionText[5] = "I"; // The Right Answer + } + + + if (questionID == 33) + { + questionText[0] = "What is the result of 7 * 6?"; + questionText[1] = "40"; + questionText[2] = "42"; + questionText[3] = "44"; + questionText[4] = "48"; + questionText[5] = "42"; // The Right Answer + } + + + if (questionID == 34) + { + questionText[0] = "Which planet is known as the Red Planet?"; + questionText[1] = "Earth"; + questionText[2] = "Jupiter"; + questionText[3] = "Saturn"; + questionText[4] = "Mars"; + questionText[5] = "Mars"; // The Right Answer + } + + + if (questionID == 35) + { + questionText[0] = "Which of these is a synonym for 'quick'?"; + questionText[1] = "Slow"; + questionText[2] = "Fast"; + questionText[3] = "Lazy"; + questionText[4] = "Heavy"; + questionText[5] = "Fast"; // The Right Answer + } + + + if (questionID == 36) + { + questionText[0] = "What is the sum of the interior angles of a triangle?"; + questionText[1] = "90 degrees"; + questionText[2] = "180 degrees"; + questionText[3] = "270 degrees"; + questionText[4] = "360 degrees"; + questionText[5] = "180 degrees"; // The Right Answer + } + + + if (questionID == 37) + { + questionText[0] = "Which of the following is not a fruit?"; + questionText[1] = "Apple"; + questionText[2] = "Carrot"; + questionText[3] = "Banana"; + questionText[4] = "Orange"; + questionText[5] = "Carrot"; // The Right Answer + } + + + if (questionID == 38) + { + questionText[0] = "How many continents are there on Earth?"; + questionText[1] = "5"; + questionText[2] = "6"; + questionText[3] = "7"; + questionText[4] = "8"; + questionText[5] = "7"; // The Right Answer + } + + + if (questionID == 39) + { + questionText[0] = "What is the value of Pi to two decimal places?"; + questionText[1] = "3.12"; + questionText[2] = "3.14"; + questionText[3] = "3.16"; + questionText[4] = "3.18"; + questionText[5] = "3.14"; // The Right Answer + } + + + if (questionID == 40) + { + questionText[0] = "What is the next number in the sequence: 2, 4, 8, 16, ?"; + questionText[1] = "20"; + questionText[2] = "24"; + questionText[3] = "32"; + questionText[4] = "18"; + questionText[5] = "32"; // The Right Answer + } + + + if (questionID == 41) + { + questionText[0] = "Which shape does not belong in the following sequence: Circle, Square, Triangle, Oval?"; + questionText[1] = "Circle"; + questionText[2] = "Square"; + questionText[3] = "Triangle"; + questionText[4] = "Oval"; + questionText[5] = "Square"; // The Right Answer + } + + + if (questionID == 42) + { + questionText[0] = "If all Bloops are Razzies and all Razzies are Lazzies, are all Bloops definitely Lazzies?"; + questionText[1] = "Yes"; + questionText[2] = "No"; + questionText[3] = "Cannot be determined"; + questionText[4] = "Only some Bloops are Lazzies"; + questionText[5] = "Yes"; // The Right Answer + } + + + if (questionID == 43) + { + questionText[0] = "Which number is the odd one out: 2, 3, 5, 7, 9?"; + questionText[1] = "2"; + questionText[2] = "7"; + questionText[3] = "9"; + questionText[4] = "5"; + questionText[5] = "9"; // The Right Answer + } + + + if (questionID == 44) + { + questionText[0] = "Complete the analogy: Dog is to Bark as Cat is to ?"; + questionText[1] = "Meow"; + questionText[2] = "Growl"; + questionText[3] = "Roar"; + questionText[4] = "Chirp"; + questionText[5] = "Meow"; // The Right Answer + } + + + if (questionID == 45) + { + questionText[0] = "Which of the following is not a prime number: 11, 17, 19, 21?"; + questionText[1] = "11"; + questionText[2] = "17"; + questionText[3] = "21"; + questionText[4] = "19"; + questionText[5] = "21"; // The Right Answer + } + + + if (questionID == 46) + { + questionText[0] = "If you rearrange the letters 'CIFAIPC', you would have the name of a:"; + questionText[1] = "Country"; + questionText[2] = "City"; + questionText[3] = "Animal"; + questionText[4] = "Ocean"; + questionText[5] = "Ocean"; // The Right Answer + } + + + if (questionID == 47) + { + questionText[0] = "What is the next letter in the sequence: A, C, E, G, ?"; + questionText[1] = "I"; + questionText[2] = "J"; + questionText[3] = "H"; + questionText[4] = "K"; + questionText[5] = "I"; // The Right Answer + } + + + if (questionID == 48) + { + questionText[0] = "Which word does not belong: Apple, Banana, Grape, Carrot?"; + questionText[1] = "Apple"; + questionText[2] = "Banana"; + questionText[3] = "Grape"; + questionText[4] = "Carrot"; + questionText[5] = "Carrot"; // The Right Answer + } + + + if (questionID == 49) + { + questionText[0] = "What is 15% of 200?"; + questionText[1] = "20"; + questionText[2] = "30"; + questionText[3] = "25"; + questionText[4] = "35"; + questionText[5] = "30"; // The Right Answer + } + + + if (questionID == 50) + { + questionText[0] = "Which number logically follows this series: 1, 4, 9, 16, 25, ?"; + questionText[1] = "30"; + questionText[2] = "35"; + questionText[3] = "36"; + questionText[4] = "40"; + questionText[5] = "36"; // The Right Answer + } + + + if (questionID == 51) + { + questionText[0] = "What comes next in the pattern: 1, 1, 2, 3, 5, ?"; + questionText[1] = "6"; + questionText[2] = "7"; + questionText[3] = "8"; + questionText[4] = "9"; + questionText[5] = "8"; // The Right Answer + } + + + if (questionID == 52) + { + questionText[0] = "If you write down all the numbers from 1 to 100, how many times do you write the number 7?"; + questionText[1] = "10"; + questionText[2] = "11"; + questionText[3] = "20"; + questionText[4] = "19"; + questionText[5] = "20"; // The Right Answer + } + + + if (questionID == 53) + { + questionText[0] = "Which of the following is a palindrome?"; + questionText[1] = "12321"; + questionText[2] = "12345"; + questionText[3] = "54321"; + questionText[4] = "67890"; + questionText[5] = "12321"; // The Right Answer + } + + + if (questionID == 54) + { + questionText[0] = "What is the result of the following calculation: 3^3?"; + questionText[1] = "6"; + questionText[2] = "9"; + questionText[3] = "27"; + questionText[4] = "81"; + questionText[5] = "27"; // The Right Answer + } + + + if (questionID == 55) + { + questionText[0] = "What is the capital of France?"; + questionText[1] = "London"; + questionText[2] = "Berlin"; + questionText[3] = "Madrid"; + questionText[4] = "Paris"; + questionText[5] = "Paris"; // The Right Answer + } + + + if (questionID == 56) + { + questionText[0] = "Which of the following numbers is a perfect square?"; + questionText[1] = "16"; + questionText[2] = "18"; + questionText[3] = "20"; + questionText[4] = "22"; + questionText[5] = "16"; // The Right Answer + } + + + if (questionID == 57) + { + questionText[0] = "Solve the equation: 2x + 3"; + questionText[1] = "2"; + questionText[2] = "3"; + questionText[3] = "4"; + questionText[4] = "5"; + questionText[5] = "4"; // The Right Answer + } + + + if (questionID == 58) + { + questionText[0] = "Which planet is closest to the sun?"; + questionText[1] = "Earth"; + questionText[2] = "Mars"; + questionText[3] = "Venus"; + questionText[4] = "Mercury"; + questionText[5] = "Mercury"; // The Right Answer + } + + + if (questionID == 59) + { + questionText[0] = "How many sides does a hexagon have?"; + questionText[1] = "5"; + questionText[2] = "6"; + questionText[3] = "7"; + questionText[4] = "8"; + questionText[5] = "6"; // The Right Answer + } + + + if (questionID == 60) + { + questionText[0] = "What is the next number in the series: 2, 6, 12, 20, ?"; + questionText[1] = "30"; + questionText[2] = "28"; + questionText[3] = "26"; + questionText[4] = "24"; + questionText[5] = "30"; // The Right Answer + } + + + if (questionID == 61) + { + questionText[0] = "Which of the following shapes can be folded to make a cube?"; + questionText[1] = "Shape A"; + questionText[2] = "Shape B"; + questionText[3] = "Shape C"; + questionText[4] = "Shape D"; + questionText[5] = "Shape B"; // The Right Answer + } + + + if (questionID == 62) + { + questionText[0] = "If all Bloops are Razzies and all Razzies are Lazzies, then all Bloops are definitely:"; + questionText[1] = "Bloops"; + questionText[2] = "Razzies"; + questionText[3] = "Lazzies"; + questionText[4] = "None of the above"; + questionText[5] = "Lazzies"; // The Right Answer + } + + + if (questionID == 63) + { + questionText[0] = "If it takes 5 machines 5 minutes to make 5 widgets, how long would it take 100 machines to make 100 widgets?"; + questionText[1] = "100 minutes"; + questionText[2] = "50 minutes"; + questionText[3] = "5 minutes"; + questionText[4] = "10 minutes"; + questionText[5] = "5 minutes"; // The Right Answer + } + + + if (questionID == 64) + { + questionText[0] = "Which word does not belong in the following list: Apple, Banana, Cherry, Carrot?"; + questionText[1] = "Apple"; + questionText[2] = "Banana"; + questionText[3] = "Cherry"; + questionText[4] = "Carrot"; + questionText[5] = "Carrot"; // The Right Answer + } + + + if (questionID == 65) + { + questionText[0] = "What is the missing number in the sequence: 1, 4, 9, 16, 25, ?"; + questionText[1] = "30"; + questionText[2] = "35"; + questionText[3] = "36"; + questionText[4] = "40"; + questionText[5] = "36"; // The Right Answer + } + + + if (questionID == 66) + { + questionText[0] = "Which one of the following is a prime number?"; + questionText[1] = "4"; + questionText[2] = "6"; + questionText[3] = "9"; + questionText[4] = "11"; + questionText[5] = "11"; // The Right Answer + } + + + if (questionID == 67) + { + questionText[0] = "What is the value of X in the equation 2X + 3"; + questionText[1] = "2"; + questionText[2] = "3"; + questionText[3] = "4"; + questionText[4] = "5"; + questionText[5] = "4"; // The Right Answer + } + + + if (questionID == 68) + { + questionText[0] = "If you rearrange the letters 'CIFAIPC' you would have the name of a:"; + questionText[1] = "City"; + questionText[2] = "Animal"; + questionText[3] = "Ocean"; + questionText[4] = "Country"; + questionText[5] = "Ocean"; // The Right Answer + } + + + if (questionID == 69) + { + questionText[0] = "Which number is missing: 3, 7, 11, 15, ?"; + questionText[1] = "18"; + questionText[2] = "19"; + questionText[3] = "20"; + questionText[4] = "21"; + questionText[5] = "19"; // The Right Answer + } + + + if (questionID == 70) + { + questionText[0] = "If a red house is made from red bricks and a blue house is made from blue bricks, what is a greenhouse made from?"; + questionText[1] = "Red bricks"; + questionText[2] = "Blue bricks"; + questionText[3] = "Green bricks"; + questionText[4] = "Glass"; + questionText[5] = "Glass"; // The Right Answer + } + + + if (questionID == 71) + { + questionText[0] = "Which of the following numbers is divisible by 3?"; + questionText[1] = "10"; + questionText[2] = "14"; + questionText[3] = "21"; + questionText[4] = "25"; + questionText[5] = "21"; // The Right Answer + } + + + if (questionID == 72) + { + questionText[0] = "Find the odd one out: 2, 3, 5, 7, 8, 11, 13"; + questionText[1] = "3"; + questionText[2] = "5"; + questionText[3] = "8"; + questionText[4] = "11"; + questionText[5] = "8"; // The Right Answer + } + + + if (questionID == 73) + { + questionText[0] = "What is the next letter in the sequence: A, C, E, G, ?"; + questionText[1] = "H"; + questionText[2] = "I"; + questionText[3] = "J"; + questionText[4] = "K"; + questionText[5] = "I"; // The Right Answer + } + + + if (questionID == 74) + { + questionText[0] = "Which of the following is an anagram of the word 'LISTEN'?"; + questionText[1] = "SILENT"; + questionText[2] = "LENTIS"; + questionText[3] = "TINSEL"; + questionText[4] = "ENLIST"; + questionText[5] = "SILENT"; // The Right Answer + } + + + if (questionID == 75) + { + questionText[0] = "What is the missing number in the sequence: 10, 20, 30, ?, 50"; + questionText[1] = "35"; + questionText[2] = "40"; + questionText[3] = "45"; + questionText[4] = "55"; + questionText[5] = "40"; // The Right Answer + } + + + if (questionID == 76) + { + questionText[0] = "What is 15% of 200?"; + questionText[1] = "20"; + questionText[2] = "25"; + questionText[3] = "30"; + questionText[4] = "35"; + questionText[5] = "30"; // The Right Answer + } + + + if (questionID == 77) + { + questionText[0] = "Which of the following is a palindrome?"; + questionText[1] = "LEVEL"; + questionText[2] = "NURSE"; + questionText[3] = "RACECAR"; + questionText[4] = "DEED"; + questionText[5] = "RACECAR"; // The Right Answer + } + + + if (questionID == 78) + { + questionText[0] = " What city serves as the capital of France?"; + questionText[1] = "Berlin"; + questionText[2] = "Madrid"; + questionText[3] = "Paris"; + questionText[4] = "Rome"; + questionText[5] = "Paris"; // The Right Answer + } + + + if (questionID == 79) + { + questionText[0] = "If a train travels at a speed of 60 miles per hour, how long will it take to travel 180 miles?"; + questionText[1] = "2 hours"; + questionText[2] = "2.5 hours"; + questionText[3] = "3 hours"; + questionText[4] = "3.5 hours"; + questionText[5] = "3 hours"; // The Right Answer + } + + + if (questionID == 80) + { + questionText[0] = "What comes next in the sequence: 2, 4, 8, 16, ?"; + questionText[1] = "20"; + questionText[2] = "24"; + questionText[3] = "32"; + questionText[4] = "18"; + questionText[5] = "32"; // The Right Answer + } + + + if (questionID == 81) + { + questionText[0] = "What is the sum of the angles in a triangle?"; + questionText[1] = "360 degrees"; + questionText[2] = "180 degrees"; + questionText[3] = "90 degrees"; + questionText[4] = "120 degrees"; + questionText[5] = "180 degrees"; // The Right Answer + } + + + if (questionID == 82) + { + questionText[0] = "Which of the following is a prime number?"; + questionText[1] = "4"; + questionText[2] = "16"; + questionText[3] = "9"; + questionText[4] = "11"; + questionText[5] = "11"; // The Right Answer + } + + + if (questionID == 83) + { + questionText[0] = "What is the next number in the series: 1, 1, 2, 3, 5, ?"; + questionText[1] = "6"; + questionText[2] = "7"; + questionText[3] = "8"; + questionText[4] = "9"; + questionText[5] = "8"; // The Right Answer + } + + + if (questionID == 84) + { + questionText[0] = "Which shape has four equal sides and four right angles?"; + questionText[1] = "Rectangle"; + questionText[2] = "Triangle"; + questionText[3] = "Circle"; + questionText[4] = "Square"; + questionText[5] = "Square"; // The Right Answer + } + + + if (questionID == 85) + { + questionText[0] = " What city serves as the capital of France?"; + questionText[1] = "Berlin"; + questionText[2] = "Madrid"; + questionText[3] = "Rome"; + questionText[4] = "Paris"; + questionText[5] = "Paris"; // The Right Answer + } + + + if (questionID == 86) + { + questionText[0] = "What is 15% of 200?"; + questionText[1] = "20"; + questionText[2] = "25"; + questionText[3] = "30"; + questionText[4] = "35"; + questionText[5] = "30"; // The Right Answer + } + + + if (questionID == 87) + { + questionText[0] = "Which word does not belong: Apple, Banana, Carrot, Orange?"; + questionText[1] = "Apple"; + questionText[2] = "Banana"; + questionText[3] = "Carrot"; + questionText[4] = "Orange"; + questionText[5] = "Carrot"; // The Right Answer + } + + + if (questionID == 88) + { + questionText[0] = "What is the sum of 1/2 and 1/4?"; + questionText[1] = "1/4"; + questionText[2] = "1/2"; + questionText[3] = "3/4"; + questionText[4] = "1"; + questionText[5] = "3/4"; // The Right Answer + } + + + if (questionID == 89) + { + questionText[0] = "Which of the following is the largest: 25, 2^5, 5!, sqrt(625)?"; + questionText[1] = "25"; + questionText[2] = "2^5"; + questionText[3] = "5!"; + questionText[4] = "sqrt(625)"; + questionText[5] = "5!"; // The Right Answer + } + + + if (questionID == 90) + { + questionText[0] = "What is the capital of Japan?"; + questionText[1] = "Beijing"; + questionText[2] = "Seoul"; + questionText[3] = "Bangkok"; + questionText[4] = "Tokyo"; + questionText[5] = "Tokyo"; // The Right Answer + } + + + if (questionID == 91) + { + questionText[0] = "What is the boiling point of water in Celsius?"; + questionText[1] = "50 degrees"; + questionText[2] = "100 degrees"; + questionText[3] = "150 degrees"; + questionText[4] = "200 degrees"; + questionText[5] = "100 degrees"; // The Right Answer + } + + + if (questionID == 92) + { + questionText[0] = "Which planet is known as the Red Planet?"; + questionText[1] = "Earth"; + questionText[2] = "Jupiter"; + questionText[3] = "Mars"; + questionText[4] = "Saturn"; + questionText[5] = "Mars"; // The Right Answer + } + + + if (questionID == 93) + { + questionText[0] = "What is the chemical symbol for water?"; + questionText[1] = "O2"; + questionText[2] = "H2"; + questionText[3] = "CO2"; + questionText[4] = "H2O"; + questionText[5] = "H2O"; // The Right Answer + } + + + if (questionID == 94) + { + questionText[0] = "What is 7 multiplied by 8?"; + questionText[1] = "54"; + questionText[2] = "56"; + questionText[3] = "58"; + questionText[4] = "60"; + questionText[5] = "56"; // The Right Answer + } + + + if (questionID == 95) + { + questionText[0] = "What is the value of pi to two decimal places?"; + questionText[1] = "3.12"; + questionText[2] = "3.14"; + questionText[3] = "3.16"; + questionText[4] = "3.18"; + questionText[5] = "3.14"; // The Right Answer + } + + + if (questionID == 96) + { + questionText[0] = "What is the main ingredient in guacamole?"; + questionText[1] = "Tomato"; + questionText[2] = "Onion"; + questionText[3] = "Avocado"; + questionText[4] = "Pepper"; + questionText[5] = "Avocado"; // The Right Answer + } + + + if (questionID == 97) + { + questionText[0] = "Which country is the largest by area?"; + questionText[1] = "Canada"; + questionText[2] = "China"; + questionText[3] = "Russia"; + questionText[4] = "USA"; + questionText[5] = "Russia"; // The Right Answer + } + + + if (questionID == 98) + { + questionText[0] = "What is the square root of 144?"; + questionText[1] = "10"; + questionText[2] = "11"; + questionText[3] = "14"; + questionText[4] = "12"; + questionText[5] = "12"; // The Right Answer + } + + + if (questionID == 99) + { + questionText[0] = "What is the largest ocean on Earth?"; + questionText[1] = "Atlantic Ocean"; + questionText[2] = "Indian Ocean"; + questionText[3] = "Arctic Ocean"; + questionText[4] = "Pacific Ocean"; + questionText[5] = "Pacific Ocean"; // The Right Answer + } + + if (questionID == 100) + { + questionText[0] = "What is the next number in the sequence: 2, 6, 12, 20, ?"; + questionText[1] = "26"; + questionText[2] = "30"; + questionText[3] = "34"; + questionText[4] = "40"; + questionText[5] = "30"; // The Right Answer + } + + + } + + return questionText; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/braintest/brain/test/SetActivity.java b/app/src/main/java/com/braintest/brain/test/SetActivity.java new file mode 100644 index 0000000..b32aea0 --- /dev/null +++ b/app/src/main/java/com/braintest/brain/test/SetActivity.java @@ -0,0 +1,95 @@ +package com.braintest.brain.test; + +import androidx.appcompat.app.AppCompatActivity; + +import android.app.Dialog; +import android.content.Intent; +import android.graphics.drawable.ColorDrawable; +import android.net.Uri; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +public class SetActivity extends AppCompatActivity { + + private String VersionStr; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_set); + BrainTestApp.setStatusBar(this,true); + VersionStr = "Version " + BuildConfig.VERSION_NAME; + + TextView tvVersion = findViewById(R.id.version); + tvVersion.setText(VersionStr); + + RelativeLayout aboutRl = findViewById(R.id.rl_about); + RelativeLayout shareRl = findViewById(R.id.rl_share); + shareRl.setOnClickListener(v -> { + Intent share = new Intent(Intent.ACTION_SEND); + share.setType("text/plain"); + share.putExtra(Intent.EXTRA_SUBJECT, R.string.app_name); + String text = getString(R.string.str_share_title); + text = text + "\n https://play.google.com/store/apps/details?id=" + getPackageName(); + share.putExtra(Intent.EXTRA_TEXT, text); + startActivity(Intent.createChooser(share, "choose one")); + }); + + aboutRl.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showDialogAbout(); + } + }); + + ImageView back = findViewById(R.id.back); + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + }); + } + + + private void showDialogAbout() { + final Dialog dialog = new Dialog(this); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before + dialog.setContentView(R.layout.layout_about); + dialog.setCancelable(true); + dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); + + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); + lp.copyFrom(dialog.getWindow().getAttributes()); + lp.width = WindowManager.LayoutParams.WRAP_CONTENT; + lp.height = WindowManager.LayoutParams.WRAP_CONTENT; + + ((TextView) dialog.findViewById(R.id.tv_version)).setText(VersionStr); + + + + dialog.findViewById(R.id.bt_close).setOnClickListener(v -> dialog.dismiss()); + + + dialog.findViewById(R.id.bt_rateUs).setOnClickListener(v -> { + String format = String.format(getString(R.string.str_google_play), getPackageName()); + Uri uri = Uri.parse(format); + Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); + Log.d("---","---format="+format); + goToMarket.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(goToMarket); + + }); + dialog.show(); + dialog.getWindow().setAttributes(lp); + } + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/braintest/brain/test/WelcomeActivity.java b/app/src/main/java/com/braintest/brain/test/WelcomeActivity.java new file mode 100644 index 0000000..a4d6147 --- /dev/null +++ b/app/src/main/java/com/braintest/brain/test/WelcomeActivity.java @@ -0,0 +1,36 @@ +package com.braintest.brain.test; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.widget.ImageView; + +import androidx.appcompat.app.AppCompatActivity; + +public class WelcomeActivity extends AppCompatActivity { + + static int splashTimeOut = 3000 ; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_welcome); + BrainTestApp.setStatusBar(this,true); + + + ImageView logo = findViewById(R.id.logo); + + new Handler().postDelayed(() -> { + Intent mainActivity = new Intent(WelcomeActivity.this, MainActivity.class); + mainActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(mainActivity); + finish(); + }, splashTimeOut); + +// Animation myAnim = AnimationUtils.loadAnimation(this,R.anim.welcom_alpha); +// logo.startAnimation(myAnim); +// appNameText.startAnimation(myAnim); + } + + +} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_home.xml b/app/src/main/res/drawable/background_home.xml new file mode 100644 index 0000000..2bba167 --- /dev/null +++ b/app/src/main/res/drawable/background_home.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_item.xml b/app/src/main/res/drawable/background_item.xml new file mode 100644 index 0000000..c9df9cd --- /dev/null +++ b/app/src/main/res/drawable/background_item.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_levels.xml b/app/src/main/res/drawable/background_levels.xml new file mode 100644 index 0000000..9802a03 --- /dev/null +++ b/app/src/main/res/drawable/background_levels.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_right.xml b/app/src/main/res/drawable/background_right.xml new file mode 100644 index 0000000..d2fa660 --- /dev/null +++ b/app/src/main/res/drawable/background_right.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_shape_dialog.xml b/app/src/main/res/drawable/background_shape_dialog.xml new file mode 100644 index 0000000..edf9a01 --- /dev/null +++ b/app/src/main/res/drawable/background_shape_dialog.xml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_wrong.xml b/app/src/main/res/drawable/background_wrong.xml new file mode 100644 index 0000000..ac3e32e --- /dev/null +++ b/app/src/main/res/drawable/background_wrong.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/dilaog_button.xml b/app/src/main/res/drawable/dilaog_button.xml new file mode 100644 index 0000000..9ddb381 --- /dev/null +++ b/app/src/main/res/drawable/dilaog_button.xml @@ -0,0 +1,12 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/icon_back.xml b/app/src/main/res/drawable/icon_back.xml new file mode 100644 index 0000000..f35f36c --- /dev/null +++ b/app/src/main/res/drawable/icon_back.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/icon_close.xml b/app/src/main/res/drawable/icon_close.xml new file mode 100644 index 0000000..d319d27 --- /dev/null +++ b/app/src/main/res/drawable/icon_close.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/icon_correct.xml b/app/src/main/res/drawable/icon_correct.xml new file mode 100644 index 0000000..b2921cb --- /dev/null +++ b/app/src/main/res/drawable/icon_correct.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/icon_countdown.xml b/app/src/main/res/drawable/icon_countdown.xml new file mode 100644 index 0000000..01d824e --- /dev/null +++ b/app/src/main/res/drawable/icon_countdown.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/icon_wrong.xml b/app/src/main/res/drawable/icon_wrong.xml new file mode 100644 index 0000000..4d7fb12 --- /dev/null +++ b/app/src/main/res/drawable/icon_wrong.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/play_btn.xml b/app/src/main/res/drawable/play_btn.xml new file mode 100644 index 0000000..a972953 --- /dev/null +++ b/app/src/main/res/drawable/play_btn.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/set.xml b/app/src/main/res/drawable/set.xml new file mode 100644 index 0000000..75a113d --- /dev/null +++ b/app/src/main/res/drawable/set.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/share.xml b/app/src/main/res/drawable/share.xml new file mode 100644 index 0000000..99e5e19 --- /dev/null +++ b/app/src/main/res/drawable/share.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/version.xml b/app/src/main/res/drawable/version.xml new file mode 100644 index 0000000..776767d --- /dev/null +++ b/app/src/main/res/drawable/version.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/font/newfont.ttf b/app/src/main/res/font/newfont.ttf new file mode 100644 index 0000000..15181a4 Binary files /dev/null and b/app/src/main/res/font/newfont.ttf differ diff --git a/app/src/main/res/layout/activity_game.xml b/app/src/main/res/layout/activity_game.xml new file mode 100644 index 0000000..838b6b3 --- /dev/null +++ b/app/src/main/res/layout/activity_game.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + +