mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-04 18:51:14 +02:00
delay refreshing menu items at app launch a bit
This commit is contained in:
parent
a0cbedd54d
commit
d3d42c9953
@ -17,7 +17,6 @@ import android.text.method.LinkMovementMethod
|
|||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.view.ActionMode
|
import android.view.ActionMode
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.Menu
|
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.webkit.WebResourceRequest
|
import android.webkit.WebResourceRequest
|
||||||
@ -150,27 +149,6 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
|
||||||
menuInflater.inflate(R.menu.menu, menu)
|
|
||||||
menu.apply {
|
|
||||||
val areButtonsVisible = (showRedoButton || showUndoButton) && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
|
||||||
findItem(R.id.undo).apply {
|
|
||||||
isVisible = areButtonsVisible
|
|
||||||
isEnabled = showUndoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
|
||||||
icon.alpha = if (isEnabled) 255 else 127
|
|
||||||
}
|
|
||||||
|
|
||||||
findItem(R.id.redo).apply {
|
|
||||||
isVisible = areButtonsVisible
|
|
||||||
isEnabled = showRedoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
|
||||||
icon.alpha = if (isEnabled) 255 else 127
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateMenuItemColors(menu)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun refreshMenuItems() {
|
private fun refreshMenuItems() {
|
||||||
val multipleNotesExist = mNotes.size > 1
|
val multipleNotesExist = mNotes.size > 1
|
||||||
val isCurrentItemChecklist = isCurrentItemChecklist()
|
val isCurrentItemChecklist = isCurrentItemChecklist()
|
||||||
@ -443,7 +421,6 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
mNotes = notes
|
mNotes = notes
|
||||||
mCurrentNote = mNotes[0]
|
mCurrentNote = mNotes[0]
|
||||||
refreshMenuItems()
|
|
||||||
mAdapter = NotesPagerAdapter(supportFragmentManager, mNotes, this)
|
mAdapter = NotesPagerAdapter(supportFragmentManager, mNotes, this)
|
||||||
view_pager.apply {
|
view_pager.apply {
|
||||||
adapter = mAdapter
|
adapter = mAdapter
|
||||||
@ -460,6 +437,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
if (!config.showKeyboard || mCurrentNote.type == NoteType.TYPE_CHECKLIST.value) {
|
if (!config.showKeyboard || mCurrentNote.type == NoteType.TYPE_CHECKLIST.value) {
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
}
|
}
|
||||||
|
refreshMenuItems()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user