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
2027d343
authored
Apr 29, 2019
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
package refactoring
parent
38842264
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
36 additions
and
25 deletions
app/src/main/java/com/paktalin/vocabularynotebook/firestoreitems/UserPojo.kt → app/src/main/java/com/paktalin/vocabularynotebook/entities/UserPojo.kt
app/src/main/java/com/paktalin/vocabularynotebook/firestoreitems/VocabularyPojo.kt → app/src/main/java/com/paktalin/vocabularynotebook/entities/VocabularyPojo.kt
app/src/main/java/com/paktalin/vocabularynotebook/firestoreitems/WordPojo.kt → app/src/main/java/com/paktalin/vocabularynotebook/entities/WordPojo.kt
app/src/main/java/com/paktalin/vocabularynotebook/utils/FirestoreManager.kt → app/src/main/java/com/paktalin/vocabularynotebook/firestore/FirestoreManager.kt
app/src/main/java/com/paktalin/vocabularynotebook/utils/UserManager.kt → app/src/main/java/com/paktalin/vocabularynotebook/firestore/UserManager.kt
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/ui/fragments/SubmitAddedFragment.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/fragments/SubmitEditedFragment.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/recycler_view/ViewHolder.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/recycler_view/VocabularyAdapter.kt
app/src/main/java/com/paktalin/vocabularynotebook/utils/ActivityUtil.kt
app/src/main/java/com/paktalin/vocabularynotebook/vocabulary/BasicVocabulary.kt
app/src/main/java/com/paktalin/vocabularynotebook/vocabulary/DisplayedVocabulary.kt
app/src/main/java/com/paktalin/vocabularynotebook/vocabulary/ModifiedVocabulary.kt
app/src/main/java/com/paktalin/vocabularynotebook/vocabulary/VocabSet.kt
app/src/main/java/com/paktalin/vocabularynotebook/vocabulary/Vocabulary.kt
app/src/main/java/com/paktalin/vocabularynotebook/
firestoreitem
s/UserPojo.kt
→
app/src/main/java/com/paktalin/vocabularynotebook/
entitie
s/UserPojo.kt
View file @
2027d343
package
com.paktalin.vocabularynotebook.
firestoreitem
s
package
com.paktalin.vocabularynotebook.
entitie
s
import
com.google.firebase.firestore.DocumentReference
import
com.google.firebase.firestore.DocumentReference
...
...
app/src/main/java/com/paktalin/vocabularynotebook/
firestoreitem
s/VocabularyPojo.kt
→
app/src/main/java/com/paktalin/vocabularynotebook/
entitie
s/VocabularyPojo.kt
View file @
2027d343
package
com.paktalin.vocabularynotebook.
firestoreitem
s
package
com.paktalin.vocabularynotebook.
entitie
s
class
VocabularyPojo
(
var
title
:
String
?)
{
class
VocabularyPojo
(
var
title
:
String
?)
{
init
{
init
{
...
...
app/src/main/java/com/paktalin/vocabularynotebook/
firestoreitem
s/WordPojo.kt
→
app/src/main/java/com/paktalin/vocabularynotebook/
entitie
s/WordPojo.kt
View file @
2027d343
package
com.paktalin.vocabularynotebook.
firestoreitem
s
package
com.paktalin.vocabularynotebook.
entitie
s
import
java.io.Serializable
import
java.io.Serializable
import
java.util.*
import
java.util.*
...
...
app/src/main/java/com/paktalin/vocabularynotebook/
utils
/FirestoreManager.kt
→
app/src/main/java/com/paktalin/vocabularynotebook/
firestore
/FirestoreManager.kt
View file @
2027d343
package
com.paktalin.vocabularynotebook.
utils
package
com.paktalin.vocabularynotebook.
firestore
import
android.content.Context
import
android.content.Context
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.google.firebase.firestore.*
import
com.google.firebase.firestore.*
import
com.paktalin.vocabularynotebook.appsetup.ConfiguredFirestore
import
com.paktalin.vocabularynotebook.appsetup.ConfiguredFirestore
import
com.paktalin.vocabularynotebook.
firestoreitem
s.UserPojo
import
com.paktalin.vocabularynotebook.
entitie
s.UserPojo
import
com.paktalin.vocabularynotebook.
firestoreitem
s.VocabularyPojo
import
com.paktalin.vocabularynotebook.
entitie
s.VocabularyPojo
import
com.paktalin.vocabularynotebook.
firestoreitem
s.WordPojo
import
com.paktalin.vocabularynotebook.
entitie
s.WordPojo
import
com.paktalin.vocabularynotebook.ui.activities.LogInActivity
import
com.paktalin.vocabularynotebook.ui.activities.LogInActivity
import
com.paktalin.vocabularynotebook.utils.Log
import
com.paktalin.vocabularynotebook.utils.saveVocabularyId
import
com.paktalin.vocabularynotebook.vocabulary.ModifiedVocabulary.Label
import
com.paktalin.vocabularynotebook.vocabulary.ModifiedVocabulary.Label
import
java.util.*
import
java.util.*
...
...
app/src/main/java/com/paktalin/vocabularynotebook/
utils
/UserManager.kt
→
app/src/main/java/com/paktalin/vocabularynotebook/
firestore
/UserManager.kt
View file @
2027d343
package
com.paktalin.vocabularynotebook.
utils
package
com.paktalin.vocabularynotebook.
firestore
import
android.util.Patterns
import
android.util.Patterns
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.R
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.ui.activities.LogInActivity
import
com.paktalin.vocabularynotebook.ui.activities.LogInActivity
import
com.paktalin.vocabularynotebook.utils.Log
import
com.paktalin.vocabularynotebook.utils.removeProgressBar
import
com.paktalin.vocabularynotebook.utils.shortToast
private
const
val
TAG
=
"VN/UserManager"
private
const
val
TAG
=
"VN/UserManager"
private
var
mAuth
:
FirebaseAuth
?
=
FirebaseAuth
.
getInstance
()
private
var
mAuth
:
FirebaseAuth
?
=
FirebaseAuth
.
getInstance
()
...
@@ -12,7 +15,7 @@ private var mAuth: FirebaseAuth? = FirebaseAuth.getInstance()
...
@@ -12,7 +15,7 @@ private var mAuth: FirebaseAuth? = FirebaseAuth.getInstance()
fun
mDeleteUser
(
user
:
FirebaseUser
)
{
fun
mDeleteUser
(
user
:
FirebaseUser
)
{
user
.
delete
()
user
.
delete
()
.
addOnSuccessListener
{
Log
.
i
(
TAG
,
"UserPojo was successfully deleted"
)
}
.
addOnSuccessListener
{
Log
.
i
(
TAG
,
"UserPojo was successfully deleted"
)
}
.
addOnFailureListener
{
Log
.
i
(
TAG
,
"mDeleteUser:failure"
,
it
.
cause
)}
.
addOnFailureListener
{
Log
.
i
(
TAG
,
"mDeleteUser:failure"
,
it
.
cause
)
}
}
}
fun
mLogIn
(
onComplete
:
()
->
Unit
,
onSuccess
:
()
->
Unit
,
onFailure
:
()
->
Unit
,
fun
mLogIn
(
onComplete
:
()
->
Unit
,
onSuccess
:
()
->
Unit
,
onFailure
:
()
->
Unit
,
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/activities/LogInActivity.kt
View file @
2027d343
package
com.paktalin.vocabularynotebook.ui.activities
package
com.paktalin.vocabularynotebook.ui.activities
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
com.paktalin.vocabularynotebook.*
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.firestore.mLogIn
import
com.paktalin.vocabularynotebook.firestore.mSignUp
import
com.paktalin.vocabularynotebook.firestore.mUserLoggedIn
import
com.paktalin.vocabularynotebook.utils.*
import
com.paktalin.vocabularynotebook.utils.*
import
kotlinx.android.synthetic.main.activity_log_in.*
import
kotlinx.android.synthetic.main.activity_log_in.*
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/activities/MainActivity.kt
View file @
2027d343
...
@@ -11,6 +11,8 @@ import androidx.appcompat.app.AppCompatActivity
...
@@ -11,6 +11,8 @@ import androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.widget.SearchView
import
androidx.appcompat.widget.SearchView
import
androidx.recyclerview.selection.Selection
import
androidx.recyclerview.selection.Selection
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.firestore.FirestoreManager
import
com.paktalin.vocabularynotebook.firestore.mLogOut
import
com.paktalin.vocabularynotebook.ui.fragments.SubmitAddedFragment
import
com.paktalin.vocabularynotebook.ui.fragments.SubmitAddedFragment
import
com.paktalin.vocabularynotebook.ui.fragments.TagFragment
import
com.paktalin.vocabularynotebook.ui.fragments.TagFragment
import
com.paktalin.vocabularynotebook.ui.recycler_view.State
import
com.paktalin.vocabularynotebook.ui.recycler_view.State
...
@@ -153,7 +155,7 @@ class MainActivity : AppCompatActivity() {
...
@@ -153,7 +155,7 @@ class MainActivity : AppCompatActivity() {
super
.
onPause
()
super
.
onPause
()
hideKeyboard
()
hideKeyboard
()
try
{
try
{
vocabularyAdapter
?.
getModifiedWords
()
?.
let
{
FirestoreManager
().
saveWords
(
it
)
}
FirestoreManager
().
saveWords
(
vocabularyAdapter
?.
getModifiedWords
()
!!
)
}
catch
(
ignored
:
Exception
)
{
}
catch
(
ignored
:
Exception
)
{
}
}
}
}
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/fragments/SubmitAddedFragment.kt
View file @
2027d343
package
com.paktalin.vocabularynotebook.ui.fragments
package
com.paktalin.vocabularynotebook.ui.fragments
import
com.paktalin.vocabularynotebook.
firestoreitem
s.WordPojo
import
com.paktalin.vocabularynotebook.
entitie
s.WordPojo
import
com.paktalin.vocabularynotebook.ui.recycler_view.State
import
com.paktalin.vocabularynotebook.ui.recycler_view.State
import
com.paktalin.vocabularynotebook.utils.removeFragment
import
com.paktalin.vocabularynotebook.utils.removeFragment
import
kotlinx.android.synthetic.main.word_item.*
import
kotlinx.android.synthetic.main.word_item.*
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/fragments/SubmitEditedFragment.kt
View file @
2027d343
...
@@ -2,7 +2,7 @@ package com.paktalin.vocabularynotebook.ui.fragments
...
@@ -2,7 +2,7 @@ package com.paktalin.vocabularynotebook.ui.fragments
import
android.view.View
import
android.view.View
import
android.widget.EditText
import
android.widget.EditText
import
com.paktalin.vocabularynotebook.
firestoreitem
s.WordPojo
import
com.paktalin.vocabularynotebook.
entitie
s.WordPojo
import
com.paktalin.vocabularynotebook.ui.recycler_view.State
import
com.paktalin.vocabularynotebook.ui.recycler_view.State
import
com.paktalin.vocabularynotebook.ui.views.LockableLayoutManager
import
com.paktalin.vocabularynotebook.ui.views.LockableLayoutManager
import
com.paktalin.vocabularynotebook.utils.gone
import
com.paktalin.vocabularynotebook.utils.gone
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/recycler_view/ViewHolder.kt
View file @
2027d343
...
@@ -4,7 +4,7 @@ import android.view.View
...
@@ -4,7 +4,7 @@ import android.view.View
import
android.widget.EditText
import
android.widget.EditText
import
androidx.recyclerview.selection.ItemDetailsLookup
import
androidx.recyclerview.selection.ItemDetailsLookup
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView
import
com.paktalin.vocabularynotebook.
firestoreitem
s.WordPojo
import
com.paktalin.vocabularynotebook.
entitie
s.WordPojo
import
com.paktalin.vocabularynotebook.utils.visible
import
com.paktalin.vocabularynotebook.utils.visible
import
kotlinx.android.synthetic.main.word_item.view.*
import
kotlinx.android.synthetic.main.word_item.view.*
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/recycler_view/VocabularyAdapter.kt
View file @
2027d343
...
@@ -6,13 +6,14 @@ import android.view.ViewGroup
...
@@ -6,13 +6,14 @@ import android.view.ViewGroup
import
androidx.appcompat.widget.PopupMenu
import
androidx.appcompat.widget.PopupMenu
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.
firestoreitem
s.WordPojo
import
com.paktalin.vocabularynotebook.
entitie
s.WordPojo
import
com.paktalin.vocabularynotebook.ui.activities.MainActivity
import
com.paktalin.vocabularynotebook.ui.activities.MainActivity
import
com.paktalin.vocabularynotebook.ui.fragments.SubmitEditedFragment
import
com.paktalin.vocabularynotebook.ui.fragments.SubmitEditedFragment
import
com.paktalin.vocabularynotebook.ui.recycler_view.selection_tracker.MySelectionTracker
import
com.paktalin.vocabularynotebook.ui.recycler_view.selection_tracker.MySelectionTracker
import
com.paktalin.vocabularynotebook.utils.addSubmitFragment
import
com.paktalin.vocabularynotebook.utils.addSubmitFragment
import
com.paktalin.vocabularynotebook.utils.gone
import
com.paktalin.vocabularynotebook.utils.gone
import
com.paktalin.vocabularynotebook.utils.visible
import
com.paktalin.vocabularynotebook.utils.visible
import
com.paktalin.vocabularynotebook.vocabulary.ModifiedVocabulary
import
com.paktalin.vocabularynotebook.vocabulary.Sort
import
com.paktalin.vocabularynotebook.vocabulary.Sort
import
com.paktalin.vocabularynotebook.vocabulary.VocabSet
import
com.paktalin.vocabularynotebook.vocabulary.VocabSet
import
kotlinx.android.synthetic.main.word_item.*
import
kotlinx.android.synthetic.main.word_item.*
...
@@ -89,7 +90,7 @@ class VocabularyAdapter(private val vocabulary: VocabSet, private val mainActivi
...
@@ -89,7 +90,7 @@ class VocabularyAdapter(private val vocabulary: VocabSet, private val mainActivi
notifyDataSetChanged
()
notifyDataSetChanged
()
}
}
fun
getModifiedWords
():
MutableMap
<
WordPojo
,
Boolean
>
{
fun
getModifiedWords
():
MutableMap
<
ModifiedVocabulary
.
Label
,
MutableList
<
WordPojo
>
>
{
return
vocabulary
.
getModified
()
return
vocabulary
.
getModified
()
}
}
...
...
app/src/main/java/com/paktalin/vocabularynotebook/utils/ActivityUtil.kt
View file @
2027d343
...
@@ -10,6 +10,7 @@ import androidx.appcompat.app.AppCompatActivity
...
@@ -10,6 +10,7 @@ import androidx.appcompat.app.AppCompatActivity
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.FragmentManager
import
androidx.fragment.app.FragmentManager
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.firestore.isEmail
import
com.paktalin.vocabularynotebook.ui.fragments.ProgressFragment
import
com.paktalin.vocabularynotebook.ui.fragments.ProgressFragment
import
com.paktalin.vocabularynotebook.ui.fragments.SubmitFragment
import
com.paktalin.vocabularynotebook.ui.fragments.SubmitFragment
import
org.apache.commons.lang3.StringUtils
import
org.apache.commons.lang3.StringUtils
...
...
app/src/main/java/com/paktalin/vocabularynotebook/vocabulary/BasicVocabulary.kt
View file @
2027d343
package
com.paktalin.vocabularynotebook.vocabulary
package
com.paktalin.vocabularynotebook.vocabulary
import
com.paktalin.vocabularynotebook.
firestoreitem
s.WordPojo
import
com.paktalin.vocabularynotebook.
entitie
s.WordPojo
open
class
BasicVocabulary
(
var
wordList
:
MutableList
<
WordPojo
>):
Vocabulary
{
open
class
BasicVocabulary
(
var
wordList
:
MutableList
<
WordPojo
>):
Vocabulary
{
...
...
app/src/main/java/com/paktalin/vocabularynotebook/vocabulary/DisplayedVocabulary.kt
View file @
2027d343
package
com.paktalin.vocabularynotebook.vocabulary
package
com.paktalin.vocabularynotebook.vocabulary
import
com.paktalin.vocabularynotebook.
firestoreitem
s.WordPojo
import
com.paktalin.vocabularynotebook.
entitie
s.WordPojo
class
DisplayedVocabulary
(
wordList
:
MutableList
<
WordPojo
>):
BasicVocabulary
(
wordList
)
{
class
DisplayedVocabulary
(
wordList
:
MutableList
<
WordPojo
>):
BasicVocabulary
(
wordList
)
{
...
...
app/src/main/java/com/paktalin/vocabularynotebook/vocabulary/ModifiedVocabulary.kt
View file @
2027d343
package
com.paktalin.vocabularynotebook.vocabulary
package
com.paktalin.vocabularynotebook.vocabulary
import
com.paktalin.vocabularynotebook.
firestoreitem
s.WordPojo
import
com.paktalin.vocabularynotebook.
entitie
s.WordPojo
import
com.paktalin.vocabularynotebook.
utils
.FirestoreManager
import
com.paktalin.vocabularynotebook.
firestore
.FirestoreManager
class
ModifiedVocabulary
:
Vocabulary
{
class
ModifiedVocabulary
:
Vocabulary
{
...
...
app/src/main/java/com/paktalin/vocabularynotebook/vocabulary/VocabSet.kt
View file @
2027d343
...
@@ -4,7 +4,7 @@ import android.graphics.Color
...
@@ -4,7 +4,7 @@ import android.graphics.Color
import
com.google.firebase.Timestamp
import
com.google.firebase.Timestamp
import
com.google.firebase.firestore.QueryDocumentSnapshot
import
com.google.firebase.firestore.QueryDocumentSnapshot
import
com.google.firebase.firestore.QuerySnapshot
import
com.google.firebase.firestore.QuerySnapshot
import
com.paktalin.vocabularynotebook.
firestoreitem
s.WordPojo
import
com.paktalin.vocabularynotebook.
entitie
s.WordPojo
import
java.util.*
import
java.util.*
class
VocabSet
(
var
wordList
:
MutableList
<
WordPojo
>)
:
Vocabulary
{
class
VocabSet
(
var
wordList
:
MutableList
<
WordPojo
>)
:
Vocabulary
{
...
@@ -82,7 +82,7 @@ class VocabSet(var wordList: MutableList<WordPojo>) : Vocabulary {
...
@@ -82,7 +82,7 @@ class VocabSet(var wordList: MutableList<WordPojo>) : Vocabulary {
return
displayedVocabulary
.
size
()
return
displayedVocabulary
.
size
()
}
}
fun
getModified
():
MutableMap
<
WordPojo
,
Boolean
>
{
fun
getModified
():
MutableMap
<
ModifiedVocabulary
.
Label
,
MutableList
<
WordPojo
>
>
{
return
modifiedVocabulary
.
get
()
return
modifiedVocabulary
.
get
()
}
}
...
...
app/src/main/java/com/paktalin/vocabularynotebook/vocabulary/Vocabulary.kt
View file @
2027d343
package
com.paktalin.vocabularynotebook.vocabulary
package
com.paktalin.vocabularynotebook.vocabulary
import
com.paktalin.vocabularynotebook.
firestoreitem
s.WordPojo
import
com.paktalin.vocabularynotebook.
entitie
s.WordPojo
interface
Vocabulary
{
interface
Vocabulary
{
...
...
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