Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
likorn
/
vocabulary_notebook
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f3574940
authored
Nov 11, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Isolated logOut and startActivity functions
parent
757b3b59
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
17 deletions
app/src/main/java/com/paktalin/vocabularynotebook/ui/activities/LogInActivity.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/activities/MainActivity.kt
app/src/main/java/com/paktalin/vocabularynotebook/utils/ActivityUtil.kt
app/src/main/java/com/paktalin/vocabularynotebook/utils/UserManager.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/activities/LogInActivity.kt
View file @
f3574940
...
@@ -7,10 +7,7 @@ import android.os.Bundle
...
@@ -7,10 +7,7 @@ import android.os.Bundle
import
android.util.Log
import
android.util.Log
import
com.paktalin.vocabularynotebook.*
import
com.paktalin.vocabularynotebook.*
import
com.paktalin.vocabularynotebook.utils.fieldsNotEmpty
import
com.paktalin.vocabularynotebook.utils.*
import
com.paktalin.vocabularynotebook.utils.shortToast
import
com.paktalin.vocabularynotebook.utils.signUp
import
com.paktalin.vocabularynotebook.utils.userLoggedIn
import
kotlinx.android.synthetic.main.activity_log_in.*
import
kotlinx.android.synthetic.main.activity_log_in.*
class
LogInActivity
:
AppCompatActivity
()
{
class
LogInActivity
:
AppCompatActivity
()
{
...
@@ -53,8 +50,7 @@ class LogInActivity : AppCompatActivity() {
...
@@ -53,8 +50,7 @@ class LogInActivity : AppCompatActivity() {
fun
startUserActivity
()
{
fun
startUserActivity
()
{
Log
.
d
(
TAG
,
"Logged in successfully"
)
Log
.
d
(
TAG
,
"Logged in successfully"
)
val
userActivityIntent
=
Intent
(
this
@LogInActivity
,
MainActivity
::
class
.
java
)
startActivity
(
this
@LogInActivity
,
MainActivity
::
class
.
java
)
startActivity
(
userActivityIntent
)
}
}
private
fun
addProgressBar
()
{
private
fun
addProgressBar
()
{
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/activities/MainActivity.kt
View file @
f3574940
package
com.paktalin.vocabularynotebook.ui.activities
package
com.paktalin.vocabularynotebook.ui.activities
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.app.AppCompatActivity
import
android.util.Log
import
android.util.Log
import
com.google.firebase.auth.FirebaseAuth
import
kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.activity_main.*
import
android.view.WindowManager
import
android.view.WindowManager
...
@@ -20,6 +18,7 @@ import com.paktalin.vocabularynotebook.ui.fragments.VocabularyFragment
...
@@ -20,6 +18,7 @@ import com.paktalin.vocabularynotebook.ui.fragments.VocabularyFragment
import
com.paktalin.vocabularynotebook.utils.addFragment
import
com.paktalin.vocabularynotebook.utils.addFragment
import
com.paktalin.vocabularynotebook.utils.extractVocabularyData
import
com.paktalin.vocabularynotebook.utils.extractVocabularyData
import
com.paktalin.vocabularynotebook.utils.shortToast
import
com.paktalin.vocabularynotebook.utils.shortToast
import
com.paktalin.vocabularynotebook.utils.startActivity
class
MainActivity
:
AppCompatActivity
()
{
class
MainActivity
:
AppCompatActivity
()
{
...
@@ -48,10 +47,8 @@ class MainActivity : AppCompatActivity() {
...
@@ -48,10 +47,8 @@ class MainActivity : AppCompatActivity() {
}
}
private
fun
logOut
()
{
private
fun
logOut
()
{
Log
.
i
(
TAG
,
"User logged out"
)
logOut
()
FirebaseAuth
.
getInstance
()
!!
.
signOut
()
startActivity
(
this
@MainActivity
,
LogInActivity
::
class
.
java
)
val
intentLogInActivity
=
Intent
(
this
@MainActivity
,
LogInActivity
::
class
.
java
)
startActivity
(
intentLogInActivity
)
}
}
private
fun
setUpNavigationView
()
{
private
fun
setUpNavigationView
()
{
...
...
app/src/main/java/com/paktalin/vocabularynotebook/utils/ActivityUtil.kt
View file @
f3574940
package
com.paktalin.vocabularynotebook.utils
package
com.paktalin.vocabularynotebook.utils
import
android.content.Context
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.support.v4.app.Fragment
import
android.support.v4.app.FragmentManager
import
android.support.v4.app.FragmentManager
...
@@ -48,3 +49,7 @@ fun enableScrolling(mainActivity: MainActivity) {
...
@@ -48,3 +49,7 @@ fun enableScrolling(mainActivity: MainActivity) {
fun
shortToast
(
context
:
Context
,
text
:
String
)
{
fun
shortToast
(
context
:
Context
,
text
:
String
)
{
Toast
.
makeText
(
context
,
text
,
Toast
.
LENGTH_SHORT
).
show
()
Toast
.
makeText
(
context
,
text
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
fun
startActivity
(
context
:
Context
,
cls
:
Class
<*>)
{
context
.
startActivity
(
Intent
(
context
,
cls
))
}
\ No newline at end of file
app/src/main/java/com/paktalin/vocabularynotebook/utils/UserManager.kt
View file @
f3574940
...
@@ -3,12 +3,7 @@ package com.paktalin.vocabularynotebook.utils
...
@@ -3,12 +3,7 @@ package com.paktalin.vocabularynotebook.utils
import
android.util.Log
import
android.util.Log
import
com.google.firebase.auth.FirebaseAuth
import
com.google.firebase.auth.FirebaseAuth
import
com.google.firebase.auth.FirebaseUser
import
com.google.firebase.auth.FirebaseUser
import
com.paktalin.vocabularynotebook.appsetup.ConfiguredFirestore
import
com.paktalin.vocabularynotebook.ui.activities.LogInActivity
import
com.paktalin.vocabularynotebook.ui.activities.LogInActivity
import
com.paktalin.vocabularynotebook.firestoreitems.UserPojo
import
com.paktalin.vocabularynotebook.firestoreitems.Vocabulary
import
com.paktalin.vocabularynotebook.firestoreitems.Vocabulary.Companion.VOCABULARIES
import
java.util.*
private
const
val
TAG
=
"VN/UserManager"
private
const
val
TAG
=
"VN/UserManager"
private
var
mAuth
:
FirebaseAuth
?
=
FirebaseAuth
.
getInstance
()
private
var
mAuth
:
FirebaseAuth
?
=
FirebaseAuth
.
getInstance
()
...
@@ -49,3 +44,8 @@ fun signUp(activity: LogInActivity, email: String, password: String) {
...
@@ -49,3 +44,8 @@ fun signUp(activity: LogInActivity, email: String, password: String) {
fun
userLoggedIn
():
Boolean
{
fun
userLoggedIn
():
Boolean
{
return
mAuth
!!
.
currentUser
!=
null
return
mAuth
!!
.
currentUser
!=
null
}
}
fun
logOut
()
{
mAuth
!!
.
signOut
()
Log
.
i
(
TAG
,
"User logged out"
)
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment