Skip to content

Commit

Permalink
feat: Happy Halloween
Browse files Browse the repository at this point in the history
  • Loading branch information
xz-dev committed Oct 30, 2020
1 parent 6c28613 commit f59ff1d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 2 additions & 11 deletions app/src/main/java/net/xzos/upgradeall/ui/activity/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {

Expand Down Expand Up @@ -76,7 +75,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
itemBackground = UiUtils.createItemBackgroundMd2(this@MainActivity)
}

showToast()
egg()
PreferencesMap.initByActivity(this)
}

Expand Down Expand Up @@ -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 跳转
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/java/net/xzos/upgradeall/utils/egg.kt
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit f59ff1d

Please sign in to comment.