Skip to content

Commit 54f6ff9

Browse files
Merge branch 'master' into feature/DRA-141
2 parents d086fb0 + 666b472 commit 54f6ff9

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

app/src/main/java/eu/theappfactory/dailyrecipes/data/userEvent/FirestoreUserEventDataSource.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class FirestoreUserEventDataSource @Inject constructor(
257257

258258
override suspend fun updateUser(user: UserResponse) =
259259
suspendCancellableCoroutine<Result<UpdateUserStatus>> { continuation ->
260-
val result = checkIfUsernameExists(user.username)
260+
val result = checkIfUsernameExists(user.username, user.id)
261261

262262
when (result) {
263263
is Result.Success -> {
@@ -316,7 +316,7 @@ class FirestoreUserEventDataSource @Inject constructor(
316316
}
317317
}
318318

319-
private fun checkIfUsernameExists(username: String): Result<UpdateUserStatus> {
319+
private fun checkIfUsernameExists(username: String, id: String): Result<UpdateUserStatus> {
320320
val users = ArrayList<UserResponse>()
321321
val itemSnapshot = firestore.collection(USERS_COLLECTION).get()
322322

@@ -346,7 +346,7 @@ class FirestoreUserEventDataSource @Inject constructor(
346346
it.username.equals(username, ignoreCase = true)
347347
}
348348

349-
if (count == 0) {
349+
if (count == 0 || users.find { it.username == username }?.id == id) {
350350
return Result.Success(UpdateUserStatus.UPDATE_OK)
351351
} else {
352352
return Result.Error(Exception("username is taken."))

app/src/main/java/eu/theappfactory/dailyrecipes/ui/home/pager/ItemHolder.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,9 @@ class ItemHolder(
427427
binding.videoView.hideController()
428428
if (item.showThumbnail && item.imageUri.isNotEmpty()) {
429429
binding.loadingFrame.postDelayed({
430-
binding.videoView.player?.playWhenReady = true
430+
if (itemView.isAttachedToWindow) {
431+
binding.videoView.player?.playWhenReady = true
432+
}
431433
}, PAN_ANIMATION_DURATION)
432434
} else {
433435
binding.videoView.player?.playWhenReady = true

app/src/main/res/layout/list_item_items.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
android:layout_width="match_parent"
1414
android:layout_height="match_parent"
1515
android:layout_gravity="center"
16+
app:keep_content_on_player_reset="true"
1617
app:use_controller="false" />
1718

1819
<ImageView

0 commit comments

Comments
 (0)