rescan svg file afer creation

This commit is contained in:
tibbi 2017-04-08 23:58:09 +02:00
parent c231de0e95
commit 64d4c30a33
2 changed files with 1 additions and 6 deletions

View File

@ -8,7 +8,6 @@ import java.io.*
import java.util.* import java.util.*
object Svg { object Svg {
@Throws(Exception::class)
fun saveSvg(output: File, canvas: MyCanvas) { fun saveSvg(output: File, canvas: MyCanvas) {
val backgroundColor = (canvas.background as ColorDrawable).color val backgroundColor = (canvas.background as ColorDrawable).color
@ -18,7 +17,6 @@ object Svg {
writer.close() writer.close()
} }
@Throws(IOException::class)
private fun writeSvg(writer: Writer, backgroundColor: Int, paths: Map<MyPath, PaintOptions>, width: Int, height: Int) { private fun writeSvg(writer: Writer, backgroundColor: Int, paths: Map<MyPath, PaintOptions>, width: Int, height: Int) {
writer.write("<svg width=\"") writer.write("<svg width=\"")
writer.write(width.toString()) writer.write(width.toString())
@ -41,7 +39,6 @@ object Svg {
writer.write("</svg>") writer.write("</svg>")
} }
@Throws(IOException::class)
private fun writePath(writer: Writer, path: MyPath, options: PaintOptions) { private fun writePath(writer: Writer, path: MyPath, options: PaintOptions) {
writer.write("<path d=\"") writer.write("<path d=\"")
for (action in path.getActions()) { for (action in path.getActions()) {
@ -56,7 +53,6 @@ object Svg {
writer.write("\" stroke-linecap=\"round\"/>") writer.write("\" stroke-linecap=\"round\"/>")
} }
@Throws(Exception::class)
fun loadSvg(file: File, canvas: MyCanvas) { fun loadSvg(file: File, canvas: MyCanvas) {
val svg = parseSvg(file) val svg = parseSvg(file)
@ -72,7 +68,6 @@ object Svg {
} }
} }
@Throws(Exception::class)
private fun parseSvg(file: File): SSvg { private fun parseSvg(file: File): SSvg {
var inputStream: InputStream? = null var inputStream: InputStream? = null
val svg = SSvg() val svg = SSvg()

View File

@ -80,7 +80,6 @@ class SaveImageDialog(val activity: SimpleActivity, val curPath: String, val can
try { try {
out = FileOutputStream(file) out = FileOutputStream(file)
canvas.getBitmap().compress(Bitmap.CompressFormat.PNG, 100, out) canvas.getBitmap().compress(Bitmap.CompressFormat.PNG, 100, out)
activity.scanFile(file) {}
} catch (e: Exception) { } catch (e: Exception) {
return false return false
} finally { } finally {
@ -89,6 +88,7 @@ class SaveImageDialog(val activity: SimpleActivity, val curPath: String, val can
} }
SVG -> Svg.saveSvg(file, canvas) SVG -> Svg.saveSvg(file, canvas)
} }
activity.scanFile(file) {}
return true return true
} }
} }