diff --git a/app/build.gradle b/app/build.gradle index 54006a273..16f8dcd52 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,7 +26,7 @@ android { minSdkVersion 21 targetSdkVersion 30 versionCode 50 - versionName "0.1.4.20" + versionName "0.1.4.22" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" kapt { arguments { diff --git a/app/src/main/java/net/xzos/upgradeall/ui/activity/MainActivity.kt b/app/src/main/java/net/xzos/upgradeall/ui/activity/MainActivity.kt index f0a7fe6bf..160072cb7 100644 --- a/app/src/main/java/net/xzos/upgradeall/ui/activity/MainActivity.kt +++ b/app/src/main/java/net/xzos/upgradeall/ui/activity/MainActivity.kt @@ -7,7 +7,6 @@ import android.view.MenuItem import android.view.ViewTreeObserver import android.widget.FrameLayout import android.widget.LinearLayout -import android.widget.Toast import androidx.appcompat.app.ActionBarDrawerToggle import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.core.view.GravityCompat @@ -35,8 +34,8 @@ import net.xzos.upgradeall.ui.viewmodels.pageradapter.AppTabSectionsPagerAdapter import net.xzos.upgradeall.utils.MiscellaneousUtils import net.xzos.upgradeall.utils.ToastUtil import net.xzos.upgradeall.utils.UiUtils +import net.xzos.upgradeall.utils.egg import net.xzos.upgradeall.utils.file.FileUtil.NAV_IMAGE_FILE -import java.util.* class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedListener { @@ -76,7 +75,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList itemBackground = UiUtils.createItemBackgroundMd2(this@MainActivity) } - showToast() + egg() PreferencesMap.initByActivity(this) } @@ -235,14 +234,6 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList navHeaderImageView.setImageDrawable(null) } - private fun showToast() { - val cal = Calendar.getInstance() - val month = cal.get(Calendar.MONTH) + 1 - val day = cal.get(Calendar.DATE) - if (month == 10 && day == 31) - ToastUtil.makeText("\uD83E\uDD70\uD83D\uDE0B\uD83D\uDE1D\uD83D\uDE09", Toast.LENGTH_LONG) - } - companion object { // Fragment 跳转 diff --git a/app/src/main/java/net/xzos/upgradeall/utils/egg.kt b/app/src/main/java/net/xzos/upgradeall/utils/egg.kt new file mode 100644 index 000000000..7fa253ec0 --- /dev/null +++ b/app/src/main/java/net/xzos/upgradeall/utils/egg.kt @@ -0,0 +1,17 @@ +package net.xzos.upgradeall.utils + +import android.widget.Toast +import java.util.* + +fun egg() { + val cal = Calendar.getInstance() + val month = cal.get(Calendar.MONTH) + 1 + val day = cal.get(Calendar.DATE) + when { + month == 10 && day == 31 -> halloweenAndBirthday() + } +} + +fun halloweenAndBirthday() { + MiscellaneousUtils.showToast("\uD83C\uDF6C\uD83E\uDD70\uD83D\uDE0B\uD83D\uDE1D\uD83D\uDE09", Toast.LENGTH_LONG) +}