Prepare for proguard

This commit is contained in:
huangyuhui
2017-08-27 12:49:56 +08:00
parent b07144278b
commit 8c61bc1a5e
16 changed files with 97 additions and 36 deletions

View File

@@ -74,7 +74,14 @@ internal class Log4jHandler(private val callback: (String, Log4jLevel) -> Unit)
*/
fun newLine(content: String) =
Scheduler.COMPUTATION.schedule {
outputStream.write((content + OS.LINE_SEPARATOR).replace("log4j:Event", "log4j_Event").replace("log4j:Message", "log4j_Message").replace("log4j:Throwable", "log4j_Throwable").toByteArray())
var log = content
if (!log.trim().startsWith("<"))
log = "<![CDATA[" + log.replace("]]>", "") + "]]>"
outputStream.write((log + OS.LINE_SEPARATOR)
.replace("log4j:Event", "log4j_Event")
.replace("log4j:Message", "log4j_Message")
.replace("log4j:Throwable", "log4j_Throwable")
.toByteArray())
outputStream.flush()
}

View File

@@ -32,3 +32,5 @@ fun ObservableDoubleValue.onChange(op: (Double) -> Unit) = apply { addListener {
fun <T> ObservableList<T>.onChange(op: (ListChangeListener.Change<out T>) -> Unit) = apply {
addListener(ListChangeListener { op(it) })
}
fun <T> ObservableValue<*>.onInvalidated(op: () -> T) = apply { addListener { _ -> op() } }