SHARE
TWEET

Untitled

a guest Jun 18th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fun downloadAudio(url:String, fileExternal: File){
  2.         viewState.showLoading()
  3.             Observable.fromCallable {
  4.                 val array=url.split("/")
  5.                 var nameFile=array[array.size-1]
  6.                 nameFile=nameFile.substring(0,nameFile.indexOf("?"))
  7.                 val file= File(fileExternal, nameFile)
  8.                 val link=""
  9.                 Thread.sleep(4000)
  10.                 Pair(link, file)
  11.             }
  12.             .flatMap {
  13.                 Utils.downloadFile(it.first, it.second)
  14.                         .observeOn(AndroidSchedulers.mainThread())
  15.                         .doOnNext{ progress -> }
  16.             }      
  17.             .doOnNext {
  18.                 Log.e("SearchAudioPresenter", "downloadAudio= ASD")
  19.             }
  20.             .subscribeOn(Schedulers.io())
  21.             .observeOn(AndroidSchedulers.mainThread())
  22.             .doFinally { viewState.hideLoading() }
  23.             .subscribe({
  24.                 viewState.loadingSuccess()
  25.             }, Throwable::printStackTrace).isDisposed
  26.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top