Skip to content

Summer 2020 #505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
6434e6d
Create empty project
caller9 Jun 3, 2020
72244e3
just for test
butterflyforever Jun 4, 2020
7ac54d7
basic view and Running fragment
butterflyforever Jun 19, 2020
8695acd
mapview
butterflyforever Jun 22, 2020
34099ec
1. Using view model to store the status of fragment.
butterflyforever Jun 26, 2020
54ce5cc
1. Use Data Binding to change Layout
butterflyforever Jun 26, 2020
0bfd15c
Fix code reviews
butterflyforever Jun 29, 2020
ec63756
Merge pull request #464 from googlesamples/yang
caller9 Jun 29, 2020
feb69ff
Remove comment
caller9 Jun 30, 2020
5354fbd
Merge branch 'master' into summer-2020
caller9 Jun 30, 2020
b37af95
Add working directory default
caller9 Jun 30, 2020
c348d48
search bar
butterflyforever Jul 1, 2020
f704af2
bringToFront
butterflyforever Jul 1, 2020
8fc8663
serach place and movethe map sight
butterflyforever Jul 9, 2020
d1453a6
formalize code style
butterflyforever Jul 11, 2020
94000b1
modify value type
butterflyforever Jul 14, 2020
7066c93
remove getFloat
butterflyforever Jul 14, 2020
aa21ca3
intergate auth
butterflyforever Jul 15, 2020
b683e1b
move const to companion object
butterflyforever Jul 15, 2020
80e6432
attach to PR
butterflyforever Jul 15, 2020
b60386d
Merge pull request #472 from googlesamples/yang-mapview
caller9 Jul 15, 2020
2b1723c
get UserID
butterflyforever Jul 16, 2020
d0891ce
move const to companion object
butterflyforever Jul 15, 2020
bb6ce25
attach to PR
butterflyforever Jul 15, 2020
c1560e0
attach to PR
butterflyforever Jul 15, 2020
ac80bfe
implemented logout
butterflyforever Jul 17, 2020
4f946c4
Merge branch 'yang-auth' of github.com:googlesamples/google-services …
butterflyforever Jul 17, 2020
dfde7f7
add google-service.json
butterflyforever Jul 17, 2020
a1daf87
naming style
butterflyforever Jul 17, 2020
76c28af
json
butterflyforever Jul 17, 2020
c07e51f
1. Add login fragment. Seperate login process from MainActivity
butterflyforever Jul 22, 2020
2c738ea
remove comment
butterflyforever Jul 22, 2020
fc9cf21
remove comment
butterflyforever Jul 22, 2020
55e0185
remove comment
butterflyforever Jul 22, 2020
9fd9d17
move login in check to ViewModel
butterflyforever Jul 24, 2020
49337b0
resolve conflict
butterflyforever Jul 25, 2020
4ec5ab3
resolve conflict
butterflyforever Jul 25, 2020
e99fae9
resolve conflict
butterflyforever Jul 25, 2020
4bd8bac
resolve conflict
butterflyforever Jul 25, 2020
9d511f9
Merge branch 'summer-2020' into yang-auth
butterflyforever Jul 25, 2020
b90072d
add LiveData class
butterflyforever Jul 27, 2020
f416fc5
1. Adapt it to MVVM architecture
butterflyforever Jul 28, 2020
832118a
Merge pull request #476 from googlesamples/yang-auth
caller9 Jul 29, 2020
a7f9ed3
firestore create user
butterflyforever Aug 3, 2020
849d656
1. Create User in Firstore
butterflyforever Aug 6, 2020
964684b
interaction between runFragment and Forestore
butterflyforever Aug 8, 2020
c88db07
adjust timestamp format
butterflyforever Aug 8, 2020
62eb7fe
ListView
butterflyforever Aug 9, 2020
db97450
Fix login bug -- adjust postion of check-login function
butterflyforever Aug 9, 2020
92df1df
remove unused code block
butterflyforever Aug 9, 2020
61e98d5
Welcome Page
butterflyforever Aug 10, 2020
303f5ad
adjust the position of logout observer
butterflyforever Aug 11, 2020
a06b60e
image button at runFragment
butterflyforever Aug 11, 2020
588851a
fix code review
butterflyforever Aug 15, 2020
0f1f91a
Test
butterflyforever Aug 15, 2020
d10f35f
test with mock account info
butterflyforever Aug 19, 2020
3c58154
ViewHolder Pattern in Adapter
butterflyforever Aug 19, 2020
17c66fa
Update readme.md
butterflyforever Aug 20, 2020
def696a
Merge pull request #479 from googlesamples/yang-firestore
caller9 Aug 20, 2020
33d77f0
Update readme.md
butterflyforever Aug 20, 2020
15a651f
Merge branch 'summer-2020' into Canonical-summer-2020-Readme
caller9 Aug 20, 2020
33ae320
Merge pull request #480 from googlesamples/Canonical-summer-2020-Readme
caller9 Aug 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/canonical-gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
pull_request:
branches: [ summer-2020 ]

defaults:
run:
working-directory: android/canonical

jobs:
build:

Expand All @@ -20,8 +24,6 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Switch to canonical project
run: cd android/canonical/
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
14 changes: 14 additions & 0 deletions android/canonical/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*.iml
.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
1 change: 1 addition & 0 deletions android/canonical/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
107 changes: 107 additions & 0 deletions android/canonical/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"

buildFeatures {
dataBinding true
}

defaultConfig {
applicationId "com.google.samples.quickstart.canonical"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

staging {
initWith(buildTypes.debug) // keep versionName and PIN from 'debug'
defaultConfig.minSdkVersion 18
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}

testOptions {
unitTests.returnDefaultValues = true
}
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.fragment:fragment-ktx:1.2.5"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.gms:play-services-auth:18.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.libraries.places:places:2.3.0'
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'com.google.firebase:firebase-analytics-ktx:17.4.4'
implementation 'com.google.firebase:firebase-auth-ktx:19.3.2'
implementation 'com.google.firebase:firebase-firestore-ktx:21.4.3'

implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'

debugImplementation "androidx.fragment:fragment-testing:1.2.5"

kapt 'com.android.databinding:compiler:3.1.4'

// Core library
androidTestImplementation 'androidx.test:core:1.0.0'

// AndroidJUnitRunner and JUnit Rules
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'


// Assertions
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.ext:truth:1.0.0'
androidTestImplementation 'com.google.truth:truth:0.42'

// Espresso dependencies
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'

testImplementation 'junit:junit:4.12'
testImplementation "androidx.arch.core:core-testing:2.1.0"
testImplementation "androidx.test.ext:junit-ktx:1.1.1"
testImplementation "androidx.test:core-ktx:1.2.0"
testImplementation "org.robolectric:robolectric:4.1"




}
48 changes: 48 additions & 0 deletions android/canonical/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"project_info": {
"project_number": "558666181231",
"firebase_url": "https://pivotal-nebula-281103.firebaseio.com",
"project_id": "pivotal-nebula-281103",
"storage_bucket": "pivotal-nebula-281103.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:558666181231:android:ace62cb2b3bd45e4a3fb9a",
"android_client_info": {
"package_name": "com.google.samples.quickstart.canonical"
}
},
"oauth_client": [
{
"client_id": "558666181231-ts5q1e04oha2g1m7km4jonff5s6fe1qk.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.google.samples.quickstart.canonical",
"certificate_hash": "cf9e073a08e94150b32d4c6e5004a5e26a647287"
}
},
{
"client_id": "558666181231-bt85k6hb4mfeuri817m7o2n1m96a3shh.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "THIS IS PRIVATE"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "558666181231-bt85k6hb4mfeuri817m7o2n1m96a3shh.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
21 changes: 21 additions & 0 deletions android/canonical/app/proguard-rules.pro
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.google.samples.quickstart.canonical

import androidx.test.espresso.Espresso.onData
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.RootMatchers.isDialog
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.ActivityTestRule
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.UiSelector
import org.hamcrest.Matchers
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class DatabaseInteractionTest {
@get:Rule
var activityRule: ActivityTestRule<MainActivity>
= ActivityTestRule(MainActivity::class.java)

lateinit var device : UiDevice

@Before
fun setup() {
device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
onView(ViewMatchers.withId(R.id.sign_in_button))
.perform(click())
val googleSignInDialog = device.findObject(UiSelector().text("[email protected]"))
googleSignInDialog.clickAndWaitForNewWindow()
// Make sure that:
// 1. Your google account must have signed out before test.
// 2. You should have at lest one google account for your device,
// which means, when you click sign in button, you have at least
// one account to choose

// Construct your test database:
// Account: [email protected]

}

@Test
fun submitRecord() {
onView(ViewMatchers.withId(R.id.start_pause_btn))
.perform(click())
Thread.sleep(5000)

onView(ViewMatchers.withId(R.id.submit_btn))
.perform(click())
Thread.sleep(2000)
onView(ViewMatchers.withText("Submission Confirm"))
.inRoot(isDialog())
.check(matches(ViewMatchers.isDisplayed()))
onView(ViewMatchers.withText("Confirm"))
.inRoot(isDialog())
.perform(click())
Thread.sleep(1000)

onView(ViewMatchers.withId(R.id.bottom_navigation_item_profile))
.perform(click())

onView(ViewMatchers.withId(R.id.run_history_list_view))
.check(matches(ViewMatchers.isDisplayed()))
onData(Matchers.anything())
.inAdapterView(ViewMatchers.withId(R.id.run_history_list_view))
.atPosition(0)
.onChildView(ViewMatchers.withId(R.id.single_run_time))
.check(matches(ViewMatchers.withText("00:00:05"))) // In your test database, the latest
.perform(click())
}

@After
fun logoutUser() {
onView(ViewMatchers.withId(R.id.bottom_navigation_item_profile))
.perform(click())
onView(ViewMatchers.withId(R.id.logout_button))
.perform(click())
Thread.sleep(1000)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.google.samples.quickstart.canonical

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.google.samples.quickstart.canonical", appContext.packageName)
}
}
Loading