Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.itsaky.androidide.activities.editor

import android.content.Intent
import android.content.res.Configuration
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
Expand All @@ -26,6 +27,7 @@ import android.view.ViewGroup.LayoutParams
import androidx.collection.MutableIntObjectMap
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.GravityCompat
import androidx.core.view.doOnNextLayout
import androidx.lifecycle.lifecycleScope
import com.blankj.utilcode.util.ImageUtils
import com.google.android.material.tabs.TabLayout
Expand Down Expand Up @@ -79,6 +81,7 @@ import org.adfa.constants.CONTENT_KEY
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.io.File
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.atomic.AtomicBoolean
import java.util.function.Consumer
Expand All @@ -100,7 +103,7 @@ open class EditorHandlerActivity :

protected val isOpenedFilesSaved = AtomicBoolean(false)

private val fileTimestamps = mutableMapOf<String, Long>()
private val fileTimestamps = ConcurrentHashMap<String, Long>()

private val pluginTabIndices = mutableMapOf<String, Int>()
private val tabIndexToPluginId = mutableMapOf<Int, String>()
Expand Down Expand Up @@ -704,6 +707,16 @@ open class EditorHandlerActivity :
}
}

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)

getCurrentEditor()?.editor?.apply {
doOnNextLayout {
cursor?.let { c -> ensurePositionVisible(c.leftLine, c.leftColumn, true) }
}
}
}

private suspend fun saveResultInternal(
index: Int,
result: SaveResult,
Expand All @@ -723,6 +736,10 @@ open class EditorHandlerActivity :
return false
}

frag.file?.let { savedFile ->
fileTimestamps[savedFile.absolutePath] = savedFile.lastModified()
}

val isGradle = fileName.endsWith(".gradle") || fileName.endsWith(".gradle.kts")
val isXml: Boolean = fileName.endsWith(".xml")
if (!result.gradleSaved) {
Expand Down
Loading