Commit be9f3535 authored by Anon's avatar Anon
Browse files

BatchTransferFragment: Correctly start transfer.

parent 36061730
......@@ -61,8 +61,7 @@ class BatchTransferFragment : Fragment(), FileTransferListener, GattListener {
progress.max = 5
button_cancel.setOnClickListener {
// isCancelled = true
startTransfer()
isCancelled = true
}
button_done.setOnClickListener {
......@@ -78,6 +77,7 @@ class BatchTransferFragment : Fragment(), FileTransferListener, GattListener {
private fun initConnection() {
val ctx = context ?: throw IllegalStateException()
ConnectionService.addGattListener(this)
ConnectionService.connect(ctx)
}
......@@ -115,6 +115,7 @@ class BatchTransferFragment : Fragment(), FileTransferListener, GattListener {
val reader = ChunkedReader(ctx, transferJob.sourceUri, ConnectionService.mtu)
val service = ConnectionService.leService ?: throw IllegalStateException()
transfer = FileTransfer(service, reader,this, transferJob.destPath)
transfer?.start()
} catch (e: Exception) {
Log.e(TAG, "Failed to initialize transfer")
return
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment