- 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
@@ -11,8 +11,10 @@ import android.view.MenuItem
import android.widget.AdapterView
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.text.SimpleDateFormat
@@ -163,5 +165,23 @@ class CallsActivity : AppCompatActivity() {
e.printStackTrace()
}
}
fun restoreHistory(path: String) {
val file = File(path + "/history")
if (file.exists()) {
try {
val fis = FileInputStream(file)
val ois = ObjectInputStream(fis)
@SuppressWarnings("unchecked")
MainActivity.history = ois.readObject() as ArrayList<CallHistory>
Log.d("Baresip", "Restored History of ${MainActivity.history.size} entries")
ois.close()
fis.close()
} catch (e: Exception) {
Log.w("Baresip", "InputStream exception: - " + e.toString())
}
}
}
}
}