fix: improve options menu inflation and invalidation in editor activity

This commits improves the options menu inflation and invalidation logic in the EditorActivity. The options menu is now properly invalidated in onPrepareOptionsMenu and inflated only
 when required. Also, the options menu is now lazily invalidated, cancelling all the previous invalidation calls in order to prevent re-inflating the options menu frequently.
This commit is contained in:
Akash Yadav
2023-10-27 20:04:41 +05:30
parent e193723529
commit a11c4607b4
4 changed files with 97 additions and 47 deletions
@@ -17,15 +17,10 @@
package com.itsaky.androidide.projects.models
import com.itsaky.androidide.eventbus.events.editor.ChangeType
import com.itsaky.androidide.eventbus.events.editor.DocumentChangeEvent
import com.itsaky.androidide.utils.ILogger
import java.io.BufferedInputStream
import java.io.BufferedReader
import java.io.Closeable
import java.nio.file.Path
import java.time.Instant
import java.util.concurrent.Semaphore
/**
* A document that is opened in the editor.
@@ -38,6 +33,7 @@ open class ActiveDocument(
var modified: Instant,
content: String = ""
) {
var content: String = content
internal set