Skip to content

Commit 1a36a33

Browse files
committed
feat: Add possibility to copy Brawlhalla ID on stat page
1 parent 5f732f9 commit 1a36a33

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

app/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ android {
2020
applicationId = "com.nickoehler.brawlhalla"
2121
minSdk = 26
2222
targetSdk = 35
23-
versionCode = 2
24-
versionName = "0.0.2"
23+
versionCode = 3
24+
versionName = "0.0.3"
2525
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2626
}
2727

app/src/main/java/com/nickoehler/brawlhalla/clans/presentation/screens/ClanDetailScreen.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,10 @@ fun ClanDetailScreen(
160160
) {
161161
Icon(
162162
Icons.Default.Favorite,
163-
null,
164-
tint = if (state.isClanDetailFavorite) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground
163+
stringResource(R.string.favorites),
164+
tint = if (state.isClanDetailFavorite)
165+
MaterialTheme.colorScheme.primary else
166+
MaterialTheme.colorScheme.onBackground
165167
)
166168
}
167169
}

app/src/main/java/com/nickoehler/brawlhalla/ranking/presentation/screens/StatDetailScreen.kt

+19-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import androidx.compose.material.icons.Icons
2121
import androidx.compose.material.icons.automirrored.filled.ArrowBack
2222
import androidx.compose.material.icons.automirrored.filled.Sort
2323
import androidx.compose.material.icons.filled.Favorite
24+
import androidx.compose.material.icons.filled.Pin
2425
import androidx.compose.material.icons.filled.Poll
2526
import androidx.compose.material.icons.filled.QueryStats
2627
import androidx.compose.material3.DropdownMenuItem
@@ -46,9 +47,11 @@ import androidx.compose.ui.Alignment
4647
import androidx.compose.ui.Modifier
4748
import androidx.compose.ui.draw.clip
4849
import androidx.compose.ui.layout.onGloballyPositioned
50+
import androidx.compose.ui.platform.LocalClipboardManager
4951
import androidx.compose.ui.platform.LocalContext
5052
import androidx.compose.ui.platform.LocalDensity
5153
import androidx.compose.ui.res.stringResource
54+
import androidx.compose.ui.text.AnnotatedString
5255
import androidx.compose.ui.text.font.FontWeight
5356
import androidx.compose.ui.text.style.TextAlign
5457
import androidx.compose.ui.tooling.preview.Preview
@@ -114,6 +117,7 @@ fun StatDetailScreen(
114117
) {
115118
val density = LocalDensity.current
116119
val context = LocalContext.current
120+
val clipboard = LocalClipboardManager.current
117121
val playerStat = state.selectedStatDetail
118122
val playerRanking = state.selectedRankingDetail
119123
var screenWidth by remember { mutableStateOf(0.dp) }
@@ -203,6 +207,20 @@ fun StatDetailScreen(
203207
}
204208
},
205209
actions = {
210+
IconButton({
211+
if (playerStat != null) {
212+
clipboard.setText(
213+
AnnotatedString(
214+
state.selectedStatDetail.brawlhallaId.toString()
215+
)
216+
)
217+
}
218+
}) {
219+
Icon(
220+
Icons.Default.Pin,
221+
stringResource(R.string.copy_id),
222+
)
223+
}
206224
IconButton({
207225
if (playerStat != null) {
208226
onStatDetailAction(
@@ -215,15 +233,14 @@ fun StatDetailScreen(
215233
}) {
216234
Icon(
217235
Icons.Default.Favorite,
218-
null,
236+
stringResource(R.string.favorites),
219237
tint = if (state.isStatDetailFavorite) {
220238
MaterialTheme.colorScheme.primary
221239
} else {
222240
MaterialTheme.colorScheme.onBackground
223241
},
224242
)
225243
}
226-
227244
},
228245
title = {
229246
Row(
@@ -249,8 +266,6 @@ fun StatDetailScreen(
249266
)
250267
}
251268
}
252-
253-
254269
}
255270
)
256271
}

app/src/main/res/values-it/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,6 @@
8989
<string name="joinDate">Data di iscrizione</string>
9090
<string name="xp">Xp</string>
9191
<string name="createDate">Data di creazione: %s</string>
92+
<string name="copy_id">Copia ID</string>
9293
</resources>
9394

app/src/main/res/values/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,5 @@
8989
<string name="joinDate">Join Date</string>
9090
<string name="xp">Xp</string>
9191
<string name="createDate">Create Date: %s</string>
92+
<string name="copy_id">Copy ID</string>
9293
</resources>

0 commit comments

Comments
 (0)