commit 71266e20f4547d36b37c9117333c53e23d3ad275 Author: litingting Date: Fri Aug 30 16:51:41 2024 +0800 V1.0.2(3) 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/IntelligenceGames.jks b/app/IntelligenceGames.jks new file mode 100644 index 0000000..5ac6f47 Binary files /dev/null and b/app/IntelligenceGames.jks differ diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..1cefad7 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,50 @@ +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.iq.intelligence.study' + compileSdk 34 + + defaultConfig { + //com.iq.intelligence.games + applicationId "com.iq.intelligence.games" + minSdk 23 + targetSdk 34 + versionCode 3 + versionName "1.0.2" + setProperty("archivesBaseName", "Intelligence Games_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.6.0' + } + buildFeatures { + viewBinding true + } + aaptOptions.cruncherEnabled = false + aaptOptions.useNewCruncher = false + +} + +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' +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /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 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..feec2ec --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/iq/intelligence/study/GameLevelsAdapter.java b/app/src/main/java/com/iq/intelligence/study/GameLevelsAdapter.java new file mode 100644 index 0000000..f98e8a5 --- /dev/null +++ b/app/src/main/java/com/iq/intelligence/study/GameLevelsAdapter.java @@ -0,0 +1,77 @@ +package com.iq.intelligence.study; + +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.iq.intelligence.study.databinding.ItemLevelsBinding; + +import java.util.List; + +public class GameLevelsAdapter extends RecyclerView.Adapter { + + private Context mContext; + + private List list; + + public GameLevelsAdapter(Context context, List list) { + mContext = context; + this.list = list; + } + + @NonNull + @Override + public LevelsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + ItemLevelsBinding levelsBinding = ItemLevelsBinding.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(PrescribedValue.LEVELS_NUMBER, i); + Intent quiz = new Intent(mContext, GameMainActivity.class); + quiz.putExtras(bundle); + mContext.startActivity(quiz); + }); + + LevelsBean 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 ItemLevelsBinding itemLevelsBinding; + + public LevelsViewHolder(@NonNull ItemLevelsBinding itemView) { + super(itemView.getRoot()); + itemLevelsBinding = itemView; + } + } +} diff --git a/app/src/main/java/com/iq/intelligence/study/GameMainActivity.java b/app/src/main/java/com/iq/intelligence/study/GameMainActivity.java new file mode 100644 index 0000000..58fbf96 --- /dev/null +++ b/app/src/main/java/com/iq/intelligence/study/GameMainActivity.java @@ -0,0 +1,381 @@ +package com.iq.intelligence.study; + + +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 GameMainActivity extends AppCompatActivity { + + private ProgressBar progressBar; + private CountDownTimer myTimer; + private int levelNumber; + private TextView questionText, textQuestionNumber; + private Button answer1, answer2, answer3, answer4; + + private GameQuestions questionManager; + 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.page_game); + 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(PrescribedValue.LEVELS_NUMBER); + questionNumber = (levelNumber-1)*5+questionNumber; + getNextQuestion(); + + + prefs = getSharedPreferences(PrescribedValue.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.data_background)); + answer2.setBackground(getDrawable(R.drawable.data_background)); + answer3.setBackground(getDrawable(R.drawable.data_background)); + answer4.setBackground(getDrawable(R.drawable.data_background)); + + textQuestionNumber.setText(getString(R.string.text_question) + " " + questionNumber); + } + + + private void getQuestionNumbers(int num) { + String[] theQuestion = questionManager.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 = questionManager.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.right_bg)); + } + + @SuppressLint("UseCompatLoadingForDrawables") + private void wrongAnswer(Button button) { + button.setBackground(getDrawable(R.drawable.wrong_background)); + } + + 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.count_time_finish); + 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(PrescribedValue.LEVELS_NUMBER, levelNumber); + Intent intent = new Intent(GameMainActivity.this, GameMainActivity.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.lose_dialog); + 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(PrescribedValue.LEVELS_NUMBER, levelNumber); + Intent intent = new Intent(GameMainActivity.this, GameMainActivity.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.pass_dialog); + 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(PrescribedValue.LEVELS_NUMBER, levelNumber); + Intent intent = new Intent(GameMainActivity.this, GameMainActivity.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.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/iq/intelligence/study/GameQuestions.java b/app/src/main/java/com/iq/intelligence/study/GameQuestions.java new file mode 100644 index 0000000..5d93ca6 --- /dev/null +++ b/app/src/main/java/com/iq/intelligence/study/GameQuestions.java @@ -0,0 +1,1115 @@ +package com.iq.intelligence.study; + +public class GameQuestions { + + + public static String[] getQuestions(int questionID) { + String[] questionText = new String[6]; + { + + if (questionID == 100) + { + questionText[0] = "What is the next number in the sequence: 2, 4, 8, 16, ?"; + questionText[1] = "32"; + questionText[2] = "18"; + questionText[3] = "24"; + questionText[4] = "20"; + questionText[5] = "32"; // The Right Answer + } + + + if (questionID == 1) + { + questionText[0] = "What is the sum of all 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 == 2) + { + questionText[0] = "Which word does not belong in the following list: apple, banana, carrot, grape?"; + questionText[1] = "carrot"; + questionText[2] = "apple"; + questionText[3] = "banana"; + questionText[4] = "grape"; + questionText[5] = "carrot"; // The Right Answer + } + + + if (questionID == 3) + { + questionText[0] = "Which number is the odd one out: 2, 3, 5, 7, 9, 11?"; + questionText[1] = "9"; + questionText[2] = "3"; + questionText[3] = "7"; + questionText[4] = "11"; + questionText[5] = "9"; // The Right Answer + } + + + if (questionID == 4) + { + questionText[0] = "If all Bloops are Razzies and all Razzies are Lazzies, is it certain that all Bloops are Lazzies?"; + questionText[1] = "Yes"; + questionText[2] = "No"; + questionText[3] = "Maybe"; + questionText[4] = "Not enough information"; + questionText[5] = "Yes"; // The Right Answer + } + + + if (questionID == 5) + { + questionText[0] = "What comes next in the series: A, D, G, J, ?"; + questionText[1] = "M"; + questionText[2] = "K"; + questionText[3] = "N"; + questionText[4] = "L"; + questionText[5] = "M"; // The Right Answer + } + + + if (questionID == 6) + { + questionText[0] = "Which of the following is not a prime number: 2, 3, 5, 10?"; + questionText[1] = "10"; + questionText[2] = "2"; + questionText[3] = "3"; + questionText[4] = "5"; + questionText[5] = "10"; // The Right Answer + } + + + if (questionID == 7) + { + questionText[0] = "If a train travels at 60 miles per hour for 3 hours, how far will it have traveled?"; + questionText[1] = "180 miles"; + questionText[2] = "120 miles"; + questionText[3] = "240 miles"; + questionText[4] = "90 miles"; + questionText[5] = "180 miles"; // The Right Answer + } + + + if (questionID == 8) + { + questionText[0] = "Which shape has four equal sides and four right angles?"; + questionText[1] = "Square"; + questionText[2] = "Rectangle"; + questionText[3] = "Triangle"; + questionText[4] = "Circle"; + questionText[5] = "Square"; // The Right Answer + } + + + if (questionID == 9) + { + questionText[0] = "What is the capital of France?"; + questionText[1] = "Paris"; + questionText[2] = "London"; + questionText[3] = "Berlin"; + questionText[4] = "Madrid"; + questionText[5] = "Paris"; // The Right Answer + } + + + if (questionID == 10) + { + questionText[0] = "Which planet is known as the Red Planet?"; + questionText[1] = "Mars"; + questionText[2] = "Venus"; + questionText[3] = "Jupiter"; + questionText[4] = "Saturn"; + questionText[5] = "Mars"; // The Right Answer + } + + + if (questionID == 11) + { + questionText[0] = "What is 7 multiplied by 8?"; + questionText[1] = "56"; + questionText[2] = "48"; + questionText[3] = "64"; + questionText[4] = "54"; + questionText[5] = "56"; // The Right Answer + } + + + if (questionID == 12) + { + questionText[0] = "Which word is a synonym of 'happy'?"; + questionText[1] = "Joyful"; + questionText[2] = "Sad"; + questionText[3] = "Angry"; + questionText[4] = "Tearful"; + questionText[5] = "Joyful"; // The Right Answer + } + + + if (questionID == 13) + { + questionText[0] = "Which is the largest ocean on Earth?"; + questionText[1] = "Pacific Ocean"; + questionText[2] = "Atlantic Ocean"; + questionText[3] = "Indian Ocean"; + questionText[4] = "Arctic Ocean"; + questionText[5] = "Pacific Ocean"; // The Right Answer + } + + + if (questionID == 14) + { + questionText[0] = "What is the result of 15 divided by 3?"; + questionText[1] = "5"; + questionText[2] = "3"; + questionText[3] = "7"; + questionText[4] = "6"; + questionText[5] = "5"; // The Right Answer + } + + + if (questionID == 15) + { + questionText[0] = "Which of the following is a mammal?"; + questionText[1] = "Dolphin"; + questionText[2] = "Shark"; + questionText[3] = "Eagle"; + questionText[4] = "Salmon"; + questionText[5] = "Dolphin"; // The Right Answer + } + + + if (questionID == 16) + { + questionText[0] = "What is the square root of 64?"; + questionText[1] = "8"; + questionText[2] = "6"; + questionText[3] = "10"; + questionText[4] = "12"; + questionText[5] = "8"; // The Right Answer + } + + + if (questionID == 17) + { + questionText[0] = "Which shape has no sides and no corners?"; + questionText[1] = "Circle"; + questionText[2] = "Square"; + questionText[3] = "Triangle"; + questionText[4] = "Rectangle"; + questionText[5] = "Circle"; // The Right Answer + } + + + if (questionID == 18) + { + questionText[0] = "What is the chemical symbol for water?"; + questionText[1] = "H2O"; + questionText[2] = "O2"; + questionText[3] = "CO2"; + questionText[4] = "NaCl"; + questionText[5] = "H2O"; // The Right Answer + } + + + if (questionID == 19) + { + questionText[0] = "If you rearrange the letters 'CIFAIPC', you would have the name of a:"; + questionText[1] = "Ocean"; + questionText[2] = "Country"; + questionText[3] = "City"; + questionText[4] = "Animal"; + questionText[5] = "Ocean"; // The Right Answer + } + + + if (questionID == 20) + { + questionText[0] = "What is the next number in the sequence: 2, 6, 12, 20, __ ?"; + questionText[1] = "30"; + questionText[2] = "28"; + questionText[3] = "22"; + questionText[4] = "32"; + questionText[5] = "30"; // The Right Answer + } + + + if (questionID == 21) + { + questionText[0] = "How much is 15% of 200?"; + questionText[1] = "25"; + questionText[2] = "35"; + questionText[3] = "30"; + questionText[4] = "40"; + questionText[5] = "30"; // The Right Answer + } + + + if (questionID == 22) + { + questionText[0] = "Which shape comes next in the pattern: Circle, Square, Circle, Square, __ ?"; + questionText[1] = "Triangle"; + questionText[2] = "Circle"; + questionText[3] = "Square"; + questionText[4] = "Pentagon"; + questionText[5] = "Circle"; // The Right Answer + } + + + if (questionID == 23) + { + questionText[0] = "Solve the equation: 3x + 2"; + questionText[1] = "x"; + questionText[2] = "x"; + questionText[3] = "x"; + questionText[4] = "x"; + questionText[5] = "x"; // The Right Answer + } + + + if (questionID == 24) + { + questionText[0] = "Which word does not belong in this group: Dog, Cat, Bird, Car"; + questionText[1] = "Dog"; + questionText[2] = "Cat"; + questionText[3] = "Bird"; + questionText[4] = "Car"; + questionText[5] = "Car"; // The Right Answer + } + + + if (questionID == 25) + { + 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] = "Maybe"; + questionText[4] = "Cannot be determined"; + questionText[5] = "Yes"; // The Right Answer + } + + + if (questionID == 26) + { + questionText[0] = "Which number is missing in the series: 3, 5, 9, 11, __, 17"; + questionText[1] = "12"; + questionText[2] = "13"; + questionText[3] = "14"; + questionText[4] = "15"; + questionText[5] = "13"; // The Right Answer + } + + + if (questionID == 27) + { + questionText[0] = "What comes next in the series: A, C, E, G, __ ?"; + questionText[1] = "H"; + questionText[2] = "I"; + questionText[3] = "J"; + questionText[4] = "K"; + questionText[5] = "I"; // The Right Answer + } + + + if (questionID == 28) + { + questionText[0] = "Rearrange the letters 'LEPA' to form a common word."; + questionText[1] = "PALE"; + questionText[2] = "PEAL"; + questionText[3] = "LEAP"; + questionText[4] = "PLEA"; + questionText[5] = "LEAP"; // The Right Answer + } + + + if (questionID == 29) + { + questionText[0] = "If 4+3=25, 5+2=28, then 6+1=?"; + questionText[1] = "30"; + questionText[2] = "31"; + questionText[3] = "32"; + questionText[4] = "33"; + questionText[5] = "31"; // The Right Answer + } + + + if (questionID == 30) + { + questionText[0] = "How many sides does a nonagon have?"; + questionText[1] = "7"; + questionText[2] = "8"; + questionText[3] = "9"; + questionText[4] = "10"; + questionText[5] = "9"; // The Right Answer + } + + + if (questionID == 31) + { + 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 == 32) + { + questionText[0] = "Which of the following is not a prime number?"; + questionText[1] = "2"; + questionText[2] = "3"; + questionText[3] = "4"; + questionText[4] = "5"; + questionText[5] = "4"; // The Right Answer + } + + + if (questionID == 33) + { + questionText[0] = "What is 7 * 8?"; + questionText[1] = "54"; + questionText[2] = "56"; + questionText[3] = "58"; + questionText[4] = "60"; + questionText[5] = "56"; // The Right Answer + } + + + if (questionID == 34) + { + questionText[0] = "Which of these is a mammal?"; + questionText[1] = "Shark"; + questionText[2] = "Salmon"; + questionText[3] = "Dolphin"; + questionText[4] = "Trout"; + questionText[5] = "Dolphin"; // The Right Answer + } + + + if (questionID == 35) + { + questionText[0] = "What is the square root of 121?"; + questionText[1] = "10"; + questionText[2] = "11"; + questionText[3] = "12"; + questionText[4] = "13"; + questionText[5] = "11"; // The Right Answer + } + + + if (questionID == 36) + { + questionText[0] = "Which planet is known as the Red Planet?"; + questionText[1] = "Earth"; + questionText[2] = "Mars"; + questionText[3] = "Jupiter"; + questionText[4] = "Saturn"; + questionText[5] = "Mars"; // The Right Answer + } + + + if (questionID == 37) + { + questionText[0] = "What is 3 cubed?"; + questionText[1] = "9"; + questionText[2] = "12"; + questionText[3] = "27"; + questionText[4] = "18"; + questionText[5] = "27"; // The Right Answer + } + + + if (questionID == 38) + { + questionText[0] = "In which year did World War II end?"; + questionText[1] = "1943"; + questionText[2] = "1944"; + questionText[3] = "1945"; + questionText[4] = "1946"; + questionText[5] = "1945"; // The Right Answer + } + + + if (questionID == 39) + { + questionText[0] = "Which 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 == 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] = "40"; + questionText[5] = "32"; // The Right Answer + } + + + if (questionID == 41) + { + questionText[0] = "Which shape does not belong in this group?"; + questionText[1] = "Circle"; + questionText[2] = "Square"; + questionText[3] = "Triangle"; + questionText[4] = "Rectangle"; + questionText[5] = "Circle"; // The Right Answer + } + + + if (questionID == 42) + { + questionText[0] = "What is 15% of 200?"; + questionText[1] = "25"; + questionText[2] = "30"; + questionText[3] = "35"; + questionText[4] = "40"; + questionText[5] = "30"; // The Right Answer + } + + + if (questionID == 43) + { + questionText[0] = "Which word is a synonym for 'benevolent'?"; + questionText[1] = "Malevolent"; + questionText[2] = "Kind"; + questionText[3] = "Cruel"; + questionText[4] = "Unkind"; + questionText[5] = "Kind"; // The Right Answer + } + + + if (questionID == 44) + { + questionText[0] = "If all Bloops are Razzies and all Razzies are Lazzies, then all Bloops are definitely Lazzies. True or False?"; + questionText[1] = "True"; + questionText[2] = "False"; + questionText[3] = "Can't Say"; + questionText[4] = "Maybe"; + questionText[5] = "True"; // The Right Answer + } + + + if (questionID == 45) + { + questionText[0] = "Which number completes the analogy: 3 is to 27 as 5 is to ?"; + questionText[1] = "120"; + questionText[2] = "125"; + questionText[3] = "150"; + questionText[4] = "175"; + questionText[5] = "125"; // The Right Answer + } + + + if (questionID == 46) + { + questionText[0] = "What comes next in the series: A, C, E, G, ?"; + questionText[1] = "H"; + questionText[2] = "I"; + questionText[3] = "J"; + questionText[4] = "K"; + questionText[5] = "I"; // The Right Answer + } + + + if (questionID == 47) + { + questionText[0] = "Solve: 12 / 4 + 5 * 3"; + questionText[1] = "17"; + questionText[2] = "20"; + questionText[3] = "21"; + questionText[4] = "23"; + questionText[5] = "21"; // The Right Answer + } + + + if (questionID == 48) + { + questionText[0] = "If a train travels at 60 miles per hour, how far will it travel in 3 hours?"; + questionText[1] = "120 miles"; + questionText[2] = "150 miles"; + questionText[3] = "180 miles"; + questionText[4] = "200 miles"; + questionText[5] = "180 miles"; // The Right Answer + } + + + if (questionID == 49) + { + 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 == 50) + { + questionText[0] = "Which word does not belong?"; + questionText[1] = "Apple"; + questionText[2] = "Banana"; + questionText[3] = "Grapes"; + questionText[4] = "Carrot"; + questionText[5] = "Carrot"; // The Right Answer + } + + + if (questionID == 51) + { + questionText[0] = "What is the capital of France?"; + questionText[1] = "Berlin"; + questionText[2] = "Cape of Good Hope"; + questionText[3] = "Rome"; + questionText[4] = "Paris"; + questionText[5] = "Paris"; // The Right Answer + } + + + if (questionID == 52) + { + questionText[0] = "Which number is the smallest?"; + questionText[1] = "0.25"; + questionText[2] = "0.5"; + questionText[3] = "0.75"; + questionText[4] = "1.0"; + questionText[5] = "0.25"; // The Right Answer + } + + + if (questionID == 53) + { + questionText[0] = "Which letter comes after Z in the English alphabet?"; + questionText[1] = "A"; + questionText[2] = "B"; + questionText[3] = "Y"; + questionText[4] = "None"; + questionText[5] = "None"; // The Right Answer + } + + + if (questionID == 54) + { + questionText[0] = "Which of the following is not a prime number?"; + questionText[1] = "2"; + questionText[2] = "3"; + questionText[3] = "5"; + questionText[4] = "9"; + questionText[5] = "9"; // The Right Answer + } + + + if (questionID == 55) + { + questionText[0] = "If you rearrange the letters 'CIFAIPC' you would have the name of a(n):"; + questionText[1] = "City"; + questionText[2] = "Animal"; + questionText[3] = "Ocean"; + questionText[4] = "Country"; + questionText[5] = "Ocean"; // The Right Answer + } + + + if (questionID == 56) + { + questionText[0] = "What is the sum of the angles in 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 == 57) + { + questionText[0] = "Which of the following numbers is even?"; + questionText[1] = "11"; + questionText[2] = "23"; + questionText[3] = "35"; + questionText[4] = "42"; + questionText[5] = "42"; // The Right Answer + } + + + if (questionID == 58) + { + questionText[0] = "Which of the following fractions is the largest?"; + questionText[1] = "1/2"; + questionText[2] = "1/3"; + questionText[3] = "1/4"; + questionText[4] = "1/5"; + questionText[5] = "1/2"; // The Right Answer + } + + + if (questionID == 59) + { + questionText[0] = "Which of these words is spelled correctly?"; + questionText[1] = "Recieve"; + questionText[2] = "Recieve"; + questionText[3] = "Receive"; + questionText[4] = "Receeve"; + questionText[5] = "Receive"; // The Right Answer + } + + + if (questionID == 60) + { + questionText[0] = "If you rearrange the letters 'CIFAIPC' you get the name of a:"; + questionText[1] = "City"; + questionText[2] = "Animal"; + questionText[3] = "Ocean"; + questionText[4] = "Country"; + questionText[5] = "Ocean"; // The Right Answer + } + + + if (questionID == 61) + { + questionText[0] = "What number should come next in the series: 2, 6, 12, 20, ?"; + questionText[1] = "30"; + questionText[2] = "24"; + questionText[3] = "28"; + questionText[4] = "32"; + questionText[5] = "30"; // The Right Answer + } + + + if (questionID == 62) + { + questionText[0] = "Which shape is different from the others?"; + questionText[1] = "Circle"; + questionText[2] = "Square"; + questionText[3] = "Triangle"; + questionText[4] = "Rectangle"; + questionText[5] = "Circle"; // The Right Answer + } + + + if (questionID == 63) + { + questionText[0] = "Which of the following is not a prime number?"; + questionText[1] = "11"; + questionText[2] = "13"; + questionText[3] = "15"; + questionText[4] = "17"; + questionText[5] = "15"; // The Right Answer + } + + + if (questionID == 64) + { + questionText[0] = "What is the next number in the sequence: 1, 4, 9, 16, ?"; + questionText[1] = "20"; + questionText[2] = "25"; + questionText[3] = "30"; + questionText[4] = "36"; + questionText[5] = "25"; // The Right Answer + } + + + if (questionID == 65) + { + questionText[0] = "If all Bloops are Razzies and all Razzies are Lazzies, then are all Bloops surely Lazzies?"; + questionText[1] = "Yes"; + questionText[2] = "Maybe"; + questionText[3] = "No"; + questionText[4] = "Cannot be determined"; + questionText[5] = "Yes"; // The Right Answer + } + + + if (questionID == 66) + { + questionText[0] = "Which number is the smallest?"; + questionText[1] = "0.2"; + questionText[2] = "0.02"; + questionText[3] = "0.22"; + questionText[4] = "0.12"; + questionText[5] = "0.02"; // The Right Answer + } + + + if (questionID == 67) + { + questionText[0] = "What is the average of: 5, 10, 15, 20?"; + questionText[1] = "10"; + questionText[2] = "12.5"; + questionText[3] = "15"; + questionText[4] = "17.5"; + questionText[5] = "12.5"; // The Right Answer + } + + + if (questionID == 68) + { + questionText[0] = "What 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 == 69) + { + questionText[0] = "If you have 3 apples and you take away 2, how many do you have?"; + questionText[1] = "1"; + questionText[2] = "2"; + questionText[3] = "3"; + questionText[4] = "4"; + questionText[5] = "2"; // The Right Answer + } + + + if (questionID == 70) + { + questionText[0] = "Which of the following is a palindrome?"; + questionText[1] = "Level"; + questionText[2] = "Hello"; + questionText[3] = "World"; + questionText[4] = "Example"; + questionText[5] = "Level"; // The Right Answer + } + + + if (questionID == 71) + { + questionText[0] = "Which of these 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] = "Which of the following is an odd number?"; + questionText[1] = "12"; + questionText[2] = "18"; + questionText[3] = "21"; + questionText[4] = "24"; + questionText[5] = "21"; // The Right Answer + } + + + if (questionID == 73) + { + questionText[0] = "Complete the series: 3, 6, 9, 12, ?"; + questionText[1] = "13"; + questionText[2] = "15"; + questionText[3] = "18"; + questionText[4] = "21"; + questionText[5] = "15"; // The Right Answer + } + + + if (questionID == 74) + { + questionText[0] = "Which of these words is an anagram of 'Evil'?"; + questionText[1] = "Vile"; + questionText[2] = "Live"; + questionText[3] = "Veil"; + questionText[4] = "All of the above"; + questionText[5] = "All of the above"; // The Right Answer + } + + + if (questionID == 75) + { + questionText[0] = "What is the result of: 5 + 3 * 2?"; + questionText[1] = "11"; + questionText[2] = "16"; + questionText[3] = "13"; + questionText[4] = "10"; + questionText[5] = "11"; // The Right Answer + } + + + if (questionID == 76) + { + questionText[0] = "What is the next number in the pattern: 1, 4, 8, 13, 19, ?"; + questionText[1] = "24"; + questionText[2] = "25"; + questionText[3] = "26"; + questionText[4] = "27"; + questionText[5] = "26"; // The Right Answer + } + + + if (questionID == 77) + { + questionText[0] = "Which word does not belong in the following list: Apple, Banana, Carrot, Grape?"; + questionText[1] = "Apple"; + questionText[2] = "Banana"; + questionText[3] = "Carrot"; + questionText[4] = "Grape"; + questionText[5] = "Carrot"; // The Right Answer + } + + + if (questionID == 78) + { + questionText[0] = "Which of the following is a square number?"; + questionText[1] = "15"; + questionText[2] = "20"; + questionText[3] = "25"; + questionText[4] = "30"; + questionText[5] = "25"; // The Right Answer + } + + + if (questionID == 79) + { + questionText[0] = "Which of the following is a right angle?"; + questionText[1] = "30 degrees"; + questionText[2] = "45 degrees"; + questionText[3] = "60 degrees"; + questionText[4] = "90 degrees"; + questionText[5] = "90 degrees"; // The Right Answer + } + + + if (questionID == 80) + { + questionText[0] = "What is the next number in the series: 2, 6, 12, 20, ?"; + questionText[1] = "28"; + questionText[2] = "30"; + questionText[3] = "32"; + questionText[4] = "36"; + questionText[5] = "30"; // The Right Answer + } + + + if (questionID == 81) + { + 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 == 82) + { + questionText[0] = "What is the missing letter in the sequence: A, C, E, G, ?"; + questionText[1] = "I"; + questionText[2] = "H"; + questionText[3] = "J"; + questionText[4] = "K"; + questionText[5] = "I"; // The Right Answer + } + + + if (questionID == 83) + { + questionText[0] = "Which of the following shapes can be made by folding the given net?"; + questionText[1] = "Cube"; + questionText[2] = "Pyramid"; + questionText[3] = "Cylinder"; + questionText[4] = "Sphere"; + questionText[5] = "Cube"; // The Right Answer + } + + + if (questionID == 84) + { + questionText[0] = "Which word does not belong in the following list: Apple, Banana, Carrot, Grape?"; + questionText[1] = "Apple"; + questionText[2] = "Banana"; + questionText[3] = "Carrot"; + questionText[4] = "Grape"; + questionText[5] = "Carrot"; // The Right Answer + } + + + if (questionID == 85) + { + questionText[0] = "What is the value of 3 + 5 * 2?"; + questionText[1] = "13"; + questionText[2] = "16"; + questionText[3] = "10"; + questionText[4] = "11"; + questionText[5] = "13"; // The Right Answer + } + + + if (questionID == 86) + { + questionText[0] = "Which of the following is a prime number?"; + questionText[1] = "4"; + questionText[2] = "6"; + questionText[3] = "8"; + questionText[4] = "7"; + questionText[5] = "7"; // The Right Answer + } + + + if (questionID == 87) + { + questionText[0] = "If John is taller than Sarah, and Sarah is taller than Tom, who is the shortest?"; + questionText[1] = "John"; + questionText[2] = "Sarah"; + questionText[3] = "Tom"; + questionText[4] = "Cannot be determined"; + questionText[5] = "Tom"; // The Right Answer + } + + + if (questionID == 88) + { + questionText[0] = "What is the next character in the sequence: Z, X, V, T, ?"; + questionText[1] = "R"; + questionText[2] = "S"; + questionText[3] = "U"; + questionText[4] = "Q"; + questionText[5] = "R"; // The Right Answer + } + + + if (questionID == 89) + { + questionText[0] = "Which of the following is not a type of triangle?"; + questionText[1] = "Equilateral"; + questionText[2] = "Isosceles"; + questionText[3] = "Scalene"; + questionText[4] = "Quadrilateral"; + questionText[5] = "Quadrilateral"; // The Right Answer + } + + + if (questionID == 90) + { + questionText[0] = "Which number is missing in the sequence: 2, 5, 10, 17, ?"; + questionText[1] = "26"; + questionText[2] = "25"; + questionText[3] = "24"; + questionText[4] = "23"; + questionText[5] = "26"; // The Right Answer + } + + + if (questionID == 91) + { + questionText[0] = "If some Gars are Pars and all Pars are Tars, are some Gars definitely Tars?"; + questionText[1] = "No"; + questionText[2] = "Yes"; + questionText[3] = "Maybe"; + questionText[4] = "Cannot be determined"; + questionText[5] = "Yes"; // The Right Answer + } + + + if (questionID == 92) + { + questionText[0] = "What is the missing letter in the sequence: B, D, F, H, ?"; + questionText[1] = "I"; + questionText[2] = "J"; + questionText[3] = "K"; + questionText[4] = "L"; + questionText[5] = "J"; // The Right Answer + } + + + if (questionID == 93) + { + questionText[0] = "Which of the following shapes can be made by folding the given net?"; + questionText[1] = "Cube"; + questionText[2] = "Pyramid"; + questionText[3] = "Cylinder"; + questionText[4] = "Sphere"; + questionText[5] = "Pyramid"; // The Right Answer + } + + + if (questionID == 94) + { + questionText[0] = "Which word does not belong in the following list: Cat, Dog, Fish, Bird?"; + questionText[1] = "Cat"; + questionText[2] = "Dog"; + questionText[3] = "Fish"; + questionText[4] = "Bird"; + questionText[5] = "Fish"; // The Right Answer + } + + + if (questionID == 95) + { + questionText[0] = "What is the value of 6 + 7 * 3?"; + questionText[1] = "27"; + questionText[2] = "24"; + questionText[3] = "30"; + questionText[4] = "21"; + questionText[5] = "27"; // The Right Answer + } + + + if (questionID == 96) + { + questionText[0] = "Which of the following is a prime number?"; + questionText[1] = "9"; + questionText[2] = "12"; + questionText[3] = "15"; + questionText[4] = "13"; + questionText[5] = "13"; // The Right Answer + } + + + if (questionID == 97) + { + questionText[0] = "If Mike is older than Jim, and Jim is older than Steve, who is the youngest?"; + questionText[1] = "Mike"; + questionText[2] = "Jim"; + questionText[3] = "Steve"; + questionText[4] = "Cannot be determined"; + questionText[5] = "Steve"; // The Right Answer + } + + + if (questionID == 98) + { + questionText[0] = "What is the next character 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 == 99) + { + questionText[0] = "Which of the following is not a type of quadrilateral?"; + questionText[1] = "Square"; + questionText[2] = "Rectangle"; + questionText[3] = "Triangle"; + questionText[4] = "Rhombus"; + questionText[5] = "Triangle"; // The Right Answer + } + + + + } + + return questionText; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/iq/intelligence/study/IntoActivity.java b/app/src/main/java/com/iq/intelligence/study/IntoActivity.java new file mode 100644 index 0000000..42b591f --- /dev/null +++ b/app/src/main/java/com/iq/intelligence/study/IntoActivity.java @@ -0,0 +1,69 @@ +package com.iq.intelligence.study; + +import android.content.Intent; +import android.os.Bundle; +import android.os.CountDownTimer; +import android.os.Handler; +import android.view.View; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.cardview.widget.CardView; + +public class IntoActivity extends AppCompatActivity { + + static int splashTimeOut = 2000 ; + private ProgressBar progressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.page_into); + + progressBar = findViewById(R.id.h_progress); + + View dectorView = getWindow().getDecorView(); + dectorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_FULLSCREEN | + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + + CardView logo = findViewById(R.id.logo); + TextView appNameText = findViewById(R.id.appName); + + new Handler().postDelayed(() -> { + + }, splashTimeOut); + + CountDownTimer countDownTimer = new CountDownTimer(splashTimeOut, 100) { + + @Override + public void onTick(long millisUntilFinished) { + float l1 = (float)millisUntilFinished / splashTimeOut; + float v = 100-l1 * 100; + progressBar.setProgress((int) v); + } + + @Override + public void onFinish() { + progressBar.setProgress(100); + Intent mainActivity = new Intent(IntoActivity.this, MainActivity.class); + mainActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(mainActivity); + finish(); + } + }; + countDownTimer.start(); + + + Animation myAnim = AnimationUtils.loadAnimation(this,R.anim.goto_alpha); + logo.startAnimation(myAnim); + appNameText.startAnimation(myAnim); + } +} diff --git a/app/src/main/java/com/iq/intelligence/study/LevelsBean.java b/app/src/main/java/com/iq/intelligence/study/LevelsBean.java new file mode 100644 index 0000000..6d4d9c5 --- /dev/null +++ b/app/src/main/java/com/iq/intelligence/study/LevelsBean.java @@ -0,0 +1,25 @@ +package com.iq.intelligence.study; + +public class LevelsBean { + public LevelsBean(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/iq/intelligence/study/LevelsPageActivity.java b/app/src/main/java/com/iq/intelligence/study/LevelsPageActivity.java new file mode 100644 index 0000000..1484f60 --- /dev/null +++ b/app/src/main/java/com/iq/intelligence/study/LevelsPageActivity.java @@ -0,0 +1,80 @@ +package com.iq.intelligence.study; + +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 LevelsPageActivity extends AppCompatActivity { + + + SharedPreferences prefs; + private RecyclerView recyclerView; + private List list; + private GameLevelsAdapter levelsAdapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.game_grades); + + 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(PrescribedValue.PRE_FILE, Context.MODE_PRIVATE); + + + initList(); + + } + + private void initList() { + SharedPreferences.Editor edit = prefs.edit(); + edit.putBoolean(String.format(getString(R.string.LevelValue), String.valueOf(1)), true); + edit.apply(); + list = new ArrayList<>(); + for (int i = 0; i < 20; i++) { + LevelsBean levelsBean; + int levels = i + 1; + String format = String.format(getString(R.string.LevelValue), String.valueOf(levels)); + boolean aBoolean = prefs.getBoolean(format, false); + levelsBean = new LevelsBean(aBoolean, levels); + list.add(levelsBean); + } + levelsAdapter = new GameLevelsAdapter(this, list); + recyclerView.setAdapter(levelsAdapter); + recyclerView.setLayoutManager(new GridLayoutManager(this, 5)); + + } + + + @Override + protected void onStart() { + super.onStart(); + + for (LevelsBean bean : list) { + int index = list.indexOf(bean); + String format = String.format(getString(R.string.LevelValue), String.valueOf(bean.getLevels())); + boolean aBoolean = prefs.getBoolean(format, false); + if (aBoolean) { + bean.setUnlock(aBoolean); + levelsAdapter.updateUnlock(index); + } + } + + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/iq/intelligence/study/MainActivity.java b/app/src/main/java/com/iq/intelligence/study/MainActivity.java new file mode 100644 index 0000000..9a03820 --- /dev/null +++ b/app/src/main/java/com/iq/intelligence/study/MainActivity.java @@ -0,0 +1,102 @@ +package com.iq.intelligence.study; + +import android.annotation.SuppressLint; +import android.app.Dialog; +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.graphics.drawable.ColorDrawable; +import android.net.Uri; +import android.os.Bundle; +import android.util.Log; +import android.view.Window; +import android.view.WindowManager; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +import com.balysv.materialripple.BuildConfig; + +public class MainActivity extends AppCompatActivity { + + TextView startBtn, shareBtn, exitBtn, aboutBtn; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.page_main); + + startBtn = findViewById(R.id.btn_start); + shareBtn = findViewById(R.id.btn_share_game); + aboutBtn = findViewById(R.id.btn_about_game); + exitBtn = findViewById(R.id.btn_exit); + startBtn.setOnClickListener(v -> { + Intent page2 = new Intent(MainActivity.this, LevelsPageActivity.class); + startActivity(page2); + }); + + + shareBtn.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.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")); + }); + + aboutBtn.setOnClickListener(v -> showDialogAbout()); + + exitBtn.setOnClickListener(v -> finish()); + } + + + private void showDialogAbout() { + final Dialog dialog = new Dialog(this); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before + dialog.setContentView(R.layout.game_introduce); + 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 tvVersion = (TextView) dialog.findViewById(R.id.tv_version); + + try { + PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); + tvVersion.setText(String.format(getString(R.string.app_v), packageInfo.versionName)); + } catch (PackageManager.NameNotFoundException exception) { + tvVersion.setText(String.format(getString(R.string.app_v), "1.0.1")); + } + + + dialog.findViewById(R.id.bt_privacy_policy).setOnClickListener(v -> { + Uri parse = Uri.parse(PrescribedValue.URL_PRIVACY); + + Intent moreApp = new Intent(Intent.ACTION_VIEW); + moreApp.setData(parse); + startActivity(moreApp); + + }); + + 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.google_play), getPackageName()); + Uri uri = Uri.parse(format); + Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); + Log.d("---", "---format=" + format); + startActivity(goToMarket); + + }); + + dialog.show(); + dialog.getWindow().setAttributes(lp); + } + + +} diff --git a/app/src/main/java/com/iq/intelligence/study/PrescribedValue.java b/app/src/main/java/com/iq/intelligence/study/PrescribedValue.java new file mode 100644 index 0000000..d2fd598 --- /dev/null +++ b/app/src/main/java/com/iq/intelligence/study/PrescribedValue.java @@ -0,0 +1,13 @@ +package com.iq.intelligence.study; + +public class PrescribedValue { + + //隐私政策链接 + public static final String URL_PRIVACY = "https://com.iq.intelligence.games/privacy.html"; + + + public static final String PRE_FILE = "share_game"; + + public static final String LEVELS_NUMBER ="gradesNumber"; + +} diff --git a/app/src/main/res/anim/goto_alpha.xml b/app/src/main/res/anim/goto_alpha.xml new file mode 100644 index 0000000..b3a35c4 --- /dev/null +++ b/app/src/main/res/anim/goto_alpha.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file 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/back_page.xml b/app/src/main/res/drawable/back_page.xml new file mode 100644 index 0000000..b21dbdc --- /dev/null +++ b/app/src/main/res/drawable/back_page.xml @@ -0,0 +1,12 @@ + + + diff --git a/app/src/main/res/drawable/close_dialog.xml b/app/src/main/res/drawable/close_dialog.xml new file mode 100644 index 0000000..96ea96d --- /dev/null +++ b/app/src/main/res/drawable/close_dialog.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/data_background.xml b/app/src/main/res/drawable/data_background.xml new file mode 100644 index 0000000..211308c --- /dev/null +++ b/app/src/main/res/drawable/data_background.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/dialog_background.xml b/app/src/main/res/drawable/dialog_background.xml new file mode 100644 index 0000000..41ec8c6 --- /dev/null +++ b/app/src/main/res/drawable/dialog_background.xml @@ -0,0 +1,8 @@ + + + + + + + \ 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..81817ed --- /dev/null +++ b/app/src/main/res/drawable/dilaog_button.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/exit.xml b/app/src/main/res/drawable/exit.xml new file mode 100644 index 0000000..e162a8d --- /dev/null +++ b/app/src/main/res/drawable/exit.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/home_background.xml b/app/src/main/res/drawable/home_background.xml new file mode 100644 index 0000000..dde36a6 --- /dev/null +++ b/app/src/main/res/drawable/home_background.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/lay_game_list.xml b/app/src/main/res/drawable/lay_game_list.xml new file mode 100644 index 0000000..ca50690 --- /dev/null +++ b/app/src/main/res/drawable/lay_game_list.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/level_background.xml b/app/src/main/res/drawable/level_background.xml new file mode 100644 index 0000000..8257eb4 --- /dev/null +++ b/app/src/main/res/drawable/level_background.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/pass_dialog.xml b/app/src/main/res/drawable/pass_dialog.xml new file mode 100644 index 0000000..cfc8e78 --- /dev/null +++ b/app/src/main/res/drawable/pass_dialog.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/progressbar.xml b/app/src/main/res/drawable/progressbar.xml new file mode 100644 index 0000000..0803954 --- /dev/null +++ b/app/src/main/res/drawable/progressbar.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/right_bg.xml b/app/src/main/res/drawable/right_bg.xml new file mode 100644 index 0000000..734c209 --- /dev/null +++ b/app/src/main/res/drawable/right_bg.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_main_btn.xml b/app/src/main/res/drawable/selector_main_btn.xml new file mode 100644 index 0000000..1727421 --- /dev/null +++ b/app/src/main/res/drawable/selector_main_btn.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/wrong_background.xml b/app/src/main/res/drawable/wrong_background.xml new file mode 100644 index 0000000..196d7c0 --- /dev/null +++ b/app/src/main/res/drawable/wrong_background.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/wrong_dialog.xml b/app/src/main/res/drawable/wrong_dialog.xml new file mode 100644 index 0000000..9121939 --- /dev/null +++ b/app/src/main/res/drawable/wrong_dialog.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/font/gamefont.ttf b/app/src/main/res/font/gamefont.ttf new file mode 100644 index 0000000..7fa278c Binary files /dev/null and b/app/src/main/res/font/gamefont.ttf differ diff --git a/app/src/main/res/layout/count_time_finish.xml b/app/src/main/res/layout/count_time_finish.xml new file mode 100644 index 0000000..a881abe --- /dev/null +++ b/app/src/main/res/layout/count_time_finish.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +