-
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.
- Loading branch information
Showing
316 changed files
with
2,358 additions
and
58 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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,3 @@ | ||
# CHANGELOG | ||
|
||
# 1.0 |
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,3 @@ | ||
# Stair Tree | ||
|
||
Develop Build : [![Android CI](https://github.com/pycabbage/stair-tree/actions/workflows/android.yml/badge.svg?branch=develop)](https://github.com/pycabbage/stair-tree/actions/workflows/android.yml) |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/> | ||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> | ||
<classpathentry kind="output" path="bin/default"/> | ||
</classpath> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/> | ||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> | ||
<classpathentry kind="output" path="bin/default"/> | ||
</classpath> |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
/build | ||
/build | ||
google-services.json |
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
106 changes: 106 additions & 0 deletions
106
app/src/androidTest/java/com/example/stairtree/DatabaseTest.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,106 @@ | ||
package com.example.stairtree | ||
|
||
import android.content.Context | ||
import androidx.room.Room | ||
import androidx.test.core.app.ApplicationProvider | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import org.junit.After | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Before | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import java.io.IOException | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class DatabaseTest { | ||
private lateinit var db: AppDatabase | ||
private lateinit var sensorDao: SensorDao | ||
private lateinit var dailyDao: DailyDao | ||
|
||
@Before | ||
fun before() { | ||
val context = ApplicationProvider.getApplicationContext<Context>() | ||
synchronized(this) { | ||
db = Room.databaseBuilder( | ||
context, | ||
AppDatabase::class.java, | ||
"test.db" | ||
).build() | ||
} | ||
sensorDao = db.sensor() | ||
dailyDao = db.daily() | ||
} | ||
|
||
@After | ||
@Throws(IOException::class) | ||
fun after() { | ||
db.close() | ||
} | ||
|
||
private fun reset() { | ||
sensorDao.deleteAll() | ||
dailyDao.deleteAll() | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun emptyTest() { | ||
reset() | ||
val emptySensorList = listOf<SensorEntity>() | ||
val emptyDailyList = listOf<DailyEntity>() | ||
assertEquals(sensorDao.selectAll(), emptySensorList) | ||
assertEquals(dailyDao.selectAll(), emptyDailyList) | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun aTest() { | ||
reset() | ||
sensorDao.insert(SensorEntity("a", 1f, 1.0, 1)) | ||
dailyDao.insert(DailyEntity("a", 1.0, 1.0)) | ||
val aSensorList = listOf(SensorEntity("a", 1f, 1.0, 1)) | ||
val aDailyList = listOf(DailyEntity("a", 1.0, 1.0)) | ||
assertEquals(sensorDao.selectAll(), aSensorList) | ||
assertEquals(dailyDao.selectAll(), aDailyList) | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun bTest() { | ||
reset() | ||
repeat(10) { | ||
sensorDao.insert(SensorEntity("a$it", 1f, 1.0, 1)) | ||
dailyDao.insert(DailyEntity("a$it", 1.0, 1.0)) | ||
} | ||
assertEquals(sensorDao.selectAll().size, 10) | ||
assertEquals(dailyDao.selectAll().size, 10) | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun cTest() { | ||
reset() | ||
repeat(10) { | ||
sensorDao.insert(SensorEntity("c", 1f, 1.0, it.toLong())) | ||
dailyDao.insert(DailyEntity("c", it.toDouble(), 1.0)) | ||
} | ||
assertEquals(sensorDao.selectAll().size, 1) | ||
assertEquals(dailyDao.selectAll().size, 1) | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun dTest() { | ||
reset() | ||
repeat(10) { | ||
sensorDao.insert(SensorEntity("d$it", 1f, 1.0, 1)) | ||
dailyDao.insert(DailyEntity("d$it", 1.0, 1.0)) | ||
} | ||
repeat(5) { | ||
sensorDao.delete(SensorEntity("d$it", 1f, 1.0, 1)) | ||
dailyDao.delete(DailyEntity("d$it", 1.0, 1.0)) | ||
} | ||
assertEquals(sensorDao.selectAll().size, 5) | ||
assertEquals(dailyDao.selectAll().size, 5) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,23 +1,48 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.stairtree"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.StairTree"> | ||
<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> | ||
|
||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.stairtree"> | ||
|
||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> | ||
|
||
<application | ||
android:allowBackup="false" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.StairTree"> | ||
<activity | ||
android:name=".ui.map.detail.MapDetailActivity" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true" | ||
android:screenOrientation="portrait"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<receiver | ||
android:name=".background.SensorReceiver" | ||
android:enabled="true" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.LOCALE_CHANGED" /> | ||
</intent-filter> | ||
</receiver> | ||
|
||
<service | ||
android:name=".background.SensorService" | ||
android:enabled="true" | ||
android:exported="false" | ||
android:permission="TODO" /> | ||
|
||
<meta-data | ||
android:name="com.google.android.geo.API_KEY" | ||
android:value="${MAPS_API_KEY}" /> | ||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.