Skip to content

Commit

Permalink
Merge branch 'release/1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pycabbage committed Dec 14, 2021
2 parents 7697e63 + c10575b commit ef21b4f
Show file tree
Hide file tree
Showing 316 changed files with 2,358 additions and 58 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,27 @@ jobs:
java-version: '11'
distribution: 'adopt'
cache: gradle
- name: cache gradle
id: cache-gradle
uses: actions/cache@v2
with:
# path: ~/.gradle
# key: ${{ runner.os }}-${{ hashFiles('build.gradle') }}-${{ hashFiles('app/build.gradle') }}
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Prepare google-service.json
env:
GOOGLE_SERVICE_JSON: ${{secrets.GOOGLE_SERVICE_JSON}}
run: echo $GOOGLE_SERVICE_JSON | base64 -d > app/google-services.json

# 依存関係の出力
- name: Displays the Android dependencies of the project
env:
Expand All @@ -58,9 +75,9 @@ jobs:
- name: Compile Release APK
run: ./gradlew assembleRelease
# AABをコンパイル
- name: Compile Debug APK
- name: Compile Debug AAB
run: ./gradlew bundleDebug
- name: Compile Release APK
- name: Compile Release AAB
run: ./gradlew bundleRelease

# リリースAPKに署名
Expand Down
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,23 @@
.externalNativeBuild
.cxx
local.properties

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/jarRepositories.xml
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
.idea/discord.xml
10 changes: 10 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .project
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</natures>
<filteredResources>
<filter>
<id>1637291226009</id>
<id>0</id>
<name></name>
<type>30</type>
<matcher>
Expand Down
2 changes: 1 addition & 1 deletion .settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=D\:/Program Files/gradle
gradle.user.home=
java.home=C\:/Program Files/Android/Android Studio/jre
jvm.arguments=
offline.mode=false
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CHANGELOG

# 1.0
3 changes: 3 additions & 0 deletions README.md
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)
12 changes: 6 additions & 6 deletions app/.classpath
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>
3 changes: 2 additions & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/build
/build
google-services.json
26 changes: 23 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
id 'com.google.gms.google-services'
}

android {
compileSdk 31

defaultConfig {
applicationId "com.example.stairtree"
minSdk 21
minSdk 26
targetSdk 31
versionCode 1
versionName "1.0"
Expand Down Expand Up @@ -40,7 +43,24 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation 'junit:junit:4.+'
implementation 'androidx.fragment:fragment-ktx:1.4.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2'
implementation 'com.google.android.gms:play-services-maps:18.0.0'
implementation 'com.google.maps.android:android-maps-utils:2.2.3'
implementation 'com.google.maps.android:maps-utils-ktx:3.2.0'
implementation "androidx.room:room-runtime:2.3.0"
implementation "androidx.room:room-ktx:2.3.0"
implementation 'com.google.firebase:firebase-firestore-ktx:24.0.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.google.firebase:firebase-firestore:24.0.0'
kapt "androidx.room:room-compiler:2.3.0"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

}
106 changes: 106 additions & 0 deletions app/src/androidTest/java/com/example/stairtree/DatabaseTest.kt
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)
}
}
69 changes: 47 additions & 22 deletions app/src/main/AndroidManifest.xml
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>
Loading

0 comments on commit ef21b4f

Please sign in to comment.