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 1 commit
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
Prev Previous commit
Next Next commit
naming style
  • Loading branch information
butterflyforever committed Jul 17, 2020
commit a1daf87c677429f4a136c17e23f7e26d1268b880
1 change: 1 addition & 0 deletions android/canonical/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.0'
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.0.0'
implementation 'com.google.android.material:material:1.1.0'
Expand Down
48 changes: 0 additions & 48 deletions android/canonical/app/google-services.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@ import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.GoogleAuthProvider

class MainActivity : AppCompatActivity() {
lateinit var mGoogleSignInClient: GoogleSignInClient
lateinit var googleSignInClient: GoogleSignInClient
private lateinit var auth: FirebaseAuth
private val tag = "MainActivity-Login"
private val firebaseTag = "MainActivity-Login"

private fun googleSignInInit() {
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build()

mGoogleSignInClient = GoogleSignIn.getClient(this, gso)
googleSignInClient = GoogleSignIn.getClient(this, gso)
}

private fun signIn() {
auth = FirebaseAuth.getInstance()
val signInIntent = mGoogleSignInClient.signInIntent
val signInIntent = googleSignInClient.signInIntent
startActivityForResult(signInIntent, RC_SIGN_IN)
}

Expand All @@ -46,16 +44,16 @@ class MainActivity : AppCompatActivity() {
try {
// Google Sign In was successful, authenticate with Firebase
val account = task.getResult(ApiException::class.java)!!
Log.d(tag, "firebaseAuthWithGoogle:" + account.id)
Log.d(TAG, "firebaseAuthWithGoogle:" + account.id)
firebaseAuthWithGoogle(account.idToken!!)
setContentView(R.layout.activity_main)
setupNavigationBar()
} catch (e: ApiException) {
// Google Sign In failed
Log.w(tag, "Google sign in failed", e)
Log.w(TAG, "Google sign in failed", e)
}
} else {
Log.w(tag, "Google sign in unsuccessful")
Log.w(TAG, "Google sign in unsuccessful")
}

}
Expand All @@ -69,12 +67,12 @@ class MainActivity : AppCompatActivity() {
.addOnCompleteListener(this) { task ->
if (task.isSuccessful) {
// Firebase Sign in success, update UI with the signed-in user's information
Log.d(firebaseTag, "signInWithCredential:success")
Log.d(FIREBASE_TAG, "signInWithCredential:success")
val user = auth.currentUser
Log.d(firebaseTag, "signed-in user's Email:" + user!!.email)
Log.d(FIREBASE_TAG, "signed-in user's Email:" + user!!.email)
} else {
// If sign in fails, log a message to the user.
Log.w(firebaseTag, "signInWithCredential:failure", task.exception)
Log.w(FIREBASE_TAG, "signInWithCredential:failure", task.exception)
}
}
}
Expand Down Expand Up @@ -152,6 +150,8 @@ class MainActivity : AppCompatActivity() {

companion object {
private const val RC_SIGN_IN = 0
private const val TAG = "MainActivity-Login"
private const val FIREBASE_TAG = "MainAct-firebase-Login"
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.google.firebase.auth.FirebaseAuth

private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"
private const val meTag = "MeFragment"


/**
* A simple [Fragment] subclass.
Expand Down Expand Up @@ -50,7 +50,7 @@ class MeFragment : Fragment() {
logoutButton.setOnClickListener {
// Sign out both Google account and Firebase
FirebaseAuth.getInstance().signOut()
(activity as MainActivity).mGoogleSignInClient.signOut().addOnCompleteListener {
(activity as MainActivity).googleSignInClient.signOut().addOnCompleteListener {
val intent = Intent(context, MainActivity::class.java)
startActivity(intent)
}
Expand All @@ -62,10 +62,10 @@ class MeFragment : Fragment() {
super.onStart()
val account = GoogleSignIn.getLastSignedInAccount(this.context)
account?.let {
Log.i(meTag, "Already login")
Log.i(ME_TAG, "Already login")
view?.findViewById<TextView>(R.id.textView)?.text = account.displayName
} ?.run {
Log.i(meTag, "No login")
Log.i(ME_TAG, "No login")
}
}

Expand All @@ -79,6 +79,9 @@ class MeFragment : Fragment() {
* @param param2 Parameter 2.
* @return A new instance of fragment MeFragment.
*/

private const val ME_TAG = "MeFragment"

// TODO: Rename and change types and number of parameters
@JvmStatic
fun newInstance(param1: String, param2: String) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.Chronometer
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProviders
Expand Down Expand Up @@ -51,6 +50,8 @@ class RunFragment : Fragment() {
param2 = it.getString(ARG_PARAM2)
}

// stopwatchVM = StopwatchViewModel()

stopwatchVM = activity?.run {
ViewModelProviders.of(this)[StopwatchViewModel::class.java]
} ?: throw Exception("Null Activity")
Expand Down