Skip to content

Commit d3d42c9

Browse files
committed
delay refreshing menu items at app launch a bit
1 parent a0cbedd commit d3d42c9

File tree

1 file changed

+1
-23
lines changed
  • app/src/main/kotlin/com/simplemobiletools/notes/pro/activities

1 file changed

+1
-23
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/MainActivity.kt

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import android.text.method.LinkMovementMethod
1717
import android.util.TypedValue
1818
import android.view.ActionMode
1919
import android.view.Gravity
20-
import android.view.Menu
2120
import android.view.MenuItem
2221
import android.view.inputmethod.EditorInfo
2322
import android.webkit.WebResourceRequest
@@ -150,27 +149,6 @@ class MainActivity : SimpleActivity() {
150149
}
151150
}
152151

153-
override fun onCreateOptionsMenu(menu: Menu): Boolean {
154-
menuInflater.inflate(R.menu.menu, menu)
155-
menu.apply {
156-
val areButtonsVisible = (showRedoButton || showUndoButton) && mCurrentNote.type == NoteType.TYPE_TEXT.value
157-
findItem(R.id.undo).apply {
158-
isVisible = areButtonsVisible
159-
isEnabled = showUndoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
160-
icon.alpha = if (isEnabled) 255 else 127
161-
}
162-
163-
findItem(R.id.redo).apply {
164-
isVisible = areButtonsVisible
165-
isEnabled = showRedoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
166-
icon.alpha = if (isEnabled) 255 else 127
167-
}
168-
}
169-
170-
updateMenuItemColors(menu)
171-
return true
172-
}
173-
174152
private fun refreshMenuItems() {
175153
val multipleNotesExist = mNotes.size > 1
176154
val isCurrentItemChecklist = isCurrentItemChecklist()
@@ -443,7 +421,6 @@ class MainActivity : SimpleActivity() {
443421

444422
mNotes = notes
445423
mCurrentNote = mNotes[0]
446-
refreshMenuItems()
447424
mAdapter = NotesPagerAdapter(supportFragmentManager, mNotes, this)
448425
view_pager.apply {
449426
adapter = mAdapter
@@ -460,6 +437,7 @@ class MainActivity : SimpleActivity() {
460437
if (!config.showKeyboard || mCurrentNote.type == NoteType.TYPE_CHECKLIST.value) {
461438
hideKeyboard()
462439
}
440+
refreshMenuItems()
463441
}
464442
}
465443

0 commit comments

Comments
 (0)