-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create master and push bootcamp code
- Loading branch information
0 parents
commit 4d62037
Showing
43 changed files
with
1,099 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
env: | ||
CC_TEST_REPORTER_ID: ENCRYPTED[d691e43c7b6b4e3f07b5763b31ef435530b3d0bdb6e19f2035661955ba7b85c7a8b8a6527801cce1346fcd84e11fb436] | ||
|
||
container: | ||
image: cirrusci/android-sdk:30 | ||
cpu: 4 | ||
memory: 16G | ||
kvm: true | ||
|
||
check_android_task: | ||
name: Run Android tests | ||
alias: check_android | ||
install_ffmpeg_script: | | ||
sudo apt-get update | ||
sudo apt-get install -y ffmpeg | ||
install_emulator_script: | ||
sdkmanager --install "system-images;android-30;google_apis;x86" | ||
create_avd_script: | ||
echo no | avdmanager create avd --force | ||
--name emulator | ||
--package "system-images;android-30;google_apis;x86" | ||
start_avd_background_script: | ||
$ANDROID_HOME/emulator/emulator | ||
-avd emulator | ||
-no-audio | ||
-no-boot-anim | ||
-gpu swiftshader_indirect | ||
-no-snapshot | ||
-no-window | ||
-camera-back none | ||
assemble_instrumented_tests_script: | | ||
chmod +x gradlew | ||
./gradlew assembleDebugAndroidTest | ||
wait_for_avd_script: | ||
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 3; done; input keyevent 82' | ||
disable_animations_script: | | ||
adb shell settings put global window_animation_scale 0.0 | ||
adb shell settings put global transition_animation_scale 0.0 | ||
adb shell settings put global animator_duration_scale 0.0 | ||
prepare_codeclimate_script: | | ||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | ||
chmod +x ./cc-test-reporter | ||
./cc-test-reporter before-build | ||
screen_record_background_script: | ||
for n in $(seq 1 20); do adb exec-out screenrecord --time-limit=180 --output-format=h264 - > $n.h264; done | ||
check_script: | ||
./gradlew check connectedCheck | ||
report_codeclimate_script: | | ||
export JACOCO_SOURCE_PATH=app/src/main/java/ | ||
./cc-test-reporter format-coverage ./app/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml --input-type jacoco | ||
./cc-test-reporter upload-coverage | ||
always: | ||
wait_for_screenrecord_script: | | ||
pkill -2 -x adb | ||
sleep 2 | ||
convert_to_mp4_script: | ||
find *.h264 | sed 's:\ :\\\ :g'| sed 's/^/file /' > fl.txt; ffmpeg -f concat -i fl.txt -c copy recording.mp4; rm fl.txt | ||
screenrecord_artifacts: | ||
path: "recording.mp4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
exclude_patterns: | ||
- "**/test/" | ||
- "**/androidTest/" | ||
- "**test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
*.iml | ||
*.vs/ | ||
*.vscode/ | ||
*.idea/ | ||
.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<h1 align="center"> GeoHunt - Android Java Project</h1> | ||
|
||
<div align="center"> | ||
<a href="https://cirrus-ci.com/github/SDP-GeoHunt/geo-hunt"><img src="https://api.cirrus-ci.com/github/SDP-GeoHunt/geo-hunt.svg" /></a> | ||
<a href="https://codeclimate.com/github/SDP-GeoHunt/geo-hunt/maintainability"><img src="https://api.codeclimate.com/v1/badges/76d4967c5d3d48e7022f/maintainability"/></a> | ||
<a href="https://codeclimate.com/github/SDP-GeoHunt/geo-hunt/test_coverage"><img src="https://api.codeclimate.com/v1/badges/76d4967c5d3d48e7022f/test_coverage" /></a> | ||
</div> | ||
|
||
The GeoHunt project is an Android game developed in Java that encourages users to explore new locations | ||
by taking pictures of their surroundings and challenging other users to find and reach the location | ||
where the picture was taken. Users can register and create their account, take pictures and upload them | ||
to the game's server, view a list of their active challenges, and view the leaderboard to see who has the | ||
most points. The game is designed to be fun, interactive, and engaging, and to provide users with an opportunity | ||
to discover new places and environments while enjoying a game. Overall, the GeoHunt project is a unique and | ||
innovative way to explore the world around us while having fun with other players. | ||
|
||
|
||
## How to Play | ||
|
||
1. Users take a picture of their current location and upload it to the game's server. | ||
2. The game assigns the uploaded picture to another user, who must find and go to the location where the picture was taken. | ||
3. The closer the user gets to the actual location, the higher the points they earn. | ||
4. Users can view the game's leaderboard to see who has the most points. | ||
|
||
## Features | ||
|
||
* Users can register and create their account | ||
* Users can take pictures and upload them to the game's server | ||
* Users can view a list of their active challenges. | ||
* Users can view the leaderboard to see who has the most points. | ||
* Users can report inappropriate content. | ||
|
||
## Contributing Guidelines | ||
|
||
Thank you for considering contributing to our private repository! To ensure the confidentiality | ||
and security of our codebase, we have some guidelines for contributing that we ask you to follow: | ||
|
||
1. Make sure your code follows the project's code style and best practices. | ||
2. Write clear and concise commit messages that describe the changes you made. | ||
3. When adding new features or fixing bugs, make sure to write tests and ensure all existing tests pass. | ||
4. If your contribution changes any existing functionality, make sure to update the project's documentation accordingly. | ||
5. Submit a pull request and wait for contributors to review your changes. | ||
|
||
## Code Style and Best Practices | ||
|
||
* Use Java coding standards and best practices. See the [Google Style Guide](https://google.github.io/styleguide/javaguide.html) for further information. | ||
* Follow the project's code style guide and best practices. | ||
* Keep your code clean, concise, and easy to read. | ||
* Use meaningful variable names and comments to explain your code. | ||
* Use proper exception handling to ensure code reliability. | ||
* Write tests to ensure the reliability of your code. | ||
* Avoid using third-party libraries unless necessary. | ||
* Keep code modular and follow separation of concerns. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'jacoco' | ||
} | ||
|
||
android { | ||
namespace 'com.github.geohunt.app' | ||
compileSdk 33 | ||
|
||
defaultConfig { | ||
applicationId "com.github.geohunt.app" | ||
minSdk 24 | ||
targetSdk 33 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
debug { | ||
testCoverageEnabled true | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_9 | ||
targetCompatibility JavaVersion.VERSION_1_9 | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'androidx.appcompat:appcompat:1.6.1' | ||
implementation 'com.google.android.material:material:1.8.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.5' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' | ||
androidTestImplementation 'androidx.test:runner:1.5.2' | ||
androidTestImplementation 'androidx.test:rules:1.5.0' | ||
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1' | ||
} | ||
|
||
tasks.withType(Test) { | ||
jacoco.includeNoLocationClasses = true | ||
jacoco.excludes = ['jdk.internal.*'] | ||
} | ||
|
||
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) { | ||
reports { | ||
xml.required = true | ||
html.required = true | ||
} | ||
|
||
def fileFilter = [ | ||
'**/R.class', | ||
'**/R$*.class', | ||
'**/BuildConfig.*', | ||
'**/Manifest*.*', | ||
'**/*Test*.*', | ||
'android/**/*.*', | ||
] | ||
|
||
def debugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/classes", excludes: fileFilter) | ||
def mainSrc = "$project.projectDir/src/main/java" | ||
|
||
sourceDirectories.setFrom(files([mainSrc])) | ||
classDirectories.setFrom(files([debugTree])) | ||
executionData.setFrom(fileTree(dir: project.buildDir, includes: [ | ||
'outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec', | ||
'outputs/code_coverage/debugAndroidTest/connected/*/coverage.ec' | ||
])) | ||
} | ||
|
||
connectedCheck { | ||
finalizedBy jacocoTestReport | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
36 changes: 36 additions & 0 deletions
36
app/src/androidTest/java/com/github/geohunt/app/GreetingActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.github.geohunt.app; | ||
|
||
import static androidx.test.espresso.Espresso.*; | ||
import static androidx.test.espresso.assertion.ViewAssertions.*; | ||
import static androidx.test.espresso.matcher.ViewMatchers.*; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
|
||
import androidx.test.core.app.ActivityScenario; | ||
import androidx.test.core.app.ApplicationProvider; | ||
import androidx.test.espresso.Espresso; | ||
import androidx.test.espresso.ViewInteraction; | ||
import androidx.test.espresso.assertion.ViewAssertions; | ||
import androidx.test.espresso.matcher.ViewMatchers; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(AndroidJUnit4.class) | ||
public class GreetingActivityTest { | ||
private static String USERNAME = "Here's Johny"; | ||
|
||
@Test | ||
public void testGreetingActivityFromIntent() | ||
{ | ||
Intent intent = new Intent(ApplicationProvider.getApplicationContext(), GreetingActivity.class); | ||
intent.putExtra("name", USERNAME); | ||
try (ActivityScenario<?> activity = ActivityScenario.launch(intent)) | ||
{ | ||
ViewInteraction text = onView(withId(R.id.greetingMessage)); | ||
text.check(matches(withText(String.format("Hello %s!", USERNAME)))); | ||
} | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
app/src/androidTest/java/com/github/geohunt/app/MainActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.github.geohunt.app; | ||
|
||
import static androidx.test.espresso.Espresso.onView; | ||
import static androidx.test.espresso.action.ViewActions.*; | ||
import static androidx.test.espresso.intent.Intents.intended; | ||
import static androidx.test.espresso.matcher.ViewMatchers.*; | ||
import static org.hamcrest.Matchers.allOf; | ||
|
||
import androidx.test.espresso.ViewInteraction; | ||
import androidx.test.espresso.action.ViewActions; | ||
import androidx.test.espresso.intent.Intents; | ||
import androidx.test.espresso.intent.matcher.IntentMatchers; | ||
import androidx.test.espresso.matcher.ViewMatchers; | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
import androidx.test.espresso.Espresso; | ||
|
||
import org.hamcrest.Matcher; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(AndroidJUnit4.class) | ||
public class MainActivityTest { | ||
|
||
private static final String USERNAME = "BingChilling"; | ||
|
||
@Rule | ||
public ActivityScenarioRule<MainActivity> testRule = new ActivityScenarioRule<>(MainActivity.class); | ||
|
||
@Before | ||
public void onTestStart() { | ||
Intents.init(); | ||
} | ||
|
||
@Before | ||
public void onTestEnd() { | ||
Intents.release(); | ||
} | ||
|
||
@Test | ||
public void mainActivityStartGreetingUponClick() { | ||
// write the username to the corresponding field | ||
onView(withId(R.id.mainName)) | ||
.perform(typeText(USERNAME)); | ||
|
||
// click on the navigate button. Notice that without | ||
// the closeSoftKeyboard() call this test won't pass | ||
// the CI. Likely due to different screen behavior | ||
onView(withId(R.id.mainGoButton)) | ||
.perform(closeSoftKeyboard()) | ||
.perform(click()); | ||
|
||
// ensure that a new intent as been emitted | ||
intended(allOf( | ||
IntentMatchers.hasComponent(GreetingActivity.class.getName()), | ||
IntentMatchers.hasExtra("name", USERNAME) | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
android:fullBackupContent="@xml/backup_rules" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.GeoHunt" | ||
tools:targetApi="31"> | ||
<activity | ||
android:name=".GreetingActivity" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.