Skip to content
Snippets Groups Projects
Commit be9f3535 authored by Anon's avatar Anon
Browse files

BatchTransferFragment: Correctly start transfer.

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