display date in human-readable format
remove invalid : character change YYYY to yyyy
This commit is contained in:
parent
2b62f1aa6d
commit
a12074b0c6
|
@ -14,6 +14,9 @@ import com.simplemobiletools.draw.views.MyCanvas
|
|||
import kotlinx.android.synthetic.main.dialog_save_image.view.*
|
||||
import java.io.File
|
||||
import java.io.OutputStream
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
class SaveImageDialog(val activity: SimpleActivity, val suggestedExtension: String, val curPath: String, val canvas: MyCanvas,
|
||||
callback: (path: String, extension: String) -> Unit) {
|
||||
|
@ -104,7 +107,10 @@ class SaveImageDialog(val activity: SimpleActivity, val suggestedExtension: Stri
|
|||
}
|
||||
|
||||
private fun getInitialFilename(): String {
|
||||
val defaultFilename = "image_${System.currentTimeMillis() / 1000}"
|
||||
// Display date and time in human readable format:
|
||||
val sdf = SimpleDateFormat("yyyy-MM-dd_HH-mm")
|
||||
val defaultFilename = "image_${sdf.format(Date(System.currentTimeMillis()))}"
|
||||
|
||||
return if (curPath.isEmpty()) defaultFilename else curPath.getFilenameFromPath().substring(0, curPath.getFilenameFromPath().lastIndexOf("."))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue