-
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.
* Modify configuration files to support Kotlin & Jetpack Compose As discussed this morning, we plan on moving to Kotlin and Jetpack compose. This commit marks the beginning of the modification to make it. * Update minSdk to comply with firebase requirement Changes: * Change from minSdk:24 to minSdk:28 to comply with the firebase realtime database requirements * Delete old java activity file and write basic test Changes: * Remove `GreetingActivity.java` and `MainActivity.java` and dependencies * Write simple `ComposeActvitityTest.kt` * fix: Support for coverage with Kotlin * Added Mockito * Fixed the build.gradle with proper versions * 🔥 💯 :triump: base 😡 --------- Co-authored-by: BoyeGuillaume <guillaume.boye@epfl.ch>
- Loading branch information
1 parent
4d62037
commit f9251b6
Showing
22 changed files
with
371 additions
and
207 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
24 changes: 24 additions & 0 deletions
24
app/src/androidTest/java/com/github/geohunt/app/ComposeActivityTest.kt
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,24 @@ | ||
package com.github.geohunt.app | ||
|
||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithText | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class ComposeActivityTest { | ||
|
||
@get:Rule | ||
val composeTestRule = createComposeRule() | ||
|
||
@Test | ||
fun testMainComposeActivity() { | ||
// Start the application | ||
composeTestRule.setContent { | ||
DefaultPreview() | ||
} | ||
|
||
composeTestRule.onNodeWithText("Hello Android!") | ||
.assertIsDisplayed(); | ||
} | ||
} |
36 changes: 0 additions & 36 deletions
36
app/src/androidTest/java/com/github/geohunt/app/GreetingActivityTest.java
This file was deleted.
Oops, something went wrong.
61 changes: 0 additions & 61 deletions
61
app/src/androidTest/java/com/github/geohunt/app/MainActivityTest.java
This file was deleted.
Oops, something went wrong.
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
40 changes: 40 additions & 0 deletions
40
app/src/main/java/com/github/geohunt/app/ComposeActivity.kt
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,40 @@ | ||
package com.github.geohunt.app | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Surface | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import com.github.geohunt.app.ui.theme.GeoHuntTheme | ||
|
||
class ComposeActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
GeoHuntTheme { | ||
// A surface container using the 'background' color from the theme | ||
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colors.background) { | ||
Greeting("Android") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun Greeting(name: String) { | ||
Text(text = "Hello $name!") | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun DefaultPreview() { | ||
GeoHuntTheme { | ||
Greeting("Android") | ||
} | ||
} |
22 changes: 0 additions & 22 deletions
22
app/src/main/java/com/github/geohunt/app/GreetingActivity.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
app/src/main/java/com/github/geohunt/app/MainActivity.java
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
app/src/main/java/com/github/geohunt/app/model/database/Database.kt
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,34 @@ | ||
package com.github.geohunt.app.model.database | ||
|
||
import android.app.Activity | ||
import android.graphics.Bitmap | ||
import com.github.geohunt.app.model.database.api.Challenge | ||
import com.github.geohunt.app.model.database.api.Location | ||
import java.util.concurrent.CompletableFuture | ||
|
||
|
||
interface Database { | ||
fun createChallenge(bitmap: Bitmap, location: Location) : CompletableFuture<Challenge> | ||
|
||
fun getChallengeById(cid: String) : CompletableFuture<Challenge> | ||
|
||
fun getNearbyChallenge(location: Location) : CompletableFuture<List<Challenge>> | ||
|
||
// fun getProfileById(uid: String) : CompletableFuture<Profile> | ||
|
||
} | ||
|
||
/** | ||
* Utility class to create a new database handle (this is used for testing purpose | ||
* to replace the database instance with a mock one using mockito) | ||
*/ | ||
object DatabaseFactory { | ||
|
||
/** | ||
* Create a new instance of a database | ||
*/ | ||
fun createDatabaseHandle(activity: Activity) : Database { | ||
TODO("Not implemented") | ||
} | ||
} | ||
|
Oops, something went wrong.