Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val progresRing = ProgressDialog(this@AddExtraPicturesActivity)
- progresRing.isIndeterminate = true
- progresRing.setTitle("Uploading pictures")
- progresRing.setMessage("Please wait")
- progresRing.setCancelable(false)
- progresRing.show()
- for (item in pictureList) {
- if(item.pictureFile != null) {
- val file = item.pictureFile
- if(file!!.exists()) {
- var fileData = Base64.encodeToString(FileUtils.readFileToString(file).toByteArray(), Base64.DEFAULT)
- val transactionId = UUID.randomUUID().toString()
- val tokenId = ""
- val jobDocument = JobDocument("Test", "", "", "PHONE_PICTURE", "jpg", "test.jpg", "", fileData)
- val requestBody = UploadDocumentRequest("Test", jobDocument)
- val service = RestAPI(this@AddExtraPicturesActivity)
- val request = service.uploadDocument(authorization, transactionId, tokenId, requestBody)
- request.enqueue(object : Callback<UploadDocumentResponse> {
- override fun onResponse(call: Call<UploadDocumentResponse>, response: Response<UploadDocumentResponse>) {
- Timber.d( response.toString())
- }
- override fun onFailure(call: Call<UploadDocumentResponse>, t: Throwable) {
- Timber.d(t.toString())
- }
- })
- }
- }
- }
- progresRing.dismiss()
Add Comment
Please, Sign In to add comment