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
**Privacy Policy** | |
VPDEVS built the GTimer app as | |
a Free app. This SERVICE is provided by | |
VPDEVS at no cost and is intended for use as | |
is. | |
This page is used to inform visitors regarding my | |
policies with the collection, use, and disclosure of Personal | |
Information if anyone decided to use my Service. |
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
package com.example.firebaseAuth | |
import android.content.Intent | |
import android.net.Uri | |
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
import android.util.Log | |
import android.view.View | |
import android.widget.Toast | |
import com.bumptech.glide.Glide |
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
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { | |
super.onActivityResult(requestCode, resultCode, data) | |
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...); | |
if (requestCode == RC_SIGN_IN) { | |
val result = Auth.GoogleSignInApi.getSignInResultFromIntent(data) | |
if (result.isSuccess) { | |
// Google Sign In was successful, authenticate with Firebase | |
val account = result.signInAccount | |
firebaseAuthWithGoogle(account!!) | |
} else { |
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
private fun doLogin(){ | |
val signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient) | |
startActivityForResult(signInIntent, RC_SIGN_IN) | |
} |
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
public override fun onStart() { | |
super.onStart() | |
// Check if user is signed in (non-null) and update UI accordingly. | |
val currentUser = mAuth.currentUser | |
val userName = currentUser?.displayName | |
textView_username.text = userName | |
if(!userName.isNullOrEmpty()){ | |
setLoginUIVisible(currentUser?.photoUrl) | |
} | |
} |
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
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_login) | |
// initialise the FirebaseAuth instance | |
mAuth = FirebaseAuth.getInstance() | |
// Configure Google Sign In | |
mGoogleSignInOptions = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) | |
.requestIdToken(getString(R.string.default_web_client_id)) |
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
private lateinit var mAuth: FirebaseAuth | |
private lateinit var mGoogleSignInOptions: GoogleSignInOptions | |
private lateinit var mGoogleApiClient:GoogleApiClient |
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
<com.google.android.gms.common.SignInButton | |
android:id="@+id/button_login" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" /> |
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
val viewModel : TodoListViewModel = ViewModelProviders.of(this).get(TodoListViewModel::class.java) | |
viewModel.getAllTasksFromViewModel()?.observe( | |
this , | |
Observer { | |
if (it != null) { | |
mTodoTaskAdapters = TodoTaskAdapters(this , it) | |
mTaskRecyclerView.layoutManager = LinearLayoutManager( | |
this.applicationContext , | |
LinearLayout.VERTICAL , false) | |
mTaskRecyclerView.adapter = mTodoTaskAdapters |
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
class TodoListViewModel : AndroidViewModel { | |
private var mTodoTaskList : LiveData<List<TodoTask>> ?= null | |
constructor(application: Application) : super(application) { | |
val appDatabase : AppDatabase? = AppDatabase.getInstance(this.getApplication()) | |
mTodoTaskList = appDatabase?.todoTaskDao()?.getallTasks() | |
} | |
fun getAllTasksFromViewModel() : LiveData<List<TodoTask>>? { |
NewerOlder