handle actionMode related things only if the activity is init

This commit is contained in:
tibbi 2017-11-10 16:02:20 +01:00
parent 1ef3528a62
commit 1e51175be4

View File

@ -43,6 +43,7 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
lateinit var mNotes: List<Note>
var noteViewWithTextSelected: MyEditText? = null
private var wasInit = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -70,6 +71,8 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
intent.action = null
}
}
wasInit = true
}
private fun handleText(text: String) {
@ -176,6 +179,7 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
// https://code.google.com/p/android/issues/detail?id=191430 quickfix
override fun onActionModeStarted(mode: ActionMode?) {
super.onActionModeStarted(mode)
if (wasInit) {
currentNotesView()?.apply {
if (config.clickableLinks || movementMethod == LinkMovementMethod.getInstance()) {
movementMethod = ArrowKeyMovementMethod.getInstance()
@ -183,6 +187,7 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
}
}
}
}
override fun onActionModeFinished(mode: ActionMode?) {
super.onActionModeFinished(mode)