Feat/add simple swap recommended cards#6453
Open
SeniorZhai wants to merge 31 commits into
Open
Conversation
e95f9fa to
ec9ac52
Compare
ec9ac52 to
da189ff
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds “recommended market” cards to the swap (trade) UI and refactors the market details screen layout to use an expandable description with a fade/CTA, plus related API/resource updates.
Changes:
- Introduces Compose UI for swap recommended market cards (Trending/Top Gainers/Top Losers) and wires data-fetching from
TradeFragment. - Updates
MarketDetailsFragmentlayout to a bottom action bar and switches the “about” section toExpandableTextViewwith a collapsed fade effect. - Extends the Route markets endpoint to support a
durationquery parameter and adds tests/robustness improvements around auto-linking.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/test/java/one/mixin/android/widget/linktext/AutoLinkTextViewTest.kt | Adds a Robolectric test for plain text rendering when auto-link modes are absent. |
| app/src/main/res/values/strings.xml | Adds new UI strings for recommended markets and expand CTA. |
| app/src/main/res/values/attrs.xml | Adds ExpandableTextView collapsed-fade attributes. |
| app/src/main/res/values-zh-rTW/strings.xml | Adds zh-TW strings for new market categories. |
| app/src/main/res/values-zh-rCN/strings.xml | Adds zh-CN strings for new market categories. |
| app/src/main/res/layout/fragment_details_market.xml | Refactors layout: bottom action bar + ExpandableTextView about section. |
| app/src/main/res/drawable/ripple_round_8_mask.xml | Adds ripple foreground drawable for the new bottom action item. |
| app/src/main/res/drawable/ic_market_alert_added.xml | Adds “alert added” icon. |
| app/src/main/res/drawable/ic_market_alert_add.xml | Adds “add alert” icon. |
| app/src/main/java/one/mixin/android/widget/linktext/AutoLinkTextView.kt | Avoids NPE by iterating autoLinkModes.orEmpty(). |
| app/src/main/java/one/mixin/android/widget/ExpandableTextView.kt | Adds collapsed fade rendering + CTA handling refinements. |
| app/src/main/java/one/mixin/android/ui/wallet/MarketDetailsFragment.kt | Switches alert/trade actions to the new bottom bar and uses originalText for about content. |
| app/src/main/java/one/mixin/android/ui/home/web3/trade/TradePage.kt | Plumbs recommended market lists/callbacks into SwapContent; adjusts scaffold scrolling. |
| app/src/main/java/one/mixin/android/ui/home/web3/trade/TradeFragment.kt | Fetches recommended markets (trending/gainers/losers) and handles recommended market navigation. |
| app/src/main/java/one/mixin/android/ui/home/web3/trade/SwapViewModel.kt | Injects RouteService and exposes a markets(...) call. |
| app/src/main/java/one/mixin/android/ui/home/web3/trade/SwapRecommendedMarketCards.kt | New composable implementing the recommended market cards UI. |
| app/src/main/java/one/mixin/android/ui/home/web3/trade/SwapContent.kt | Shows recommended cards conditionally and adjusts layout/scrolling. |
| app/src/main/java/one/mixin/android/ui/home/web3/components/TradeLayout.kt | Formatting-only change. |
| app/src/main/java/one/mixin/android/api/service/RouteService.kt | Adds duration query param to GET /markets. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+224
to
+225
| val hasRecommendedCards = topGainerMarkets.isNotEmpty() || topLoserMarkets.isNotEmpty() | ||
| val showRecommendedCards = hasRecommendedCards && inputText.isBlank() && availableHeight == null |
Comment on lines
+325
to
+336
| if (showRecommendedCards) { | ||
| Spacer(modifier = Modifier.height(4.dp)) | ||
| SwapRecommendedMarketCards( | ||
| trendingMarkets = emptyList(), | ||
| topGainerMarkets = topGainerMarkets, | ||
| topLoserMarkets = topLoserMarkets, | ||
| onMarketClick = onRecommendedMarketClick, | ||
| onViewAllClick = onRecommendedMarketViewAllClick, | ||
| modifier = Modifier.padding(horizontal = 20.dp), | ||
| ) | ||
| Spacer(modifier = Modifier.height(14.dp)) | ||
| } |
Comment on lines
+180
to
+184
| <attr name="originalText" format="string" /> | ||
| <attr name="expandAction" format="string" /> | ||
| <attr name="expandActionColor" format="string" /> | ||
| <attr name="collapsedFadeEnabled" format="boolean" /> | ||
| <attr name="collapsedFadeColor" format="color|reference" /> |
Comment on lines
2513
to
2516
| <string name="perps_top_movers">涨跌榜</string> | ||
| <string name="top_gainers">涨幅榜</string> | ||
| <string name="top_losers">跌幅榜</string> | ||
| </resources> |
Comment on lines
1107
to
1110
| <string name="perps_top_movers">漲跌榜</string> | ||
| <string name="top_gainers">漲幅榜</string> | ||
| <string name="top_losers">跌幅榜</string> | ||
| </resources> |
Comment on lines
+113
to
+118
| private data class RecommendedMarketCardData( | ||
| val titleRes: Int, | ||
| val type: SwapRecommendedMarketType, | ||
| val showViewAll: Boolean = false, | ||
| val items: List<RecommendedMarketUiItem>, | ||
| ) |
…p-recommended-cards # Conflicts: # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values-zh-rTW/strings.xml # app/src/main/res/values/strings.xml
Prefetch market assets, reset Swap scroll after market details, and route Stocks view-all to the stock token list.
…-simple-swap-recommended-cards
Scroll the swap page to top only after a Trade selection returns from market details, and update the wallet home swap action handling.
…-simple-swap-recommended-cards
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.