Skip to content

Commit

Permalink
Merge branch 'release/1.9.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
hushenghao committed Apr 4, 2023
2 parents 8839698 + 429b725 commit 4600d0d
Show file tree
Hide file tree
Showing 223 changed files with 9,333 additions and 2,007 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Organize the Easter eggs of the official versions of the Android system.
![Easter Eggs](https://img.shields.io/badge/Android-Easter%20Eggs-red?logo=android) ![GitHub top language](https://img.shields.io/github/languages/top/hushenghao/AndroidEasterEggs?logo=kotlin)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/hushenghao/AndroidEasterEggs) [![GitHub](https://img.shields.io/github/license/hushenghao/AndroidEasterEggs)](https://github.com/hushenghao/AndroidEasterEggs/blob/master/LICENSE) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/hushenghao/AndroidEasterEggs)](https://github.com/hushenghao/AndroidEasterEggs/releases)

[![Alt](https://repobeats.axiom.co/api/embed/66c4053d3e594aed0242e0bac779378ef4da9129.svg "Repobeats analytics image")](https://github.com/hushenghao/AndroidEasterEggs/pulse)

![logo](./images/ic_launcher_round.png)

[中文](./README_zh.md)
Expand Down
2 changes: 2 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
![Easter Eggs](https://img.shields.io/badge/Android-Easter%20Eggs-red?logo=android) ![GitHub top language](https://img.shields.io/github/languages/top/hushenghao/AndroidEasterEggs?logo=kotlin)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/hushenghao/AndroidEasterEggs) [![GitHub](https://img.shields.io/github/license/hushenghao/AndroidEasterEggs)](https://github.com/hushenghao/AndroidEasterEggs/blob/master/LICENSE) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/hushenghao/AndroidEasterEggs)](https://github.com/hushenghao/AndroidEasterEggs/releases)

[![Alt](https://repobeats.axiom.co/api/embed/66c4053d3e594aed0242e0bac779378ef4da9129.svg "Repobeats analytics image")](https://github.com/hushenghao/AndroidEasterEggs/pulse)

![logo](./images/ic_launcher_round.png)

[English](./README.md)
Expand Down
28 changes: 13 additions & 15 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
@file:Suppress("UnstableApiUsage")

import Versions.gitHash
import Versions.keyprops
import com.android.build.api.dsl.ManagedVirtualDevice
import java.util.*

val keystoreProperties = Properties().apply {
rootProject.file("key.properties")
.takeIf { it.exists() }?.inputStream()?.use(this::load)
}

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
Expand All @@ -22,21 +19,21 @@ android {
applicationId = "com.dede.android_eggs"
minSdk = Versions.MIN_SDK
targetSdk = Versions.TARGET_SDK
versionCode = 25
versionName = "1.9.2"

versionCode = 26
versionName = "1.9.3"
buildConfigField("String", "GIT_HASH", "\"${gitHash}\"")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
resourceConfigurations.addAll(listOf("zh", "en"))
setProperty("archivesBaseName", "easter_eggs_${versionName}_${versionCode}")
}

signingConfigs {
if (keystoreProperties.isEmpty) return@signingConfigs
if (keyprops.isEmpty) return@signingConfigs
create("release") {
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("keyPassword")
storeFile = file(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("storePassword")
keyAlias = keyprops.getProperty("keyAlias")
keyPassword = keyprops.getProperty("keyPassword")
storeFile = file(keyprops.getProperty("storeFile"))
storePassword = keyprops.getProperty("storePassword")
enableV3Signing = true
enableV4Signing = true
}
Expand All @@ -48,8 +45,8 @@ android {
signingConfig = config
}
getByName("release") {
isShrinkResources = false
isMinifyEnabled = false
isShrinkResources = true
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand Down Expand Up @@ -98,6 +95,7 @@ dependencies {
implementation(deps.google.material)
implementation(deps.io.coil)
implementation(deps.free.reflection)
implementation(deps.viewbinding.delegate)
debugImplementation(deps.leakcanary)
implementation(project(":basic"))
implementation(project(":eggs:T"))
Expand Down
10 changes: 9 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

-dontwarn org.bouncycastle.jsse.**
-dontwarn org.conscrypt.**
-dontwarn org.openjsse.**

-keepclassmembers class * extends com.dede.android_eggs.ui.adapter.VHolder {
public <init>(android.view.View);
}
Binary file removed app/src/main/assets/icons.otf
Binary file not shown.
Binary file added app/src/main/assets/icons.ttf
Binary file not shown.
6 changes: 3 additions & 3 deletions app/src/main/java/com/dede/android_eggs/EasterEggsApp.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.dede.android_eggs

import android.content.Context
import com.dede.android_eggs.settings.SettingsPref
import com.dede.android_eggs.util.ActivityActionDispatcher
import com.dede.android_eggs.util.IconShapeOverride
import com.dede.android_eggs.util.NightModeManager
import com.dede.android_eggs.settings.IconShapeOverride
import com.dede.basic.GlobalContext
import me.weishu.reflection.Reflection

Expand All @@ -17,7 +17,7 @@ class EasterEggsApp : IconShapeOverride.App() {

override fun onCreate() {
super.onCreate()
NightModeManager.applyNightMode(this)
SettingsPref.apply(this)
ActivityActionDispatcher.register(this)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.dede.android_eggs.main

import android.app.Activity
import android.os.Bundle
import androidx.annotation.IdRes
import com.google.android.material.appbar.AppBarLayout

/**
* Fix AppBarLayout Expanded state error
*/
class AppBarExpandedState(
private val activity: Activity,
@IdRes private val id: Int,
private val animate: Boolean = false,
private val default: Boolean = true,
) : AppBarLayout.OnOffsetChangedListener {

companion object {
private const val STATE_KEY = "appbar_expanded_state"
}

private lateinit var appBarLayout: AppBarLayout
private var isExpanded: Boolean = default

fun restore(savedInstanceState: Bundle?) {
appBarLayout = activity.findViewById(id)
appBarLayout.addOnOffsetChangedListener(this)
if (savedInstanceState != null) {
isExpanded = savedInstanceState.getBoolean(STATE_KEY, default)
}
appBarLayout.setExpanded(isExpanded, animate)
}

fun saveState(outState: Bundle) {
outState.putBoolean(STATE_KEY, isExpanded)
}

override fun onOffsetChanged(appBarLayout: AppBarLayout?, verticalOffset: Int) {
isExpanded = verticalOffset >= 0
}
}
71 changes: 20 additions & 51 deletions app/src/main/java/com/dede/android_eggs/main/EasterEggsActivity.kt
Original file line number Diff line number Diff line change
@@ -1,71 +1,40 @@
package com.dede.android_eggs.main

import android.animation.ObjectAnimator
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
import by.kirich1409.viewbindingdelegate.viewBinding
import com.dede.android_eggs.R
import com.dede.android_eggs.settings.SettingsFragment
import com.dede.android_eggs.ui.FontIconsDrawable
import com.dede.android_eggs.util.WindowEdgeUtilsAccessor
import com.google.android.material.color.DynamicColors
import com.google.android.material.R as M3R
import com.dede.android_eggs.databinding.ActivityEasterEggsBinding
import com.dede.android_eggs.settings.EdgePref
import com.dede.android_eggs.settings.SettingsPageController

/**
* Easter Egg Collection
*/
class EasterEggsActivity : AppCompatActivity(), MenuProvider {
class EasterEggsActivity : AppCompatActivity(R.layout.activity_easter_eggs) {

private val navigationViewController = NavigationViewController(this)
private val settingsPageController = SettingsPageController(this)
private val binding: ActivityEasterEggsBinding by viewBinding(ActivityEasterEggsBinding::bind)

private val appBarExpandedState = AppBarExpandedState(this, R.id.app_bar)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
EdgePref.applyEdge(this, window)

DynamicColors.applyToActivityIfAvailable(this)
WindowEdgeUtilsAccessor.applyEdgeToEdge(window, true)

navigationViewController.setContentView()

addMenuProvider(this, this)
}

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
navigationViewController.onConfigurationChanged(newConfig)
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
return navigationViewController.onOptionsItemSelected(item) ||
super.onOptionsItemSelected(item)
}
setSupportActionBar(binding.toolbar)

override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
menuInflater.inflate(R.menu.menu_settings, menu)
menu.findItem(R.id.menu_settings).icon =
FontIconsDrawable(this, "\ue8b8", M3R.attr.actionMenuTextColor, 24f)
settingsPageController.onCreate(savedInstanceState)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
EasterEggsSplash(this).welcome()
}
appBarExpandedState.restore(savedInstanceState)
}

override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
when (menuItem.itemId) {
R.id.menu_settings -> {
val icon = menuItem.icon as FontIconsDrawable
SettingsFragment().apply {
onSlide = {
icon.setRotate(360f * it)
}
show(supportFragmentManager, "Settings")
}
ObjectAnimator.ofFloat(icon, "rotate", 0f, 360f)
.setDuration(500)
.start()
}
else -> return false
}
return true
override fun onSaveInstanceState(outState: Bundle) {
appBarExpandedState.saveState(outState)
super.onSaveInstanceState(outState)
}

}
88 changes: 0 additions & 88 deletions app/src/main/java/com/dede/android_eggs/main/EasterEggsFragment.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.dede.android_eggs.main

import android.graphics.drawable.Animatable
import android.view.Gravity
import android.view.View
import android.view.ViewAnimationUtils
Expand All @@ -9,6 +10,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.AppCompatImageView
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import com.dede.android_eggs.R
import com.dede.basic.dp
import kotlin.math.hypot

Expand All @@ -21,9 +23,10 @@ class EasterEggsSplash(private val activity: AppCompatActivity) : Runnable,
fun welcome() {
root = activity.findViewById(android.R.id.content)
ivLogo = AppCompatImageView(activity).apply {
setImageResource(com.dede.android_eggs.R.drawable.android_14)
setImageResource(R.drawable.avd_anim)
}
val layoutParams = FrameLayout.LayoutParams(108.dp, 108.dp)
(ivLogo.drawable as Animatable).start()
val layoutParams = FrameLayout.LayoutParams(192.dp, 192.dp)
.apply { gravity = Gravity.CENTER }
activity.addContentView(ivLogo, layoutParams)

Expand Down
Loading

0 comments on commit 4600d0d

Please sign in to comment.