Commit 7b83e4fc authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

fix google sdk 29 nullability issues

parent 19597003
......@@ -148,7 +148,7 @@
</profile-state>
</entry>
</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" />
</component>
<component name="ProjectType">
......
......@@ -65,7 +65,7 @@ class DownloadTourDialogController : Controller {
.inject(this)
}
private val tour:TourModel by lazy {
private val tour:TourModel? by lazy {
args.getParcelable<TourModel>(DOWNLOAD_TOUR_ID_KEY)
}
......@@ -105,41 +105,45 @@ class DownloadTourDialogController : Controller {
downloadToken = DownloadUseCase.CancellationToken(false)
downloadTourTitleText.text = tour.title
Glide.with(view)
.load(tour.previewUrl)
.transform(BlurTransformation(13, 8)
,ColorFilterTransformation(0x99000000.toInt()))
.into(downloaderBg)
disposables.add(
downloader.downloadTour(tour.tour_id, downloadToken)
.onErrorReturn { Timber.e(it);TourPreviewEntity() }
// .onErrorReturn { parseError(it);TourPreviewEntity() }
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe (
{ model ->
updateProgressBar(model.downloadedFiles, model.overallFiles)
if (model.overallFiles == model.downloadedFiles)
activity?.let{
startPlayer(it, fromEntity(model))
handleBack()
}
}
,{error ->
Timber.e(error)
snackbar.showSnackBar(error.localizedMessage)
}
))
cancelDownloadText.setOnClickListener {handleBack() }
// downloadTour(it.tour.tour_id, downloadToken)
// view.findViewById<View>(R.id.close_current_button).setOnClickListener { handleBack() }
tour?.let{ tourModel ->
downloadTourTitleText.text = tourModel.title
Glide.with(view)
.load(tourModel.previewUrl)
.transform(BlurTransformation(13, 8)
,ColorFilterTransformation(0x99000000.toInt()))
.into(downloaderBg)
disposables.add(
downloader.downloadTour(tourModel.tour_id, downloadToken)
.onErrorReturn { Timber.e(it);TourPreviewEntity() }
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe (
{ model ->
updateProgressBar(model.downloadedFiles, model.overallFiles)
if (model.overallFiles == model.downloadedFiles)
activity?.let{
startPlayer(it, fromEntity(model))
handleBack()
}
}
,{error ->
Timber.e(error)
snackbar.showSnackBar(error.localizedMessage)
}
))
cancelDownloadText.setOnClickListener {handleBack() }
}?: ::tourError
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){
......
......@@ -120,8 +120,8 @@ data class UpdateAppModel(
val downloadUrl : String?
) : Parcelable {
constructor(parcel: Parcel) : this(
parcel.readString(),
parcel.readString(),
parcel.readString()?:error("current version not read"),
parcel.readString()?:error("new version not read"),
parcel.readByte() != 0.toByte(),
parcel.readString(),
parcel.readString()) {
......
......@@ -32,17 +32,17 @@ data class TourModel (
) : Parcelable {
constructor(parcel: Parcel) : this(
parcel.readString(),
parcel.readString()?:error("tour id not read"),
parcel.readSerializable() as Date,
parcel.readSerializable() as Date,
TourType.valueOf(parcel.readString()),
parcel.readString(),
TourType.valueOf(parcel.readString()?: error("tour type not read")),
parcel.readString()?: error("tour title not read"),
parcel.readString(),
parcel.readString(),
parcel.readByte() != 0.toByte(),
parcel.readString(),
parcel.readInt(),
DownloadState.valueOf(parcel.readString()),
DownloadState.valueOf(parcel.readString()?:error("tour state not read")),
parcel.readLong(),
parcel.readLong(),
parcel.readInt(),
......
......@@ -64,8 +64,8 @@ data class PhotoResolutionModel(
val resHeight:Int
) : Parcelable {
constructor(parcel: Parcel) : this(
parcel.readString(),
parcel.readString(),
parcel.readString()?:error("resName not read"),
parcel.readString()?:error("photo url not read"),
parcel.readInt(),
parcel.readInt()
)
......
......@@ -18,8 +18,8 @@ data class LoadTourConfig(
constructor(parcel: Parcel) : this(
parcel.readInt(),
parcel.readInt(),
parcel.readString(),
parcel.readString(),
parcel.readString()?:error("cache uri not read"),
parcel.readString()?:error("meta uri not read"),
parcel.readString(),
parcel.readInt()!= 0,
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