Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Commit

Permalink
Finished date is always a month back - Fixes #27
Browse files Browse the repository at this point in the history
  • Loading branch information
bvolkmer committed Oct 16, 2017
1 parent 5c80e0a commit 5b32ddd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<Boolean>
val successImage: Deferred<Boolean>
val successFinished: Deferred<Boolean>
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 5b32ddd

Please sign in to comment.