Skip to content

Commit

Permalink
Merge pull request #277 from lihenggui/mercury
Browse files Browse the repository at this point in the history
Show more icon in the rule details by default
  • Loading branch information
lihenggui authored Aug 25, 2023
2 parents fee328c + ee31b3b commit 9c13f6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ fun RuleDetailContent(
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
toolbarState.scrollTopLimitReached =
listState.firstVisibleItemIndex == 0 && listState.firstVisibleItemScrollOffset == 0
toolbarState.scrollOffset = toolbarState.scrollOffset - available.y
toolbarState.scrollOffset -= available.y
return Offset(0f, toolbarState.consumed)
}

Expand All @@ -244,8 +244,7 @@ fun RuleDetailContent(
) { value, _ ->
toolbarState.scrollTopLimitReached =
listState.firstVisibleItemIndex == 0 && listState.firstVisibleItemScrollOffset == 0
toolbarState.scrollOffset =
toolbarState.scrollOffset - (value - (toolbarState.height + toolbarState.offset))
toolbarState.scrollOffset -= (value - (toolbarState.height + toolbarState.offset))
if (toolbarState.scrollOffset == 0f) scope.coroutineContext.cancelChildren()
}
}
Expand All @@ -254,7 +253,12 @@ fun RuleDetailContent(
}
}
}
updateIconBasedThemingState(IconBasedThemingState(icon = ruleInfoUiState.ruleIcon, isBasedIcon = true))
updateIconBasedThemingState(
IconBasedThemingState(
icon = ruleInfoUiState.ruleIcon,
isBasedIcon = true,
),
)
Scaffold(
topBar = {
BlockerCollapsingTopAppBar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class RuleDetailViewModel @Inject constructor(
),
)
val tabState: StateFlow<TabState<RuleDetailTabs>> = _tabState.asStateFlow()
private val _appBarUiState = MutableStateFlow(AppBarUiState())
private val _appBarUiState = MutableStateFlow(AppBarUiState(actions = getAppBarAction()))
val appBarUiState: StateFlow<AppBarUiState> = _appBarUiState.asStateFlow()
private var currentSearchKeyword: List<String> = emptyList()

Expand Down Expand Up @@ -154,7 +154,10 @@ class RuleDetailViewModel @Inject constructor(
.first()
val ruleWithIcon = rule.copy(iconUrl = baseUrl + rule.iconUrl)
_ruleInfoUiState.update {
RuleInfoUiState.Success(ruleInfo = ruleWithIcon, ruleIcon = getRuleIcon(baseUrl + rule.iconUrl, context = context))
RuleInfoUiState.Success(
ruleInfo = ruleWithIcon,
ruleIcon = getRuleIcon(baseUrl + rule.iconUrl, context = context),
)
}
currentSearchKeyword = rule.searchKeyword
loadMatchedApps(rule.searchKeyword)
Expand Down

0 comments on commit 9c13f6a

Please sign in to comment.