Commit 8c633ce9 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

Merge branch 'bugfix/sdk29_nullable_safe'

parents 897ab913 7b83e4fc
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
</profile-state> </profile-state>
</entry> </entry>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -65,7 +65,7 @@ class DownloadTourDialogController : Controller { ...@@ -65,7 +65,7 @@ class DownloadTourDialogController : Controller {
.inject(this) .inject(this)
} }
private val tour:TourModel by lazy { private val tour:TourModel? by lazy {
args.getParcelable<TourModel>(DOWNLOAD_TOUR_ID_KEY) args.getParcelable<TourModel>(DOWNLOAD_TOUR_ID_KEY)
} }
...@@ -105,41 +105,45 @@ class DownloadTourDialogController : Controller { ...@@ -105,41 +105,45 @@ class DownloadTourDialogController : Controller {
downloadToken = DownloadUseCase.CancellationToken(false) downloadToken = DownloadUseCase.CancellationToken(false)
downloadTourTitleText.text = tour.title tour?.let{ tourModel ->
Glide.with(view) downloadTourTitleText.text = tourModel.title
.load(tour.previewUrl) Glide.with(view)
.transform(BlurTransformation(13, 8) .load(tourModel.previewUrl)
,ColorFilterTransformation(0x99000000.toInt())) .transform(BlurTransformation(13, 8)
.into(downloaderBg) ,ColorFilterTransformation(0x99000000.toInt()))
.into(downloaderBg)
disposables.add(
downloader.downloadTour(tour.tour_id, downloadToken) disposables.add(
.onErrorReturn { Timber.e(it);TourPreviewEntity() } downloader.downloadTour(tourModel.tour_id, downloadToken)
// .onErrorReturn { parseError(it);TourPreviewEntity() } .onErrorReturn { Timber.e(it);TourPreviewEntity() }
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe ( .subscribe (
{ model -> { model ->
updateProgressBar(model.downloadedFiles, model.overallFiles) updateProgressBar(model.downloadedFiles, model.overallFiles)
if (model.overallFiles == model.downloadedFiles) if (model.overallFiles == model.downloadedFiles)
activity?.let{ activity?.let{
startPlayer(it, fromEntity(model)) startPlayer(it, fromEntity(model))
handleBack() handleBack()
} }
} }
,{error -> ,{error ->
Timber.e(error) Timber.e(error)
snackbar.showSnackBar(error.localizedMessage) snackbar.showSnackBar(error.localizedMessage)
} }
)) ))
cancelDownloadText.setOnClickListener {handleBack() } cancelDownloadText.setOnClickListener {handleBack() }
// downloadTour(it.tour.tour_id, downloadToken) }?: ::tourError
// view.findViewById<View>(R.id.close_current_button).setOnClickListener { handleBack() }
return view return view
} }
private fun tourError(){
Timber.e("Tour not been initialized by key: $DOWNLOAD_TOUR_ID_KEY")
snackbar.showSnackBar("Ошибка! Данные тура не найдены.")
handleBack()
}
private fun updateProgressBar(curr:Int, max:Int){ private fun updateProgressBar(curr:Int, max:Int){
......
...@@ -120,8 +120,8 @@ data class UpdateAppModel( ...@@ -120,8 +120,8 @@ data class UpdateAppModel(
val downloadUrl : String? val downloadUrl : String?
) : Parcelable { ) : Parcelable {
constructor(parcel: Parcel) : this( constructor(parcel: Parcel) : this(
parcel.readString(), parcel.readString()?:error("current version not read"),
parcel.readString(), parcel.readString()?:error("new version not read"),
parcel.readByte() != 0.toByte(), parcel.readByte() != 0.toByte(),
parcel.readString(), parcel.readString(),
parcel.readString()) { parcel.readString()) {
......
...@@ -32,17 +32,17 @@ data class TourModel ( ...@@ -32,17 +32,17 @@ data class TourModel (
) : Parcelable { ) : Parcelable {
constructor(parcel: Parcel) : this( constructor(parcel: Parcel) : this(
parcel.readString(), parcel.readString()?:error("tour id not read"),
parcel.readSerializable() as Date, parcel.readSerializable() as Date,
parcel.readSerializable() as Date, parcel.readSerializable() as Date,
TourType.valueOf(parcel.readString()), TourType.valueOf(parcel.readString()?: error("tour type not read")),
parcel.readString(), parcel.readString()?: error("tour title not read"),
parcel.readString(), parcel.readString(),
parcel.readString(), parcel.readString(),
parcel.readByte() != 0.toByte(), parcel.readByte() != 0.toByte(),
parcel.readString(), parcel.readString(),
parcel.readInt(), parcel.readInt(),
DownloadState.valueOf(parcel.readString()), DownloadState.valueOf(parcel.readString()?:error("tour state not read")),
parcel.readLong(), parcel.readLong(),
parcel.readLong(), parcel.readLong(),
parcel.readInt(), parcel.readInt(),
......
...@@ -64,8 +64,8 @@ data class PhotoResolutionModel( ...@@ -64,8 +64,8 @@ data class PhotoResolutionModel(
val resHeight:Int val resHeight:Int
) : Parcelable { ) : Parcelable {
constructor(parcel: Parcel) : this( constructor(parcel: Parcel) : this(
parcel.readString(), parcel.readString()?:error("resName not read"),
parcel.readString(), parcel.readString()?:error("photo url not read"),
parcel.readInt(), parcel.readInt(),
parcel.readInt() parcel.readInt()
) )
......
...@@ -18,8 +18,8 @@ data class LoadTourConfig( ...@@ -18,8 +18,8 @@ data class LoadTourConfig(
constructor(parcel: Parcel) : this( constructor(parcel: Parcel) : this(
parcel.readInt(), parcel.readInt(),
parcel.readInt(), parcel.readInt(),
parcel.readString(), parcel.readString()?:error("cache uri not read"),
parcel.readString(), parcel.readString()?:error("meta uri not read"),
parcel.readString(), parcel.readString(),
parcel.readInt()!= 0, parcel.readInt()!= 0,
parcel.readInt() == 1 parcel.readInt() == 1
......
Markdown is supported
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