Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class GroupHolder(val binding: ItemGroupsInCommonBinding) : RecyclerView.ViewHol
) {
binding.apply {
icon.setGroup(item.groupIconUrl)
name.text = item.groupName
name.setGroupName(item.groupName)
memberCount.text = root.context.resources.getQuantityString(R.plurals.title_participants, item.memberCount, item.memberCount)
root.setOnClickListener { onItemClick(item) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2448,6 +2448,7 @@ class ConversationFragment() :
info.count,
),
)
binding.actionBar.titleTv.setGroupName(info.name)
binding.actionBar.avatarIv.setGroup(info.iconUrl)
inGroup = info.isExist
if (inGroup) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fun LineChart(
.getBoolean(Constants.Account.PREF_QUOTE_COLOR, false)
val isRising = dataPointsData.last() >= dataPointsData.first()
val color = if (isRising != quoteColorPref) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed
val textColor = if (isRising != quoteColorPref) MixinAppTheme.colors.walletGreen else MixinAppTheme.colors.walletRed
val textColor = if (isRising != quoteColorPref) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed
val circleColor = MixinAppTheme.colors.background
val lineWidth = Dp(1.5f)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,9 @@ internal fun MarketRecommendationCard(
if (change == null) {
MixinAppTheme.colors.textAssist
} else if (change >= BigDecimal.ZERO) {
if (quoteColorReversed) MixinAppTheme.colors.walletRed else MixinAppTheme.colors.walletGreen
if (quoteColorReversed) MixinAppTheme.colors.marketRed else MixinAppTheme.colors.marketGreen
} else {
if (quoteColorReversed) MixinAppTheme.colors.walletGreen else MixinAppTheme.colors.walletRed
if (quoteColorReversed) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed
}
Row(
modifier =
Expand Down Expand Up @@ -549,15 +549,15 @@ internal fun MarketChangeColumn(
if (change == null) {
MixinAppTheme.colors.textAssist
} else if (isRising) {
if (quoteColorReversed) MixinAppTheme.colors.walletRed else MixinAppTheme.colors.walletGreen
if (quoteColorReversed) MixinAppTheme.colors.marketRed else MixinAppTheme.colors.marketGreen
} else {
if (quoteColorReversed) MixinAppTheme.colors.walletGreen else MixinAppTheme.colors.walletRed
if (quoteColorReversed) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed
}
val sparklineColor =
if (isRising) {
if (quoteColorReversed) MixinAppTheme.colors.walletRed else MixinAppTheme.colors.walletGreen
if (quoteColorReversed) MixinAppTheme.colors.marketRed else MixinAppTheme.colors.marketGreen
} else {
if (quoteColorReversed) MixinAppTheme.colors.walletGreen else MixinAppTheme.colors.walletRed
if (quoteColorReversed) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed
}
if (sparkline.isNullOrBlank()) {
Box(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,9 @@ private fun IndicatorMetric(
if (change == null) {
MixinAppTheme.colors.textAssist
} else if (change >= BigDecimal.ZERO) {
if (quoteColorReversed) MixinAppTheme.colors.walletRed else MixinAppTheme.colors.walletGreen
if (quoteColorReversed) MixinAppTheme.colors.marketRed else MixinAppTheme.colors.marketGreen
} else {
if (quoteColorReversed) MixinAppTheme.colors.walletGreen else MixinAppTheme.colors.walletRed
if (quoteColorReversed) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed
}
Column(
modifier = modifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,9 @@ private fun searchChangeColor(
when {
change == null -> MixinAppTheme.colors.textAssist
change >= BigDecimal.ZERO ->
if (quoteColorReversed) MixinAppTheme.colors.walletRed else MixinAppTheme.colors.walletGreen
if (quoteColorReversed) MixinAppTheme.colors.marketRed else MixinAppTheme.colors.marketGreen
else ->
if (quoteColorReversed) MixinAppTheme.colors.walletGreen else MixinAppTheme.colors.walletRed
if (quoteColorReversed) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed
}

private const val SEARCH_RESULT_PREVIEW_COUNT = 3
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ fun PerpetualContent(
val walletId = Session.getAccountId()!!
val quoteColorReversed = context.defaultSharedPreferences
.getBoolean(Constants.Account.PREF_QUOTE_COLOR, false)
val risingColor = if (quoteColorReversed) MixinAppTheme.colors.walletRed else MixinAppTheme.colors.walletGreen
val fallingColor = if (quoteColorReversed) MixinAppTheme.colors.walletGreen else MixinAppTheme.colors.walletRed
val risingColor = if (quoteColorReversed) MixinAppTheme.colors.marketRed else MixinAppTheme.colors.marketGreen
val fallingColor = if (quoteColorReversed) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed
val viewModel = hiltViewModel<PerpetualViewModel>()
val lifecycleOwner = LocalLifecycleOwner.current

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ fun PerpsMarketDetailPage(
}
val quoteColorReversed = context.defaultSharedPreferences
.getBoolean(Constants.Account.PREF_QUOTE_COLOR, false)
val risingColor = if (quoteColorReversed) MixinAppTheme.colors.walletRed else MixinAppTheme.colors.walletGreen
val fallingColor = if (quoteColorReversed) MixinAppTheme.colors.walletGreen else MixinAppTheme.colors.walletRed
val risingColor = if (quoteColorReversed) MixinAppTheme.colors.marketRed else MixinAppTheme.colors.marketGreen
val fallingColor = if (quoteColorReversed) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed

LaunchedEffect(marketId) {
viewModel.refreshFavoriteMarkets()
Expand Down Expand Up @@ -1016,8 +1016,8 @@ private fun MarketDetailCard(
val context = LocalContext.current
val quoteColorReversed = context.defaultSharedPreferences
.getBoolean(Constants.Account.PREF_QUOTE_COLOR, false)
val risingColor = if (quoteColorReversed) MixinAppTheme.colors.walletRed else MixinAppTheme.colors.walletGreen
val fallingColor = if (quoteColorReversed) MixinAppTheme.colors.walletGreen else MixinAppTheme.colors.walletRed
val risingColor = if (quoteColorReversed) MixinAppTheme.colors.marketRed else MixinAppTheme.colors.marketGreen
val fallingColor = if (quoteColorReversed) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed

val changePercent = market.changePercent()
val isPositive = changePercent >= BigDecimal.ZERO
Expand Down Expand Up @@ -1249,8 +1249,8 @@ private fun OpenPositionCard(
val context = LocalContext.current
val quoteColorReversed = context.defaultSharedPreferences
.getBoolean(Constants.Account.PREF_QUOTE_COLOR, false)
val risingColor = if (quoteColorReversed) MixinAppTheme.colors.walletRed else MixinAppTheme.colors.walletGreen
val fallingColor = if (quoteColorReversed) MixinAppTheme.colors.walletGreen else MixinAppTheme.colors.walletRed
val risingColor = if (quoteColorReversed) MixinAppTheme.colors.marketRed else MixinAppTheme.colors.marketGreen
val fallingColor = if (quoteColorReversed) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed
val pnl = position.unrealizedPnl?.toBigDecimalOrNull() ?: BigDecimal.ZERO
val roe = (position.roe?.toBigDecimalOrNull() ?: BigDecimal.ZERO).multiply(BigDecimal(100))
val isProfit = pnl >= BigDecimal.ZERO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ fun PerpsMarketItem(
val isPositive = changePercent >= BigDecimal.ZERO
val changeColor = if (isPositive) {
if (quoteColorReversed) {
MixinAppTheme.colors.walletRed
MixinAppTheme.colors.marketRed
} else {
MixinAppTheme.colors.walletGreen
MixinAppTheme.colors.marketGreen
}
} else {
if (quoteColorReversed) {
MixinAppTheme.colors.walletGreen
MixinAppTheme.colors.marketGreen
} else {
MixinAppTheme.colors.walletRed
MixinAppTheme.colors.marketRed
}
}
val changeText = formatPerpsSignedPercent(changePercent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class SearchMessageFragment : BaseFragment(R.layout.fragment_search_message) {
searchMessageItem.userId,
)
} else {
binding.titleView.titleTv.setTextOnly(searchMessageItem.conversationName)
binding.titleView.titleTv.setGroupName(searchMessageItem.conversationName)
binding.titleView.avatarIv.setGroup(searchMessageItem.conversationAvatarUrl)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ChatHolder(val binding: ItemSearchChatBinding) : NormalHolder(binding.root
binding.searchAvatarIv.setInfo(chat.fullName, chat.avatarUrl, chat.userId)
binding.searchName.setName(chat)
} else {
binding.searchName.setTextOnly(chat.groupName)
binding.searchName.setGroupName(chat.groupName)
binding.searchName.highLight(target)
binding.searchAvatarIv.setInfo(chat.groupName, chat.groupIconUrl, chat.conversationId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ fun MarketPerpsAction(
) {
val quoteColorReversed = LocalContext.current.defaultSharedPreferences
.getBoolean(Constants.Account.PREF_QUOTE_COLOR, false)
val longColor = if (quoteColorReversed) MixinAppTheme.colors.walletRed else MixinAppTheme.colors.walletGreen
val shortColor = if (quoteColorReversed) MixinAppTheme.colors.walletGreen else MixinAppTheme.colors.walletRed
val longColor = if (quoteColorReversed) MixinAppTheme.colors.marketRed else MixinAppTheme.colors.marketGreen
val shortColor = if (quoteColorReversed) MixinAppTheme.colors.marketGreen else MixinAppTheme.colors.marketRed
val longBackgroundColor = if (quoteColorReversed) MarketPerpsButtonRedBackground else MarketPerpsButtonGreenBackground
val shortBackgroundColor = if (quoteColorReversed) MarketPerpsButtonGreenBackground else MarketPerpsButtonRedBackground

Expand Down
13 changes: 9 additions & 4 deletions app/src/main/java/one/mixin/android/widget/NameTextView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ class NameTextView : LinearLayoutCompat {
this.textView.setCompoundDrawables(null, null, null, null)
}

fun setGroupName(text: String?) {
setTextOnly(text)
val icon = AppCompatResources.getDrawable(context, R.drawable.ic_group_badge)?.apply {
setBounds(0, 0, badgeSize, badgeSize)
}
textView.setCompoundDrawablesRelative(null, null, icon, null)
}

fun setVerifiedName(text: String, isVerified: Boolean) {
setTextOnly(text)
if (!isVerified) return
Expand Down Expand Up @@ -391,10 +399,7 @@ class NameTextView : LinearLayoutCompat {

fun setName(item: ConversationMinimal) {
if (item.isGroupConversation()) {
this.textView.text = item.groupName
iconView.isVisible = false
iconView.stopAnimation()
this.textView.setCompoundDrawables(null, null, null, null)
setGroupName(item.groupName)
} else {
this.textView.text = item.name
if (item.isProsperity()) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/ic_group_badge.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:width="24dp"
android:height="24dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/layout/item_groups_in_common.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="?attr/bg_white"
Expand All @@ -18,7 +19,7 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"/>

<TextView
<one.mixin.android.widget.NameTextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -28,9 +29,9 @@
android:layout_marginEnd="8dp"
android:layout_marginBottom="2dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:textSize="16sp"
app:textSize="16sp"
android:ellipsize="end"
android:singleLine="true"
app:lines="1"
android:textColor="?attr/text_primary" />

<TextView
Expand Down
Loading