-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(android.StopDetails): Shimmer loading #634
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3752704
refactor(LoadingRouteCard): reusable LoadignShimmer modifier
KaylaBrady 21eff0e
feat(android.StopDetailsView): shimmer loading
KaylaBrady bc1de5a
test(StopDetailsRoutesView): loading state
KaylaBrady a45e964
feat(ios.LoadingPlaceholder): Accessibility label loading
KaylaBrady dd7e915
refactor(android.StopDetails): pull out loading view
KaylaBrady 2e22620
Merge branch 'main' into kb-shimmer-load-2
KaylaBrady 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
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
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
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.mbta.tid.mbta_app.android.util | ||
|
||
import android.app.Activity | ||
import androidx.compose.runtime.compositionLocalOf | ||
import androidx.compose.runtime.staticCompositionLocalOf | ||
import com.google.android.gms.location.FusedLocationProviderClient | ||
|
||
|
@@ -11,3 +12,9 @@ val LocalLocationClient = | |
staticCompositionLocalOf<FusedLocationProviderClient> { | ||
throw IllegalStateException("no location client") | ||
} | ||
|
||
/** | ||
* Whether the sheet contents are loading. Used by low-level child views to determine whether they | ||
* should be styled as placeholders by `Modifier.placeholderIfLoading()` | ||
*/ | ||
val IsLoadingSheetContents = compositionLocalOf { false } | ||
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. Cool! |
4 changes: 2 additions & 2 deletions
4
...ndroid/util/LoadingPlaceholderModifier.kt → ...roid/util/modifiers/LoadingPlaceholder.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
15 changes: 15 additions & 0 deletions
15
androidApp/src/main/java/com/mbta/tid/mbta_app/android/util/modifiers/LoadingShimmer.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,15 @@ | ||
package com.mbta.tid.mbta_app.android.util.modifiers | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.semantics.clearAndSetSemantics | ||
import androidx.compose.ui.semantics.contentDescription | ||
import com.mbta.tid.mbta_app.android.R | ||
import com.valentinilk.shimmer.shimmer | ||
|
||
@Composable | ||
fun Modifier.loadingShimmer(): Modifier { | ||
val contentDesc = stringResource(R.string.loading) | ||
return this then Modifier.shimmer().clearAndSetSemantics { contentDescription = contentDesc } | ||
} |
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 |
---|---|---|
|
@@ -63,10 +63,10 @@ | |
<string name="other_link_source_code">Ver código fuente en GitHub</string> | ||
<string name="other_link_tos">Términos de uso</string> | ||
<string name="outbound">Saliente</string> | ||
<string name="recently_viewed">Visto recientemente</string> | ||
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. alphabetized in conflict resolution |
||
<string name="refresh">Refrescar</string> | ||
<string name="refresh_predictions">Refrescar predicciones</string> | ||
<string name="reload_data">Recargar datos</string> | ||
<string name="recently_viewed">Visto recientemente</string> | ||
<string name="resources_link_fare_info">Información de tarifas</string> | ||
<string name="resources_link_mticket">Boletos de tren de cercanías y ferri</string> | ||
<string name="resources_link_mticket_note">mTicket App</string> | ||
|
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.
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.
I think we could simplify this code by making the variables we need to change conditional on their own booleans, and having a single non-nested
if
statement. E.g.I find nested
if
statements tough to parse, personally.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.
Point taken on readability! of neseted ifs! I opted to break out a distinct LoadingStopDetailsView in dd7e915 for consistency with LoadingRouteCard which also removes the nesting.