mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
fix #386, automatically append "_1" after the filename when saving in editor
This commit is contained in:
parent
8e99cd5364
commit
7f10f67c7b
3 changed files with 8 additions and 4 deletions
|
@ -141,13 +141,13 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
setResult(RESULT_OK)
|
||||
finish()
|
||||
} else if (uri.scheme == "file") {
|
||||
SaveAsDialog(this, uri.path) {
|
||||
SaveAsDialog(this, uri.path, true) {
|
||||
saveBitmapToFile(result.bitmap, it)
|
||||
}
|
||||
} else if (uri.scheme == "content") {
|
||||
val newPath = applicationContext.getRealPathFromURI(uri) ?: ""
|
||||
if (!newPath.isEmpty()) {
|
||||
SaveAsDialog(this, newPath) {
|
||||
SaveAsDialog(this, newPath, true) {
|
||||
saveBitmapToFile(result.bitmap, it)
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -446,7 +446,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
|
||||
private fun saveImageAs() {
|
||||
val currPath = getCurrentPath()
|
||||
SaveAsDialog(this, currPath) {
|
||||
SaveAsDialog(this, currPath, false) {
|
||||
Thread({
|
||||
toast(R.string.saving)
|
||||
val selectedFile = File(it)
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.simplemobiletools.gallery.activities.SimpleActivity
|
|||
import kotlinx.android.synthetic.main.dialog_save_as.view.*
|
||||
import java.io.File
|
||||
|
||||
class SaveAsDialog(val activity: SimpleActivity, val path: String, val callback: (savePath: String) -> Unit) {
|
||||
class SaveAsDialog(val activity: SimpleActivity, val path: String, val appendFilename: Boolean, val callback: (savePath: String) -> Unit) {
|
||||
|
||||
init {
|
||||
var realPath = File(path).parent.trimEnd('/')
|
||||
|
@ -28,6 +28,10 @@ class SaveAsDialog(val activity: SimpleActivity, val path: String, val callback:
|
|||
save_as_extension.setText(extension)
|
||||
}
|
||||
|
||||
if (appendFilename) {
|
||||
name += "_1"
|
||||
}
|
||||
|
||||
save_as_name.setText(name)
|
||||
save_as_path.setOnClickListener {
|
||||
FilePickerDialog(activity, realPath, false, false, true) {
|
||||
|
|
Loading…
Reference in a new issue