Commit 7fb927f7 by Paktalin

Fixed the bug with starting tag state when being in edit mode

parent f0081656
...@@ -136,7 +136,8 @@ class MainActivity : AppCompatActivity() { ...@@ -136,7 +136,8 @@ 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()) {
if (!selection.isEmpty) {
vocabularyAdapter?.state = State.TAG vocabularyAdapter?.state = State.TAG
tagFragment.setSelection(selection.toList()) tagFragment.setSelection(selection.toList())
addFragment(supportFragmentManager, tagFragment, R.id.main_activity_container) addFragment(supportFragmentManager, tagFragment, R.id.main_activity_container)
...@@ -146,6 +147,7 @@ class MainActivity : AppCompatActivity() { ...@@ -146,6 +147,7 @@ class MainActivity : AppCompatActivity() {
} }
} }
} }
}
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
......
...@@ -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()
......
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment