diff --git a/app/src/main/java/de/ph1b/audiobook/features/bookOverview/BookOverviewController.kt b/app/src/main/java/de/ph1b/audiobook/features/bookOverview/BookOverviewController.kt index bbac2a1e78..b4d1d7b00a 100644 --- a/app/src/main/java/de/ph1b/audiobook/features/bookOverview/BookOverviewController.kt +++ b/app/src/main/java/de/ph1b/audiobook/features/bookOverview/BookOverviewController.kt @@ -68,9 +68,8 @@ class BookOverviewController : BaseController(), private var playPauseDrawableSetter: PlayPauseDrawableSetter by clearAfterDestroyView() private var adapter: BookOverviewAdapter by clearAfterDestroyView() private var currentTapTarget by clearAfterDestroyViewNullable() - private var menuBook: Book? = null + private var menuBookId: UUID? = null private var useGrid = false - // private var columnCount = 1 override fun onViewCreated() { val gridMenuItem = setupToolbar() @@ -162,12 +161,12 @@ class BookOverviewController : BaseController(), COVER_FROM_GALLERY -> { if (resultCode == Activity.RESULT_OK) { val imageUri = data?.data - val book = menuBook - if (imageUri == null || book == null) { + val bookId = menuBookId + if (imageUri == null || bookId == null) { return } - EditCoverDialogController(this, book, imageUri).showDialog(router) + EditCoverDialogController(this, bookId, imageUri).showDialog(router) } } else -> super.onActivityResult(requestCode, resultCode, data) @@ -270,7 +269,7 @@ class BookOverviewController : BaseController(), } override fun onFileCoverRequested(book: Book) { - menuBook = book + menuBookId = book.id val galleryPickerIntent = Intent(Intent.ACTION_PICK) galleryPickerIntent.type = "image/*" startActivityForResult(galleryPickerIntent, COVER_FROM_GALLERY) diff --git a/app/src/main/java/de/ph1b/audiobook/features/bookOverview/EditCoverDialogController.kt b/app/src/main/java/de/ph1b/audiobook/features/bookOverview/EditCoverDialogController.kt index 483e74d2e3..b7dd1bdfa0 100644 --- a/app/src/main/java/de/ph1b/audiobook/features/bookOverview/EditCoverDialogController.kt +++ b/app/src/main/java/de/ph1b/audiobook/features/bookOverview/EditCoverDialogController.kt @@ -12,7 +12,6 @@ import com.afollestad.materialdialogs.MaterialDialog import com.bluelinelabs.conductor.Controller import com.squareup.picasso.Picasso import de.ph1b.audiobook.R -import de.ph1b.audiobook.data.Book import de.ph1b.audiobook.data.repo.BookRepository import de.ph1b.audiobook.injection.appComponent import de.ph1b.audiobook.misc.DialogController @@ -122,12 +121,12 @@ class EditCoverDialogController(args: Bundle) : DialogController(args) { operator fun invoke( target: T, - book: Book, + bookId: UUID, uri: Uri ): EditCoverDialogController where T : Controller, T : Callback { val args = Bundle().apply { putString(NI_COVER_URI, uri.toString()) - putUUID(NI_BOOK_ID, book.id) + putUUID(NI_BOOK_ID, bookId) } return EditCoverDialogController(args).apply { targetController = target