mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 15:56:48 +08:00
fix: symbol input view is not shown when files are opened
This commit is contained in:
@@ -387,16 +387,20 @@ abstract class BaseEditorActivity :
|
||||
editorViewModel.statusGravity = gravity
|
||||
}
|
||||
|
||||
fun refreshSymbolInput() {
|
||||
provideCurrentEditor()?.also { refreshSymbolInput(it) }
|
||||
}
|
||||
|
||||
fun refreshSymbolInput(editor: CodeEditorView) {
|
||||
binding.bottomSheet.refreshSymbolInput(editor)
|
||||
}
|
||||
|
||||
private fun checkIsDestroying() {
|
||||
if (!isDestroying && isFinishing) {
|
||||
isDestroying = true
|
||||
}
|
||||
}
|
||||
|
||||
protected fun refreshSymbolInput(editor: CodeEditorView) {
|
||||
binding.bottomSheet.refreshSymbolInput(editor)
|
||||
}
|
||||
|
||||
private fun handleUiDesignerResult(result: ActivityResult) {
|
||||
if (result.resultCode != RESULT_OK || result.data == null) {
|
||||
log.warn("UI Designer returned invalid result", result.resultCode, result.data)
|
||||
|
||||
@@ -279,18 +279,15 @@ open class EditorHandlerActivity : ProjectHandlerActivity(), IEditorHandler {
|
||||
override fun openFileAndSelect(file: File, selection: Range?) {
|
||||
openFile(file, selection)
|
||||
|
||||
getEditorForFile(file)?.also {
|
||||
refreshSymbolInput(it)
|
||||
it.editor?.also { editor ->
|
||||
editor.postInLifecycle {
|
||||
if (selection == null) {
|
||||
editor.setSelection(0, 0)
|
||||
return@postInLifecycle
|
||||
}
|
||||
|
||||
editor.validateRange(selection)
|
||||
editor.setSelection(selection)
|
||||
getEditorForFile(file)?.editor?.also { editor ->
|
||||
editor.postInLifecycle {
|
||||
if (selection == null) {
|
||||
editor.setSelection(0, 0)
|
||||
return@postInLifecycle
|
||||
}
|
||||
|
||||
editor.validateRange(selection)
|
||||
editor.setSelection(selection)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.view.LayoutInflater
|
||||
import androidx.appcompat.widget.LinearLayoutCompat
|
||||
import androidx.core.view.isVisible
|
||||
import com.blankj.utilcode.util.SizeUtils
|
||||
import com.itsaky.androidide.activities.editor.BaseEditorActivity
|
||||
import com.itsaky.androidide.app.BaseApplication
|
||||
import com.itsaky.androidide.editor.api.IEditor
|
||||
import com.itsaky.androidide.editor.databinding.LayoutCodeEditorBinding
|
||||
@@ -330,6 +331,9 @@ class CodeEditorView(
|
||||
// This will make sure that textDocument/didOpen is sent
|
||||
binding.editor.file = file
|
||||
|
||||
// do not pass this editor instance
|
||||
// symbol input must be updated for the current editor
|
||||
(context as? BaseEditorActivity?)?.refreshSymbolInput()
|
||||
(context as? Activity?)?.invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user