mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 16:32:39 +00:00
add april fools check to sapphire
This commit is contained in:
2 files changed
+15
-3
No files matched your search
@@ -60,6 +60,10 @@ import com.geode.launcher.utils.ApplicationIcon
|
||||
import com.geode.launcher.utils.ApplicationIconDetails
|
||||
import com.geode.launcher.utils.IconUtils
|
||||
import com.geode.launcher.utils.adaptiveIconPainterResource
|
||||
import kotlinx.datetime.Month
|
||||
import kotlinx.datetime.TimeZone
|
||||
import kotlinx.datetime.todayIn
|
||||
import kotlin.time.Clock
|
||||
|
||||
class ApplicationIconActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@@ -231,14 +235,20 @@ fun ApplicationIconScreen(
|
||||
) {
|
||||
val selectedIcon by PreferenceUtils.useStringPreference(PreferenceUtils.Key.SELECTED_ICON)
|
||||
|
||||
val aprilFools = remember {
|
||||
val currentDate = Clock.System.todayIn(TimeZone.currentSystemDefault())
|
||||
currentDate.month == Month.APRIL && currentDate.day <= 7
|
||||
}
|
||||
|
||||
Column(Modifier
|
||||
.padding(horizontal = 12.dp)
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
) {
|
||||
ApplicationIcon.entries.forEach {
|
||||
val iconData = IconUtils.getIconDetails(it)
|
||||
|
||||
IconCard(iconData, selectedIcon == iconData.id)
|
||||
if (!iconData.checkDate || aprilFools) {
|
||||
IconCard(iconData, selectedIcon == iconData.id)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ data class ApplicationIconDetails(
|
||||
val component: String,
|
||||
@param:DrawableRes val iconId: Int,
|
||||
@param:StringRes val nameId: Int,
|
||||
val checkDate: Boolean = false,
|
||||
)
|
||||
|
||||
object IconUtils {
|
||||
@@ -103,7 +104,8 @@ object IconUtils {
|
||||
id = id.toId(),
|
||||
component = "MainActivitySapphire",
|
||||
iconId = R.mipmap.ic_launcher_sapphire,
|
||||
nameId = R.string.application_icon_sapphire
|
||||
nameId = R.string.application_icon_sapphire,
|
||||
checkDate = true
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user