-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thumbs-up function 👍 #626
Merged
Merged
Thumbs-up function 👍 #626
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
44b8b10
Implement posting thumbs-up count to firestore
mkeeda b49b8b0
Fix multiple counter to single counter, and adopt realtime updates
mkeeda 4a2de25
Apply some fixes for thumbs up
takahirom 286d6bd
Debugging thumbs-up function of firestore
mkeeda bf57b49
Success to show thumbs-up counts if shards are already exists
mkeeda da8e92f
Remove a white space
mkeeda 075e3b2
Change processing whether shard exists into checking a shard that sha…
mkeeda a4c3287
Bind error to SystemViewModel
mkeeda 6f6b1c0
Apply some thumbs-up button designs
mkeeda 3cf94b8
Add a thumbs-up icon
mkeeda 0b0483b
Fix indent and variable name
mkeeda 0cd8484
Adjust thumbs-up button styles
mkeeda 707fb7b
Show outlined button if thumbs-up count is zero
mkeeda f0db2dd
Fix grradlew.bat
mkeeda 856e3ac
Merge branch 'master' into thumb-up
mkeeda 6ebcbfa
Change number of shards; 10 -> 5
mkeeda e478ca9
Remove unnecessary changes
mkeeda ab883b9
Fix SessionDetailViewModelTest
mkeeda 3bac614
Add test to get thumbs-up count
mkeeda 8e26ef0
Count up at intervals for FireStore charges
takahirom 59aad5a
Apply ktlintFormat
mkeeda 67e699a
Separate incremented count flow from total count flow
mkeeda 6f07494
Display incremented thumbs-up count by own
mkeeda 7d102fd
Pop-up and drop-out animation
mkeeda ea1e3d4
Use resource string placeholder
mkeeda 8c64427
Apply ktlintFormat
mkeeda 54940d7
Pass lintDebug task
mkeeda 035602c
Fix thumbsUpCount test
mkeeda 5f1c524
Bind error of incrementation thumbs-up
mkeeda c88056a
Merge the 2 increment liveDatas
mkeeda f9d5066
Appley ktlintFormat
mkeeda 7e54b27
Fix SessionDetailViewModelTest; separate error
mkeeda bc6dad4
Extract animation functions from SessionDetailTileItem
mkeeda 6d1c674
Suppress useless cast for lintDebug task
mkeeda 5889f99
Merge branch 'master' into thumb-up
takahirom e1cba55
Tweak thumb up animation
takahirom dbe94a2
Merge branch 'thumb-up' of github.com:mkeeda/conference-app-2020 into…
mkeeda e556cac
Use UiModel.error
takahirom 489fb21
Scale animation when users continually press thumbs-up
mkeeda 69c94e9
Apply ktlintFormat
mkeeda 521ba2d
Restore error checking
mkeeda eb5daa5
Minor adjustment ui design
mkeeda 48c71ba
Remove ⭐ and rewrite debug logging messages
mkeeda 3d4c670
LintDebug task can success without type cast
mkeeda 808f2b2
Fix stroke color of blue thumbs-up button
mkeeda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...ponent/androidcomponent/src/main/java/io/github/droidkaigi/confsched2020/ext/Animators.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.github.droidkaigi.confsched2020.ext | ||
|
||
import android.animation.Animator | ||
import android.animation.AnimatorListenerAdapter | ||
import kotlinx.coroutines.suspendCancellableCoroutine | ||
import kotlin.coroutines.resume | ||
|
||
// This function is copied from https://medium.com/androiddevelopers/suspending-over-views-19de9ebd7020 | ||
|
||
suspend fun Animator.awaitEnd() = suspendCancellableCoroutine<Unit> { cont -> | ||
// Add an invokeOnCancellation listener. If the coroutine is | ||
// cancelled, cancel the animation too that will notify | ||
// listener's onAnimationCancel() function | ||
cont.invokeOnCancellation { cancel() } | ||
|
||
addListener(object : AnimatorListenerAdapter() { | ||
private var endedSuccessfully = true | ||
|
||
override fun onAnimationCancel(animation: Animator) { | ||
// Animator has been cancelled, so flip the success flag | ||
endedSuccessfully = false | ||
} | ||
|
||
override fun onAnimationEnd(animation: Animator) { | ||
// Make sure we remove the listener so we don't keep | ||
// leak the coroutine continuation | ||
animation.removeListener(this) | ||
|
||
if (cont.isActive) { | ||
// If the coroutine is still active... | ||
if (endedSuccessfully) { | ||
// ...and the Animator ended successfully, resume the coroutine | ||
cont.resume(Unit) | ||
} else { | ||
// ...and the Animator was cancelled, cancel the coroutine too | ||
cont.cancel() | ||
} | ||
} | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
corecomponent/androidcomponent/src/main/java/io/github/droidkaigi/confsched2020/ext/Views.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.github.droidkaigi.confsched2020.ext | ||
|
||
import android.view.View | ||
import kotlinx.coroutines.suspendCancellableCoroutine | ||
import kotlin.coroutines.resume | ||
|
||
// This function is copied from https://medium.com/androiddevelopers/suspending-over-views-19de9ebd7020 | ||
|
||
suspend fun View.awaitNextLayout() = suspendCancellableCoroutine<Unit> { cont -> | ||
// This lambda is invoked immediately, allowing us to create | ||
// a callback/listener | ||
|
||
val listener = object : View.OnLayoutChangeListener { | ||
override fun onLayoutChange( | ||
v: View?, | ||
left: Int, | ||
top: Int, | ||
right: Int, | ||
bottom: Int, | ||
oldLeft: Int, | ||
oldTop: Int, | ||
oldRight: Int, | ||
oldBottom: Int | ||
) { | ||
// The next layout has happened! | ||
// First remove the listener to not leak the coroutine | ||
v?.removeOnLayoutChangeListener(this) | ||
// Finally resume the continuation, and | ||
// wake the coroutine up | ||
cont.resume(Unit) | ||
} | ||
} | ||
// If the coroutine is cancelled, remove the listener | ||
cont.invokeOnCancellation { removeOnLayoutChangeListener(listener) } | ||
// And finally add the listener to view | ||
addOnLayoutChangeListener(listener) | ||
|
||
// The coroutine will now be suspended. It will only be resumed | ||
// when calling cont.resume() in the listener above | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
<item name="textAppearanceBody1">@style/TextAppearance.DroidKaigi.Body1</item> | ||
<item name="textAppearanceBody2">@style/TextAppearance.DroidKaigi.Body2</item> | ||
<item name="textAppearanceCaption">@style/TextAppearance.DroidKaigi.Caption</item> | ||
<item name="textAppearanceButton">@style/TextAppearance.DroidKaigi.Button</item> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
<!-- Widget styles --> | ||
<item name="filterChipStyle">@style/Widget.DroidKaigi.FilterChip</item> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍