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
7fb927f7
authored
Apr 25, 2019
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the bug with starting tag state when being in edit mode
parent
f0081656
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
app/src/main/java/com/paktalin/vocabularynotebook/ui/activities/MainActivity.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/fragments/SubmitEditedFragment.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/recycler_view/State.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/activities/MainActivity.kt
View file @
7fb927f7
...
@@ -136,13 +136,15 @@ class MainActivity : AppCompatActivity() {
...
@@ -136,13 +136,15 @@ class MainActivity : AppCompatActivity() {
private
fun
whenSelectionChanges
(
selection
:
Selection
<
Long
>)
{
private
fun
whenSelectionChanges
(
selection
:
Selection
<
Long
>)
{
vocabularyAdapter
?.
let
{
vocabularyAdapter
?.
let
{
if
(!
selection
.
isEmpty
&&
it
.
state
.
notAddOrEdit
())
{
if
(
it
.
state
.
notAddOrEdit
())
{
vocabularyAdapter
?.
state
=
State
.
TAG
if
(!
selection
.
isEmpty
)
{
tagFragment
.
setSelection
(
selection
.
toList
())
vocabularyAdapter
?.
state
=
State
.
TAG
addFragment
(
supportFragmentManager
,
tagFragment
,
R
.
id
.
main_activity_container
)
tagFragment
.
setSelection
(
selection
.
toList
())
}
else
{
addFragment
(
supportFragmentManager
,
tagFragment
,
R
.
id
.
main_activity_container
)
vocabularyAdapter
?.
state
=
State
.
NONE
}
else
{
removeFragment
(
supportFragmentManager
,
tagFragment
)
vocabularyAdapter
?.
state
=
State
.
NONE
removeFragment
(
supportFragmentManager
,
tagFragment
)
}
}
}
}
}
}
}
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/fragments/SubmitEditedFragment.kt
View file @
7fb927f7
...
@@ -22,6 +22,7 @@ class SubmitEditedFragment : SubmitFragment() {
...
@@ -22,6 +22,7 @@ class SubmitEditedFragment : SubmitFragment() {
scrollToPositionWithOffset
(
recyclerViewPosition
,
2
)
scrollToPositionWithOffset
(
recyclerViewPosition
,
2
)
isScrollEnabled
=
false
isScrollEnabled
=
false
}
}
mainActivity
.
vocabularyAdapter
?.
state
=
State
.
EDIT
mainActivity
.
vocabularyAdapter
?.
state
=
State
.
EDIT
gone
(
clickableView
)
gone
(
clickableView
)
wordEt
.
requestFocus
()
wordEt
.
requestFocus
()
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/recycler_view/State.kt
View file @
7fb927f7
package
com.paktalin.vocabularynotebook.ui.recycler_view
package
com.paktalin.vocabularynotebook.ui.recycler_view
import
com.paktalin.vocabularynotebook.ui.activities.MainActivity
enum
class
State
{
enum
class
State
{
EDIT
,
ADD
,
TAG
,
NONE
;
EDIT
,
ADD
,
TAG
,
NONE
;
fun
notAddOrEdit
():
Boolean
{
fun
notAddOrEdit
():
Boolean
{
return
this
!=
ADD
&&
this
!=
EDIT
return
this
!=
ADD
&&
this
!=
EDIT
}
}
companion
object
{
private
val
TAGG
=
"VN/"
+
MainActivity
::
class
.
simpleName
}
}
}
\ 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