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
c34cf757
authored
Sep 06, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring: signIn to logIn
parent
f80abd62
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
36 deletions
app/src/main/AndroidManifest.xml
app/src/main/java/com/paktalin/vocabularynotebook/User.java
app/src/main/java/com/paktalin/vocabularynotebook/SignInActivity.kt → app/src/main/java/com/paktalin/vocabularynotebook/activities/LogInActivity.kt
app/src/main/java/com/paktalin/vocabularynotebook/UserActivity.kt → app/src/main/java/com/paktalin/vocabularynotebook/activities/UserActivity.kt
app/src/main/res/layout/activity_sign_in.xml → app/src/main/res/layout/activity_log_in.xml
app/src/main/res/values/strings.xml
app/src/main/AndroidManifest.xml
View file @
c34cf757
...
...
@@ -15,8 +15,8 @@
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
<activity
android:name=
".UserActivity"
/>
<activity
android:name=
".
Sign
InActivity"
>
<activity
android:name=
".
activities.
UserActivity"
/>
<activity
android:name=
".
activities.Log
InActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
app/src/main/java/com/paktalin/vocabularynotebook/User.java
View file @
c34cf757
...
...
@@ -3,7 +3,7 @@ package com.paktalin.vocabularynotebook;
public
class
User
{
private
String
email
,
name
;
User
(
String
email
)
{
public
User
(
String
email
)
{
this
.
email
=
email
;
}
...
...
app/src/main/java/com/paktalin/vocabularynotebook/
Sign
InActivity.kt
→
app/src/main/java/com/paktalin/vocabularynotebook/
activities/Log
InActivity.kt
View file @
c34cf757
package
com.paktalin.vocabularynotebook
package
com.paktalin.vocabularynotebook
.activities
import
android.content.Intent
import
android.support.v7.app.AppCompatActivity
...
...
@@ -10,19 +10,21 @@ import com.google.android.gms.signin.SignIn
import
com.google.firebase.auth.FirebaseAuth
import
com.google.firebase.auth.FirebaseUser
import
kotlinx.android.synthetic.main.activity_
sign
_in.*
import
kotlinx.android.synthetic.main.activity_
log
_in.*
import
com.google.firebase.firestore.FirebaseFirestore
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.User
class
Sign
InActivity
:
AppCompatActivity
()
{
class
Log
InActivity
:
AppCompatActivity
()
{
private
var
mAuth
:
FirebaseAuth
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_
sign
_in
)
setContentView
(
R
.
layout
.
activity_
log
_in
)
mAuth
=
FirebaseAuth
.
getInstance
()
btn
Sign
In
!!
.
setOnClickListener
({
signIn
()
})
btn
Log
In
!!
.
setOnClickListener
({
signIn
()
})
btnSignUp
!!
.
setOnClickListener
({
signUp
()
})
}
...
...
@@ -45,7 +47,7 @@ class SignInActivity : AppCompatActivity() {
}
else
{
Log
.
w
(
TAG
,
"signInWithEmail:failure"
,
task
.
exception
)
Toast
.
makeText
(
this
@
Sign
InActivity
,
"Authentication failed."
,
Toast
.
makeText
(
this
@
Log
InActivity
,
"Authentication failed."
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
...
...
@@ -68,7 +70,7 @@ class SignInActivity : AppCompatActivity() {
}
else
{
Log
.
w
(
TAG
,
"createUserWithEmail:failure"
,
task
.
exception
)
Toast
.
makeText
(
this
@
Sign
InActivity
,
"Authentication failed."
,
Toast
.
makeText
(
this
@
Log
InActivity
,
"Authentication failed."
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
...
...
@@ -77,13 +79,13 @@ class SignInActivity : AppCompatActivity() {
private
fun
startUserActivity
()
{
Log
.
d
(
TAG
,
"Signed in successfully"
)
val
userActivityIntent
=
Intent
(
this
@
Sign
InActivity
,
UserActivity
::
class
.
java
)
val
userActivityIntent
=
Intent
(
this
@
Log
InActivity
,
UserActivity
::
class
.
java
)
startActivity
(
userActivityIntent
)
}
private
fun
fieldsNotEmpty
(
email
:
String
,
password
:
String
):
Boolean
{
if
(
TextUtils
.
isEmpty
(
email
)
||
TextUtils
.
isEmpty
(
password
))
{
Toast
.
makeText
(
this
@
Sign
InActivity
,
"Please, enter email and password"
,
Toast
.
LENGTH_SHORT
).
show
()
Toast
.
makeText
(
this
@
Log
InActivity
,
"Please, enter email and password"
,
Toast
.
LENGTH_SHORT
).
show
()
return
false
}
return
true
...
...
app/src/main/java/com/paktalin/vocabularynotebook/UserActivity.kt
→
app/src/main/java/com/paktalin/vocabularynotebook/
activities/
UserActivity.kt
View file @
c34cf757
package
com.paktalin.vocabularynotebook
package
com.paktalin.vocabularynotebook
.activities
import
android.annotation.SuppressLint
import
android.os.Bundle
import
android.support.v7.app.AppCompatActivity
import
android.util.Log
import
com.google.android.gms.tasks.OnCompleteListener
import
com.google.firebase.auth.FirebaseAuth
import
com.google.firebase.firestore.DocumentReference
import
com.google.firebase.firestore.FirebaseFirestore
import
com.paktalin.vocabularynotebook.R
import
kotlinx.android.synthetic.main.activity_user.*
class
UserActivity
:
AppCompatActivity
()
{
...
...
app/src/main/res/layout/activity_
sign
_in.xml
→
app/src/main/res/layout/activity_
log
_in.xml
View file @
c34cf757
...
...
@@ -5,7 +5,7 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".
Sign
InActivity"
>
tools:context=
".
activities.Log
InActivity"
>
<EditText
android:id=
"@+id/etEmail"
...
...
@@ -39,13 +39,13 @@
android:ems=
"10"
android:hint=
"@string/password_hint"
android:inputType=
"textPassword"
app:layout_constraintBottom_toTopOf=
"@+id/btn
Sign
In"
app:layout_constraintBottom_toTopOf=
"@+id/btn
Log
In"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/etEmail"
/>
<Button
android:id=
"@+id/btn
Sign
In"
android:id=
"@+id/btn
Log
In"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
...
...
@@ -54,7 +54,7 @@
android:layout_marginRight=
"8dp"
android:layout_marginStart=
"8dp"
android:layout_marginTop=
"8dp"
android:text=
"@string/
sign
_in_text"
android:text=
"@string/
log
_in_text"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/btnSignUp"
app:layout_constraintHorizontal_chainStyle=
"packed"
...
...
@@ -70,8 +70,8 @@
android:layout_marginRight=
"8dp"
android:layout_marginStart=
"8dp"
android:text=
"Sign Up"
app:layout_constraintBottom_toBottomOf=
"@+id/btn
Sign
In"
app:layout_constraintBottom_toBottomOf=
"@+id/btn
Log
In"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@+id/btn
Sign
In"
app:layout_constraintTop_toTopOf=
"@+id/btn
Sign
In"
/>
app:layout_constraintStart_toEndOf=
"@+id/btn
Log
In"
app:layout_constraintTop_toTopOf=
"@+id/btn
Log
In"
/>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
c34cf757
...
...
@@ -2,19 +2,7 @@
<string
name=
"app_name"
>
VocabularyNotebook
</string>
<string
name=
"password_hint"
>
Password
</string>
<string
name=
"email_hint"
>
Email
</string>
<string
name=
"sign_in_text"
>
Sign In
</string>
<string
name=
"log_in_text"
>
Log In
</string>
<string
name=
"sign_up_text"
>
Sign Up
</string>
<string
name=
"title_activity_login"
>
Sign in
</string>
<!-- Strings related to login -->
<string
name=
"prompt_email"
>
Email
</string>
<string
name=
"prompt_password"
>
Password (optional)
</string>
<string
name=
"action_sign_in"
>
Sign in or register
</string>
<string
name=
"action_sign_in_short"
>
Sign in
</string>
<string
name=
"error_invalid_email"
>
This email address is invalid
</string>
<string
name=
"error_invalid_password"
>
This password is too short
</string>
<string
name=
"error_incorrect_password"
>
This password is incorrect
</string>
<string
name=
"error_field_required"
>
This field is required
</string>
<string
name=
"permission_rationale"
>
"Contacts permissions are needed for providing email
completions."
</string>
</resources>
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