Skip to content

Commit 10d1335

Browse files
authored
Merge pull request #563 from UseHover/development
v1.12.16
2 parents 91cc85c + 646dc38 commit 10d1335

File tree

2 files changed

+59
-40
lines changed

2 files changed

+59
-40
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ android {
4545
applicationId "com.hover.stax"
4646
minSdk 21
4747
targetSdk 32
48-
versionCode 173
49-
versionName "1.12.15"
48+
versionCode 174
49+
versionName "1.12.16"
5050

5151
vectorDrawables.useSupportLibrary = true
5252
multiDexEnabled true

app/src/main/java/com/hover/stax/presentation/home/HomeScreen.kt

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -186,52 +186,69 @@ fun PrimaryFeatures(
186186
@Composable
187187
private fun FinancialTipCard(
188188
tipInterface: FinancialTipClickInterface?,
189-
financialTip: FinancialTip
189+
financialTip: FinancialTip,
190+
homeViewModel: HomeViewModel?
190191
) {
191192
val size13 = dimensionResource(id = R.dimen.margin_13)
192-
Card(elevation = 0.dp, modifier = Modifier.padding(all = size13)) {
193-
Row(modifier = Modifier
194-
.padding(all = size13)
195-
.clickable { tipInterface?.onTipClicked(null) }) {
196193

197-
Column(modifier = Modifier.weight(1f)) {
194+
Card(elevation = 0.dp, modifier = Modifier.padding(all = size13)) {
195+
Column {
196+
Row(modifier = Modifier
197+
.fillMaxWidth()
198+
.padding(all = size13)) {
198199
HorizontalImageTextView(
199200
drawable = R.drawable.ic_tip_of_day,
200201
stringRes = R.string.tip_of_the_day,
201-
Modifier.padding(bottom = 5.dp),
202+
Modifier.weight(1f),
202203
MaterialTheme.typography.button
203204
)
204205

205-
Spacer(modifier = Modifier.height(10.dp))
206-
207-
Text(
208-
text = financialTip.title,
209-
style = MaterialTheme.typography.body2,
210-
textDecoration = TextDecoration.Underline
211-
)
206+
Image(painter = painterResource(id = R.drawable.ic_close_white),
207+
contentDescription = null,
208+
alignment = Alignment.CenterEnd,
209+
modifier = Modifier.clickable { homeViewModel?.dismissTip(financialTip.id) })
210+
}
212211

213-
Spacer(modifier = Modifier.height(8.dp))
212+
Row(modifier = Modifier
213+
.padding(horizontal = size13)
214+
.clickable { tipInterface?.onTipClicked(null) }) {
215+
216+
Column(modifier = Modifier.weight(1f)) {
217+
Spacer(modifier = Modifier.height(10.dp))
218+
219+
Text(
220+
text = financialTip.title,
221+
style = MaterialTheme.typography.body2,
222+
textDecoration = TextDecoration.Underline
223+
)
224+
225+
Spacer(modifier = Modifier.height(8.dp))
226+
227+
Text(
228+
text = financialTip.snippet,
229+
style = MaterialTheme.typography.body2,
230+
maxLines = 2,
231+
overflow = TextOverflow.Ellipsis,
232+
modifier = Modifier.padding(bottom = size13, top = 3.dp)
233+
)
234+
235+
Text(text = stringResource(id = R.string.read_more),
236+
color = colorResource(id = R.color.brightBlue),
237+
modifier = Modifier
238+
.padding(bottom = size13)
239+
.clickable { tipInterface?.onTipClicked(financialTip.id) }
240+
)
241+
}
214242

215-
Text(
216-
text = financialTip.snippet,
217-
style = MaterialTheme.typography.body2,
218-
maxLines = 2,
219-
overflow = TextOverflow.Ellipsis,
220-
modifier = Modifier.padding(bottom = size13, top = 3.dp)
243+
Image(
244+
painter = painterResource(id = R.drawable.tips_fancy_icon),
245+
contentDescription = null,
246+
modifier = Modifier
247+
.size(60.dp)
248+
.padding(start = size13)
249+
.align(Alignment.CenterVertically),
221250
)
222-
Text(text = stringResource(id = R.string.read_more),
223-
color = colorResource(id = R.color.brightBlue),
224-
modifier = Modifier.clickable { tipInterface?.onTipClicked(financialTip.id) })
225251
}
226-
227-
Image(
228-
painter = painterResource(id = R.drawable.tips_fancy_icon),
229-
contentDescription = null,
230-
modifier = Modifier
231-
.size(60.dp)
232-
.padding(start = size13)
233-
.align(Alignment.CenterVertically),
234-
)
235252
}
236253
}
237254
}
@@ -372,10 +389,12 @@ fun HomeScreen(
372389
homeState.financialTips.firstOrNull {
373390
android.text.format.DateUtils.isToday(it.date!!)
374391
}?.let {
375-
FinancialTipCard(
376-
tipInterface = tipInterface,
377-
financialTip = homeState.financialTips.first()
378-
)
392+
if (homeState.dismissedTipId != it.id)
393+
FinancialTipCard(
394+
tipInterface = tipInterface,
395+
financialTip = homeState.financialTips.first(),
396+
homeViewModel
397+
)
379398
}
380399
}
381400
}
@@ -435,7 +454,7 @@ fun HomeScreenPreview() {
435454
BalanceScreenPreview()
436455
}
437456
item {
438-
FinancialTipCard(tipInterface = null, financialTip = financialTip)
457+
FinancialTipCard(tipInterface = null, financialTip = financialTip, null)
439458
}
440459
})
441460
})

0 commit comments

Comments
 (0)