diff --git a/android/src/main/java/de/x4fyr/paiman/PaintingDetailActivity.kt b/android/src/main/java/de/x4fyr/paiman/PaintingDetailActivity.kt index 8bd008c..6fedbdb 100644 --- a/android/src/main/java/de/x4fyr/paiman/PaintingDetailActivity.kt +++ b/android/src/main/java/de/x4fyr/paiman/PaintingDetailActivity.kt @@ -118,7 +118,8 @@ class PaintingDetailActivity: BaseActivity(), HasActivityInjector, HasSupportFra launch(UI) { if (model.finished) { visibility = View.VISIBLE - updateDate(model.finishingDate!!.year, model.finishingDate!!.monthValue, + updateDate(model.finishingDate!!.year, model.finishingDate!!.monthValue-1, //datePicker + // behaves strange, and increases the visible moth by 1 model.finishingDate!!.dayOfMonth) } else { @@ -140,7 +141,8 @@ class PaintingDetailActivity: BaseActivity(), HasActivityInjector, HasSupportFra launch(UI) { val newTitle = titleEditView.text.toString() val isFinished = finishedToggle.isChecked - val finishedDate = LocalDate.of(datePicker.year, datePicker.month, datePicker.dayOfMonth) + val finishedDate = LocalDate.of(datePicker.year, datePicker.month+1, datePicker.dayOfMonth) + //datePicker behaves strangely and decreases the picked month by 1 val successTitle: Deferred val successImage: Deferred val successFinished: Deferred @@ -270,7 +272,8 @@ class PaintingDetailActivity: BaseActivity(), HasActivityInjector, HasSupportFra setPositiveButton(R.string.sell_painting_apply) { dialog, _ -> val purchaser = purchaserInput.text.toString().trim() val price = priceInput.text.toString().toDouble() - val date = LocalDate.of(datePicker.year, datePicker.month, datePicker.dayOfMonth) + val date = LocalDate.of(datePicker.year, datePicker.month+1, datePicker.dayOfMonth) + //datePicker behaves strangely and decreases the picked month by 1 launch(CommonPool) { paintingService.sellPainting(model.painting, Purchaser(name = purchaser), date, price) } diff --git a/android/src/main/java/de/x4fyr/paiman/lib/adapter/AndroidGoogleDriveStorageAdapter.kt b/android/src/main/java/de/x4fyr/paiman/lib/adapter/AndroidGoogleDriveStorageAdapter.kt index 4607f43..294e7a3 100644 --- a/android/src/main/java/de/x4fyr/paiman/lib/adapter/AndroidGoogleDriveStorageAdapter.kt +++ b/android/src/main/java/de/x4fyr/paiman/lib/adapter/AndroidGoogleDriveStorageAdapter.kt @@ -20,6 +20,7 @@ import kotlinx.coroutines.experimental.async import java.io.ByteArrayOutputStream import java.io.InputStream import java.util.UUID +import java.util.concurrent.TimeUnit import java.util.concurrent.locks.ReentrantReadWriteLock import kotlin.concurrent.withLock import kotlin.properties.Delegates @@ -120,7 +121,7 @@ class AndroidGoogleDriveStorageAdapter(private val context: Context): GoogleDriv Log.d("${this::class.simpleName}::getImage", "Start attempt $i to get image.") val queryResult = appFolder.queryChildren(googleApiClient, Query.Builder() .addFilter(Filters.eq(SearchableField.TITLE, "$id.png")) - .build()).await() + .build()).await(5, TimeUnit.SECONDS) val metadataBuffer: MetadataBuffer Log.d("${this::class.simpleName}::getImage", "Got queryResult") if (queryResult.status.isSuccess) { @@ -136,7 +137,7 @@ class AndroidGoogleDriveStorageAdapter(private val context: Context): GoogleDriv metadataBuffer.release() var fileResult: DriveApi.DriveContentsResult fileResult = fid.asDriveFile().open(googleApiClient, DriveFile.MODE_READ_ONLY, - { _, _ -> }).await() + { _, _ -> }).await(5, TimeUnit.SECONDS) Log.d("${this::class.simpleName}::getImage", "Got fileResult") val fd: ParcelFileDescriptor if (fileResult.status.isSuccess) {