Skip to content

Commit ff288d6

Browse files
committed
Fix editor status not updating and last folder not being remembered
- Fixed editor card in main menu not showing last edited file after editing - Fixed file picker not remembering last folder location when clicking Edit RPY again - Added SharedPreferences persistence to RpyEditorActivityNew to save last edited file and folder paths
1 parent 256b925 commit ff288d6

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

.keystore.properties.kate-swp

285 Bytes
Binary file not shown.

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ android {
2020
applicationId "com.renpytool"
2121
minSdk 33
2222
targetSdk 34
23-
versionCode 6
24-
versionName "1.6"
23+
versionCode 7
24+
versionName "1.6.1"
2525

2626
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2727

app/src/main/java/com/renpytool/RpyEditorActivityNew.kt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ class RpyEditorActivityNew : AppCompatActivity() {
7070
codeEditor.setText(Content(newText))
7171
}
7272
}
73+
74+
// Save last edited file location to SharedPreferences
75+
saveLastEditedFile(filePath)
7376
}
7477

7578
setContent {
@@ -172,4 +175,24 @@ class RpyEditorActivityNew : AppCompatActivity() {
172175
super.onBackPressed()
173176
}
174177
}
178+
179+
/**
180+
* Save the last edited file path to SharedPreferences
181+
* This allows the main screen to show the last edited file
182+
* and the file picker to remember the last location
183+
*/
184+
private fun saveLastEditedFile(filePath: String) {
185+
val file = java.io.File(filePath)
186+
val prefs = getSharedPreferences("RentoolPrefs", MODE_PRIVATE)
187+
val editor = prefs.edit()
188+
189+
// Save parent folder if it exists
190+
file.parentFile?.let { parentDir ->
191+
editor.putString("last_rpy_edit_folder", parentDir.absolutePath)
192+
}
193+
194+
// Save file path
195+
editor.putString("last_rpy_edit_file", file.absolutePath)
196+
editor.apply()
197+
}
175198
}

0 commit comments

Comments
 (0)