Skip to content

Feat/add simple swap recommended cards#6453

Open
SeniorZhai wants to merge 31 commits into
masterfrom
feat/add-simple-swap-recommended-cards
Open

Feat/add simple swap recommended cards#6453
SeniorZhai wants to merge 31 commits into
masterfrom
feat/add-simple-swap-recommended-cards

Conversation

@SeniorZhai

Copy link
Copy Markdown
Member

No description provided.

@SeniorZhai SeniorZhai force-pushed the feat/add-simple-swap-recommended-cards branch from e95f9fa to ec9ac52 Compare June 12, 2026 04:42
@SeniorZhai SeniorZhai force-pushed the feat/add-simple-swap-recommended-cards branch from ec9ac52 to da189ff Compare June 15, 2026 07:10
@SeniorZhai SeniorZhai marked this pull request as ready for review June 16, 2026 04:18
@SeniorZhai SeniorZhai requested a review from Copilot June 16, 2026 04:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MarketDetailsFragment layout to a bottom action bar and switches the “about” section to ExpandableTextView with a collapsed fade effect.
  • Extends the Route markets endpoint to support a duration query 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 thread app/src/main/res/values/attrs.xml Outdated
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>,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants