mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 17:51:57 +00:00
final fixes
This commit is contained in:
parent
f85ddcc35d
commit
23663d2a94
4 changed files with 24 additions and 24 deletions
|
|
@ -11,10 +11,11 @@
|
||||||
|
|
||||||
<com.habitrpg.common.habitica.views.PixelArtView
|
<com.habitrpg.common.habitica.views.PixelArtView
|
||||||
android:id="@+id/notification_image"
|
android:id="@+id/notification_image"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="48dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="48dp"
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:background="@color/transparent"
|
android:background="@color/transparent"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ class NavigationDrawerFragment : DialogFragment() {
|
||||||
updateSeasonalMenuEntries(gearEvent, pair.second)
|
updateSeasonalMenuEntries(gearEvent, pair.second)
|
||||||
}
|
}
|
||||||
|
|
||||||
val event = pair.first.events.firstOrNull { it.eventKey == "birthday10" }
|
val event = configManager.getBirthdayEvent()
|
||||||
val item = getItemWithIdentifier(SIDEBAR_BIRTHDAY)
|
val item = getItemWithIdentifier(SIDEBAR_BIRTHDAY)
|
||||||
if (event != null && item == null) {
|
if (event != null && item == null) {
|
||||||
adapter.currentEvent = event
|
adapter.currentEvent = event
|
||||||
|
|
@ -182,7 +182,7 @@ class NavigationDrawerFragment : DialogFragment() {
|
||||||
} else if (event == null && item != null) {
|
} else if (event == null && item != null) {
|
||||||
item.isVisible = false
|
item.isVisible = false
|
||||||
adapter.updateItem(item)
|
adapter.updateItem(item)
|
||||||
(activity as? MainActivity)?.showBirthdayIcon = true
|
(activity as? MainActivity)?.showBirthdayIcon = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,7 @@ fun BirthdayBanner(endDate: Date, modifier: Modifier = Modifier) {
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
MainNavigationController.navigate(R.id.birthdayActivity)
|
MainNavigationController.navigate(R.id.birthdayActivity)
|
||||||
}
|
}) {
|
||||||
) {
|
|
||||||
Column(Modifier.fillMaxWidth()) {
|
Column(Modifier.fillMaxWidth()) {
|
||||||
Box(
|
Box(
|
||||||
contentAlignment = Alignment.CenterStart,
|
contentAlignment = Alignment.CenterStart,
|
||||||
|
|
@ -63,8 +62,9 @@ fun BirthdayBanner(endDate: Date, modifier: Modifier = Modifier) {
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(colorResource(R.color.brand_100))
|
.background(colorResource(R.color.brand_100))
|
||||||
) {
|
) {
|
||||||
Row(Modifier
|
Row(
|
||||||
.align(Alignment.CenterEnd)) {
|
Modifier.align(Alignment.CenterEnd)
|
||||||
|
) {
|
||||||
Image(
|
Image(
|
||||||
painterResource(R.drawable.birthday_menu_gems),
|
painterResource(R.drawable.birthday_menu_gems),
|
||||||
null,
|
null,
|
||||||
|
|
@ -82,11 +82,8 @@ fun BirthdayBanner(endDate: Date, modifier: Modifier = Modifier) {
|
||||||
}
|
}
|
||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.spacedBy(
|
verticalArrangement = Arrangement.spacedBy(
|
||||||
2.dp,
|
2.dp, Alignment.CenterVertically
|
||||||
Alignment.CenterVertically
|
), modifier = Modifier.padding(start = 8.dp)
|
||||||
),
|
|
||||||
modifier = Modifier
|
|
||||||
.padding(start = 8.dp)
|
|
||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painterResource(R.drawable.birthday_menu_text), null
|
painterResource(R.drawable.birthday_menu_text), null
|
||||||
|
|
@ -127,16 +124,21 @@ fun BirthdayBanner(endDate: Date, modifier: Modifier = Modifier) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun buildString(
|
||||||
|
value: Int, endDate: Date, formatString: Int
|
||||||
|
): String {
|
||||||
|
return stringResource(
|
||||||
|
formatString, endDate.getShortRemainingString()
|
||||||
|
).uppercase()
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TimeRemainingText(
|
fun TimeRemainingText(
|
||||||
endDate: Date,
|
endDate: Date, formatString: Int, color: Color, fontSize: TextUnit, fontWeight: FontWeight
|
||||||
formatString: Int,
|
|
||||||
color: Color,
|
|
||||||
fontSize: TextUnit,
|
|
||||||
fontWeight: FontWeight
|
|
||||||
) {
|
) {
|
||||||
var value by remember { mutableStateOf(0) }
|
var value by remember { mutableStateOf(0) }
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(value) {
|
||||||
val diff = endDate.time - Date().time
|
val diff = endDate.time - Date().time
|
||||||
if (diff.milliseconds > 1.hours) {
|
if (diff.milliseconds > 1.hours) {
|
||||||
delay(1.minutes)
|
delay(1.minutes)
|
||||||
|
|
@ -148,10 +150,7 @@ fun TimeRemainingText(
|
||||||
value += 1
|
value += 1
|
||||||
}
|
}
|
||||||
Text(
|
Text(
|
||||||
stringResource(
|
buildString(value = value, endDate = endDate, formatString = formatString),
|
||||||
formatString,
|
|
||||||
endDate.getShortRemainingString()
|
|
||||||
).uppercase(),
|
|
||||||
color = color,
|
color = color,
|
||||||
fontSize = fontSize,
|
fontSize = fontSize,
|
||||||
fontWeight = fontWeight
|
fontWeight = fontWeight
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
NAME=4.1
|
NAME=4.1
|
||||||
CODE=5081
|
CODE=5101
|
||||||
Loading…
Reference in a new issue