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
6277fd14
authored
Sep 07, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log out option added
parent
2d0634ca
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
29 deletions
app/src/main/java/com/paktalin/vocabularynotebook/activities/AddWordActivity.java
app/src/main/java/com/paktalin/vocabularynotebook/activities/AddWordActivity.kt
app/src/main/java/com/paktalin/vocabularynotebook/activities/LogInActivity.kt
app/src/main/java/com/paktalin/vocabularynotebook/activities/MainActivity.kt
app/src/main/res/menu/activity_main_drawer.xml
app/src/main/java/com/paktalin/vocabularynotebook/activities/AddWordActivity.java
deleted
100644 → 0
View file @
2d0634ca
package
com
.
paktalin
.
vocabularynotebook
.
activities
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v7.app.AppCompatActivity
;
import
com.paktalin.vocabularynotebook.R
;
public
class
AddWordActivity
extends
AppCompatActivity
{
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_add_word
);
}
}
app/src/main/java/com/paktalin/vocabularynotebook/activities/AddWordActivity.kt
0 → 100644
View file @
6277fd14
package
com.paktalin.vocabularynotebook.activities
import
android.os.Bundle
import
android.support.v7.app.AppCompatActivity
import
com.paktalin.vocabularynotebook.R
class
AddWordActivity
:
AppCompatActivity
()
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_add_word
)
}
}
app/src/main/java/com/paktalin/vocabularynotebook/activities/LogInActivity.kt
View file @
6277fd14
...
...
@@ -63,16 +63,13 @@ class LogInActivity : AppCompatActivity() {
//todo check if the password is good
// todo verify email
mAuth
!!
.
createUserWithEmailAndPassword
(
email
,
password
)
.
addOnCompleteListener
(
this
)
{
task
->
if
(
task
.
isSuccessful
)
{
Log
.
d
(
TAG
,
"Successfully signed up a new user"
)
UserManager
.
addNewUserToDb
(
mAuth
!!
.
currentUser
!!
,
this
)
}
else
{
Log
.
w
(
TAG
,
"createUserWithEmail:failure"
,
task
.
exception
)
Toast
.
makeText
(
this
@LogInActivity
,
"Authentication failed."
,
Toast
.
LENGTH_SHORT
).
show
()
}
.
addOnSuccessListener
{
_
->
Log
.
d
(
TAG
,
"Successfully signed up a new user"
)
UserManager
.
addNewUserToDb
(
mAuth
!!
.
currentUser
!!
,
this
)
}
.
addOnFailureListener
{
Log
.
d
(
TAG
,
"createUserWithEmail:failure"
,
it
.
fillInStackTrace
())
Toast
.
makeText
(
this
@LogInActivity
,
it
.
message
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
}
...
...
app/src/main/java/com/paktalin/vocabularynotebook/activities/MainActivity.kt
View file @
6277fd14
package
com.paktalin.vocabularynotebook.activities
import
android.content.Intent
import
android.os.Bundle
import
android.support.v7.app.AppCompatActivity
import
android.util.Log
import
com.google.firebase.auth.FirebaseAuth
import
com.paktalin.vocabularynotebook.R
import
kotlinx.android.synthetic.main.activity_main.*
...
...
@@ -14,11 +17,21 @@ class MainActivity : AppCompatActivity() {
navigationView
.
setNavigationItemSelectedListener
{
menuItem
->
menuItem
.
isChecked
=
true
if
(
menuItem
.
itemId
==
R
.
id
.
logOut
)
{
logOut
()
}
drawerLayout
!!
.
closeDrawers
()
true
}
}
private
fun
logOut
()
{
Log
.
i
(
TAG
,
"User logged out"
)
FirebaseAuth
.
getInstance
()
!!
.
signOut
()
val
intentLogInActivity
=
Intent
(
this
@MainActivity
,
LogInActivity
::
class
.
java
)
startActivity
(
intentLogInActivity
)
}
companion
object
{
private
val
TAG
=
"VN/"
+
MainActivity
::
class
.
simpleName
}
...
...
app/src/main/res/menu/activity_main_drawer.xml
View file @
6277fd14
...
...
@@ -14,9 +14,9 @@
<group
android:checkableBehavior=
"single"
>
<item
android:id=
"@+id/
map
"
android:icon=
"@
drawable/common_google_signin_btn_icon_light
"
android:title=
"
Vocabulary
"
/>
android:id=
"@+id/
logOut
"
android:icon=
"@
android:drawable/ic_lock_power_off
"
android:title=
"
Log out
"
/>
</group>
</menu>
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