- fixed callee completion from contacts

- moved restoring of call and message history from baresip service to
  main activity
- small cleanups
This commit is contained in:
Juha Heinanen
2018-10-26 12:04:48 +03:00
parent 6772497d14
commit 289faa0793
10 changed files with 97 additions and 101 deletions
@@ -13,8 +13,10 @@ import android.widget.ImageButton
import android.widget.ListView
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
import java.io.IOException
import java.io.ObjectInputStream
import java.io.ObjectOutputStream
import java.util.*
@@ -221,5 +223,22 @@ class MessagesActivity: AppCompatActivity() {
e.printStackTrace()
}
}
fun restoreMessages(path: String) {
val file = File(path, "messages")
if (file.exists()) {
try {
val fis = FileInputStream(file)
val ois = ObjectInputStream(fis)
@SuppressWarnings("unchecked")
MainActivity.messages = ois.readObject() as ArrayList<Message>
Log.d("Baresip", "Restored ${MainActivity.messages.size} messages")
ois.close()
fis.close()
} catch (e: Exception) {
Log.w("Baresip", "InputStream exception: - " + e.toString())
}
}
}
}
}