Skip to content

Commit d7dd0d4

Browse files
author
Jan Guegel
committed
apply CodeReview input
getFilePath to updateFilePath menuItem SaveAs never displayed with icon backButtonPressed now uses Save without confirmation Signed-off-by: Jan Guegel <[email protected]>
1 parent 689c16e commit d7dd0d4

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Fixed missing permission prompt on initial "Save as" launch ([#85])
1212
- Fixed printing text files containing a "#" ([#104])
1313

14+
### Added
15+
- Added a separate "Save as" option in the text editor ([#224])
16+
1417
### Changed
15-
- "Save as" moved to menu in Text Editor ([#224])
18+
- Save button now overwrites files directly in the text editor ([#224])
1619

1720
## [1.2.3] - 2025-09-15
1821
### Fixed

app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class ReadTextActivity : SimpleActivity() {
128128
lastSavePromptTS = System.currentTimeMillis()
129129
ConfirmationAdvancedDialog(this, "", R.string.save_before_closing, R.string.save, R.string.discard) {
130130
if (it) {
131-
saveAsText(true)
131+
saveText(true)
132132
} else {
133133
super.onBackPressed()
134134
}
@@ -166,14 +166,14 @@ class ReadTextActivity : SimpleActivity() {
166166
}, 250)
167167
}
168168

169-
private fun getFilePath(){
169+
private fun updateFilePath() {
170170
if (filePath.isEmpty()) {
171171
filePath = getRealPathFromURI(intent.data!!) ?: ""
172172
}
173173
}
174174

175175
private fun saveAsText(shouldExitAfterSaving: Boolean = false) {
176-
getFilePath()
176+
updateFilePath()
177177

178178
if (filePath.isEmpty()) {
179179
SaveAsDialog(this, filePath, true) { _, filename ->
@@ -207,13 +207,12 @@ class ReadTextActivity : SimpleActivity() {
207207
}
208208

209209
private fun saveText(shouldExitAfterSaving: Boolean = false) {
210-
getFilePath()
210+
updateFilePath()
211211

212212
if (hasStoragePermission()) {
213213
val file = File(filePath)
214214
getFileOutputStream(file.toFileDirItem(this), true) {
215-
val shouldOverwriteOriginalText = true
216-
saveTextContent(it, shouldExitAfterSaving, shouldOverwriteOriginalText)
215+
saveTextContent(it, shouldExitAfterSaving, true)
217216
}
218217
} else {
219218
toast(R.string.no_storage_permissions)

app/src/main/res/menu/menu_editor.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
app:showAsAction="always" />
1616
<item
1717
android:id="@+id/menu_save_as"
18-
android:icon="@drawable/ic_save_vector"
18+
android:showAsAction="never"
1919
android:title="@string/save_as"
20-
app:showAsAction="ifRoom" />
20+
app:showAsAction="never" />
2121
<item
2222
android:id="@+id/menu_print"
2323
android:icon="@drawable/ic_print_vector"

0 commit comments

Comments
 (0)