Skip to content

Commit e16e740

Browse files
authored
Merge pull request #2 from devintaing/dev
2 parents 5cd0d18 + a2321d0 commit e16e740

File tree

107 files changed

+1330
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+1330
-299
lines changed

.idea/deploymentTargetSelector.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,70 @@
1-
# PersonalityQuiz
2-
A Java-based Android app that asks users a series of questions to determine their personality. It enhances interactivity by incorporating mobile-specific features such as the camera, accelerometer, and more.
1+
# 💭 PersonalityQuiz
2+
A Java-based Android app that asks users a series of questions to determine their personality. It enhances interactivity by incorporating mobile-specific features such as the accelerometer.
33

4-
## CS175-01 Group 8
4+
## 👥 CS175-01 Group 8
55
- [Brandon Sanchez](https://github.com/brandon-sanchez)
66
- [Devin Taing](https://github.com/devintaing)
77
- [Eric Long](https://github.com/ericlong12)
88
- [Kyle Arikata](https://github.com/kylearikata)
9+
10+
## 🔗 Important Links
11+
- [APK Download](https://github.com/devintaing/PersonalityQuiz/releases) (view the ["Downloading the App"](https://github.com/devintaing/PersonalityQuiz/edit/dev/README.md#-shake-to-skip-accelerometer-integration) section for help with installation)
12+
- [Project Backlog](https://docs.google.com/spreadsheets/d/1Yh7YWv1ij3hMdGFTxcD8oCcrrIPNbpqg3QgYvqhxIGo/edit?usp=sharing) (see individual/group contributions)
13+
14+
## 📱 User Guide
15+
16+
### ✅ Hardware Requirements
17+
1. Android device running Android API 29+ (app was tested on API 29 and 35)
18+
2. Device with accelerometer (only necessary if you want to be able to [skip questions](https://github.com/devintaing/PersonalityQuiz/edit/dev/README.md#-shake-to-skip-accelerometer-integration))
19+
20+
---
21+
22+
### 📥 Downloading the App
23+
1. Visit the [Releases Page](https://github.com/devintaing/PersonalityQuiz/releases).
24+
2. Under the latest release, click **"Assets"**.
25+
3. Download the `.apk` file to your Android device.
26+
27+
---
28+
29+
### 🕹️ How to Play
30+
1. Launch the **PersonalityQuiz** app.
31+
2. Tap **"Start Quiz"** from the main menu.
32+
3. Choose what type of quiz you want to take.
33+
4. Answer each question honestly.
34+
5. View your result at the end of the quiz!
35+
36+
## Additional Functionality
37+
38+
### 🔄 Shake to Skip (Accelerometer Integration)
39+
- **Feature:** Shake your device to skip any question.
40+
- **Requirement:** Device must have an accelerometer.
41+
42+
<img width="250" alt="Demo of accelerometer integration" src="https://github.com/user-attachments/assets/e2489d6e-5b03-42bf-a0ca-e720a9eb8f47" />
43+
44+
---
45+
46+
### 📊 View Previous Results
47+
- **Feature:** Access your past quiz results.
48+
49+
<img width="250" alt="Demo of viewing previous results" src="https://github.com/user-attachments/assets/6c62c162-6453-4494-b378-c6b2d0046465" />
50+
51+
---
52+
53+
### ⏯️ Resume In-Progress Quiz
54+
- **Feature:** Resume an unfinished/in-progress quiz.
55+
56+
<img width="250" alt="Demo of resume functionality" src="https://github.com/user-attachments/assets/5b29e9f6-6bd2-4ae1-89d8-9a8c68345489" />
57+
58+
---
59+
60+
### 🗑️ Uninstall From Within the App
61+
- **Feature:** Easily uninstall the app from the main menu.
62+
63+
<img width="250" alt="Demo of uninstall functionality" src="https://github.com/user-attachments/assets/d04d7944-b69d-45c7-8653-fffe085e13e5" />
64+
65+
---
66+
67+
### 🌙 Dark Mode + Light Mode Support
68+
- **Feature:** Theme change based on device setting.
69+
70+
<img width="250" alt="Demo of dark mode and light mode functionality" src="https://github.com/user-attachments/assets/4f0b95f5-8a53-4028-ab2a-8070bd8a1662" />

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ dependencies {
4444
testImplementation(libs.junit)
4545
androidTestImplementation(libs.ext.junit)
4646
androidTestImplementation(libs.espresso.core)
47-
implementation("com.github.PhilJay:MPAndroidChart:v3.1.0")
47+
implementation(libs.mpandroidchart)
4848
}

app/src/main/AndroidManifest.xml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools">
3+
xmlns:tools="http://schemas.android.com/tools" >
44

55
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
66

@@ -13,28 +13,38 @@
1313
android:roundIcon="@mipmap/ic_launcher_round"
1414
android:supportsRtl="true"
1515
android:theme="@style/Theme.PersonalityQuiz"
16-
tools:targetApi="31">
17-
18-
<!-- Start Screen Is Here -->
16+
tools:targetApi="31" >
17+
<activity
18+
android:name=".PreviousResultsActivity"
19+
android:exported="false"
20+
android:screenOrientation="portrait"
21+
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
22+
<activity
23+
android:name=".SelectionActivity"
24+
android:exported="false"
25+
android:screenOrientation="portrait"
26+
tools:ignore="DiscouragedApi,LockedOrientationActivity" /> <!-- Start Screen Is Here -->
1927
<activity
2028
android:name=".MainActivity"
21-
android:exported="true">
29+
android:exported="true"
30+
android:screenOrientation="portrait"
31+
tools:ignore="DiscouragedApi,LockedOrientationActivity" >
2232
<intent-filter>
2333
<action android:name="android.intent.action.MAIN" />
34+
2435
<category android:name="android.intent.category.LAUNCHER" />
2536
</intent-filter>
26-
</activity>
27-
28-
<!-- This is where the quiz takes place -->
37+
</activity> <!-- This is where the quiz takes place -->
2938
<activity
3039
android:name=".QuizActivity"
31-
android:exported="false" />
32-
33-
<!-- Shows the results from the one questions quiz -->
40+
android:exported="false"
41+
android:screenOrientation="portrait"
42+
tools:ignore="DiscouragedApi,LockedOrientationActivity" /> <!-- Shows the results from the one questions quiz -->
3443
<activity
3544
android:name=".ResultActivity"
36-
android:exported="false" />
37-
45+
android:exported="false"
46+
android:screenOrientation="portrait"
47+
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
3848
</application>
3949

40-
</manifest>
50+
</manifest>

app/src/main/assets/Disney.db

20 KB
Binary file not shown.

app/src/main/assets/Music.db

20 KB
Binary file not shown.

app/src/main/assets/Results.db

16 KB
Binary file not shown.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package edu.sjsu.android.personalityquiz;
2+
3+
import android.annotation.SuppressLint;
4+
import android.content.Context;
5+
import android.view.MotionEvent;
6+
import android.view.View;
7+
import android.view.animation.Animation;
8+
import android.view.animation.AnimationUtils;
9+
10+
public class ButtonTouchAnimationHelper {
11+
12+
@SuppressLint("ClickableViewAccessibility")
13+
public static void setupTouchAnimation(View view, Context context) {
14+
Animation scaleUp = AnimationUtils.loadAnimation(context, R.anim.scale_up);
15+
Animation scaleDown = AnimationUtils.loadAnimation(context, R.anim.scale_down);
16+
17+
view.setOnTouchListener((v, event) -> {
18+
if (event.getAction() == MotionEvent.ACTION_DOWN) {
19+
v.startAnimation(scaleUp);
20+
} else if (event.getAction() == MotionEvent.ACTION_UP) {
21+
v.startAnimation(scaleDown);
22+
}
23+
return false;
24+
});
25+
}
26+
}
Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,71 @@
11
package edu.sjsu.android.personalityquiz;
22

3+
import android.content.DialogInterface;
34
import android.content.Intent;
5+
import android.content.SharedPreferences;
46
import android.net.Uri;
57
import android.os.Bundle;
68
import android.widget.Button;
9+
10+
import androidx.appcompat.app.AlertDialog;
711
import androidx.appcompat.app.AppCompatActivity;
812

913
import edu.sjsu.android.personalityquiz.databinding.ActivityMainBinding;
1014

1115
public class MainActivity extends AppCompatActivity {
1216
private ActivityMainBinding binding;
17+
private static final String PREFS_NAME = "QuizPrefs";
1318

1419
@Override
1520
protected void onCreate(Bundle savedInstanceState) {
1621
super.onCreate(savedInstanceState);
1722
binding = ActivityMainBinding.inflate(getLayoutInflater());
1823
setContentView(binding.getRoot());
1924

20-
Button startQuizButton = findViewById(R.id.startQuizButton);
21-
startQuizButton.setOnClickListener(view -> {
22-
Intent intent = new Intent(MainActivity.this, QuizActivity.class);
23-
startActivity(intent);
24-
});
25-
25+
binding.startQuizButton.setOnClickListener(v -> checkForResumeOrStartNew());
26+
binding.previousResultsButton.setOnClickListener(v -> viewPreviousResults());
2627
binding.uninstallButton.setOnClickListener(v -> uninstall());
2728
}
2829

29-
/**
30-
* Function that allows the app to be uninstalled.
31-
*/
30+
private void checkForResumeOrStartNew() {
31+
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
32+
boolean inProgress = prefs.getBoolean("quiz_in_progress", false);
33+
34+
if (inProgress) {
35+
new AlertDialog.Builder(this)
36+
.setTitle("Resume Quiz?")
37+
.setMessage("Would you like to resume your previous quiz or start a new one?")
38+
.setPositiveButton("Resume", (dialog, which) -> resumeQuiz())
39+
.setNegativeButton("Start New", (dialog, which) -> startNewQuiz())
40+
.setCancelable(false)
41+
.show();
42+
} else {
43+
startNewQuiz();
44+
}
45+
}
46+
47+
private void resumeQuiz() {
48+
Intent intent = new Intent(MainActivity.this, QuizActivity.class);
49+
intent.putExtra("RESUME_QUIZ", true);
50+
startActivity(intent);
51+
}
52+
53+
private void startNewQuiz() {
54+
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
55+
prefs.edit().clear().apply();
56+
57+
Intent intent = new Intent(MainActivity.this, SelectionActivity.class);
58+
startActivity(intent);
59+
}
60+
3261
private void uninstall() {
3362
Intent delete = new Intent(Intent.ACTION_DELETE, Uri.parse("package:" + getPackageName()));
3463
startActivity(delete);
3564
}
65+
66+
private void viewPreviousResults() {
67+
Intent intent = new Intent(MainActivity.this, PreviousResultsActivity.class);
68+
startActivity(intent);
69+
finish();
70+
}
3671
}

0 commit comments

Comments
 (0)