Skip to content

Commit 19f52bc

Browse files
committed
feat: Add Android 16 preview
Signed-off-by: Hu Shenghao <dede.hu@qq.com>
1 parent 0ddafa4 commit 19f52bc

File tree

17 files changed

+555
-26
lines changed

17 files changed

+555
-26
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### v3.2.0
44

5+
- Add Android 16 preview
56
- Add 'Animator duration scale' alert
67
- Update App theme colors
78
- Update App monochrome logo

CHANGELOG_zh.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### v3.2.0
44

5+
- 添加 Android 16 预览
56
- 添加 ‘Animator 时长缩放’ 检查
67
- 更新 App 主题色
78
- 更新 App 单色图标

app/build.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ android {
6969
create("alpha") {
7070
dimension = "track"
7171
versionNameSuffix = "-alpha"
72-
ndk {
73-
//noinspection ChromeOsAbiSupport
74-
abiFilters += listOf("arm64-v8a", "armeabi-v7a")
75-
}
7672
}
7773
create("beta") {
7874
dimension = "track"

app/src/main/java/com/dede/android_eggs/inject/EasterEggModules.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.android_k.egg.AndroidKitKatEasterEgg
99
import com.android_l.egg.AndroidLollipopEasterEgg
1010
import com.android_m.egg.AndroidMarshmallowEasterEgg
1111
import com.android_n.egg.AndroidNougatEasterEgg
12+
import com.android_next.egg.AndroidNextEasterEgg
1213
import com.android_o.egg.AndroidOreoEasterEgg
1314
import com.android_p.egg.AndroidPieEasterEgg
1415
import com.android_q.egg.AndroidQEasterEgg
@@ -31,7 +32,7 @@ import javax.inject.Singleton
3132

3233
@Module(
3334
includes = [
34-
// AndroidNextEasterEgg::class,
35+
AndroidNextEasterEgg::class,
3536
AndroidVEasterEgg::class,
3637
AndroidUEasterEgg::class,
3738
AndroidTEasterEgg::class,

app/src/main/java/com/dede/android_eggs/ui/drawables/AlterableAdaptiveIconDrawable.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class AlterableAdaptiveIconDrawable(
5454
private var layerBitmap: Bitmap? = null
5555
private var layerShader: BitmapShader? = null
5656

57-
val isAdaptiveIconDrawable: Boolean
57+
val isSupportMatrix: Boolean
5858
private val foregroundMatrix = Matrix()
5959

6060
init {
@@ -71,10 +71,10 @@ class AlterableAdaptiveIconDrawable(
7171
ChildDrawable(drawable.background, BACKGROUND_ID),
7272
ChildDrawable(drawable.foreground, FOREGROUND_ID)
7373
)
74-
isAdaptiveIconDrawable = true
74+
isSupportMatrix = true
7575
} else {
7676
childDrawables = arrayOf(ChildDrawable(drawable, BACKGROUND_ID))
77-
isAdaptiveIconDrawable = false
77+
isSupportMatrix = false
7878
}
7979
}
8080

@@ -89,7 +89,7 @@ class AlterableAdaptiveIconDrawable(
8989
}
9090

9191
fun setForegroundMatrix(matrix: Matrix) {
92-
if (!isAdaptiveIconDrawable) return
92+
if (!isSupportMatrix) return
9393
foregroundMatrix.set(matrix)
9494
invalidateSelf()
9595
}
@@ -155,7 +155,7 @@ class AlterableAdaptiveIconDrawable(
155155

156156
private fun updateLayerBoundsInternal(bounds: Rect) {
157157
val outRect = tempRect
158-
if (isAdaptiveIconDrawable) {
158+
if (isSupportMatrix) {
159159
val cX: Int = bounds.width() / 2
160160
val cY: Int = bounds.height() / 2
161161
val insetWidth: Int = (bounds.width() / (DEFAULT_VIEW_PORT_SCALE * 2)).toInt()

app/src/main/java/com/dede/android_eggs/views/main/util/EasterEggHelp.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ object EasterEggHelp {
139139

140140
init {
141141
apiLevelArrays[Build.VERSION_CODES.CUR_DEVELOPMENT] = "Next"
142+
apiLevelArrays[36] = "16"
142143
apiLevelArrays[Build.VERSION_CODES.VANILLA_ICE_CREAM] = "15"
143144
apiLevelArrays[Build.VERSION_CODES.UPSIDE_DOWN_CAKE] = "14"
144145
apiLevelArrays[Build.VERSION_CODES.TIRAMISU] = "13"

app/src/main/java/com/dede/android_eggs/views/settings/SettingsScreen.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import com.dede.android_eggs.views.settings.compose.options.TestCrashOption
5959
import com.dede.android_eggs.views.settings.compose.prefs.ComponentManagerPref
6060
import com.dede.android_eggs.views.settings.compose.prefs.IconShapePref
6161
import com.dede.android_eggs.views.settings.compose.prefs.IconVisualEffectsPref
62+
import com.dede.android_eggs.views.settings.compose.prefs.IconVisualEffectsPrefUtil
6263
import com.dede.android_eggs.views.settings.compose.prefs.LanguagePref
6364
import com.dede.android_eggs.views.settings.compose.prefs.LanguagePrefUtil
6465
import com.dede.android_eggs.views.settings.compose.prefs.RetainInRecentsPref
@@ -142,7 +143,9 @@ fun SettingsScreen(drawerState: DrawerState = rememberDrawerState(DrawerValue.Cl
142143
LanguagePref()
143144
}
144145

145-
IconVisualEffectsPref()
146+
if (IconVisualEffectsPrefUtil.isSupported()) {
147+
IconVisualEffectsPref()
148+
}
146149

147150
SettingDivider()
148151

app/src/main/java/com/dede/android_eggs/views/settings/compose/prefs/IconVisualEffectsPref.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.dede.android_eggs.views.settings.compose.prefs
22

33
import android.content.Context
4+
import android.os.Build
45
import androidx.compose.material.icons.Icons
56
import androidx.compose.material.icons.rounded.Animation
67
import androidx.compose.runtime.Composable
@@ -17,8 +18,12 @@ object IconVisualEffectsPrefUtil {
1718
const val ACTION_CHANGED = "com.dede.android_eggs.IconVisualEffectsChanged"
1819
const val KEY_ICON_VISUAL_EFFECTS = "pref_key_icon_visual_effects"
1920

21+
fun isSupported(): Boolean {
22+
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
23+
}
24+
2025
fun isEnable(context: Context): Boolean {
21-
return SettingPrefUtil.getValue(
26+
return isSupported() && SettingPrefUtil.getValue(
2227
context, KEY_ICON_VISUAL_EFFECTS, SettingPrefUtil.OFF
2328
) == SettingPrefUtil.ON
2429
}

eggs/AndroidNext/src/main/java/com/android_next/egg/AndroidNextEasterEgg.kt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.android_next.egg
22

33
import android.content.Context
4-
import android.os.Build
54
import android.view.View
65
import android.widget.ImageView
76
import androidx.annotation.DrawableRes
@@ -20,25 +19,27 @@ import dagger.multibindings.IntoSet
2019
import java.util.Calendar
2120
import javax.inject.Singleton
2221

23-
//@Module
24-
//@InstallIn(SingletonComponent::class)
22+
@Module
23+
@InstallIn(SingletonComponent::class)
2524
object AndroidNextEasterEgg : EasterEggProvider {
2625

2726
const val RELEASE_YEAR = 2025
2827
private const val RELEASE_MONTH = Calendar.SEPTEMBER
2928

30-
private const val NEXT_API = Build.VERSION_CODES.CUR_DEVELOPMENT// android next
29+
// private const val NEXT_API = Build.VERSION_CODES.CUR_DEVELOPMENT// android next
30+
private const val NEXT_API = 36// android 16
3131

32-
private const val TIMELINE_EVENT = "Wow, Android Next."
32+
// private const val TIMELINE_EVENT = "Wow, Android Next."
33+
private const val TIMELINE_EVENT = "Hello, Android Baklava."
3334

3435
@StringRes
3536
private val NICKNAME_RES = R.string.nickname_android_next
3637

3738
@DrawableRes
38-
private val LOGO_RES = R.drawable.ic_droid_logo
39+
private val LOGO_RES = R.drawable.ic_android_16_logo
3940

4041
@DrawableRes
41-
private val PLATLOGO_RES = R.drawable.img_droid_next
42+
private val PLATLOGO_RES = R.drawable.ic_android_16_platlogo
4243

4344
fun getTimelineMessage(context: Context): String {
4445
val calendar = Calendar.getInstance()
@@ -50,9 +51,9 @@ object AndroidNextEasterEgg : EasterEggProvider {
5051
}
5152
}
5253

53-
// @Provides
54-
// @IntoSet
55-
// @Singleton
54+
@Provides
55+
@IntoSet
56+
@Singleton
5657
override fun provideEasterEgg(): BaseEasterEgg {
5758
return object : EasterEgg(
5859
iconRes = LOGO_RES,
@@ -80,9 +81,9 @@ object AndroidNextEasterEgg : EasterEggProvider {
8081
}
8182
}
8283

83-
// @Provides
84-
// @IntoSet
85-
// @Singleton
84+
@Provides
85+
@IntoSet
86+
@Singleton
8687
override fun provideTimelineEvents(): List<TimelineEvent> {
8788
return listOf(
8889
TimelineEvent(
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@drawable/ic_android_16_logo_background"/>
4+
<foreground android:drawable="@drawable/ic_android_16_logo_foreground"/>
5+
</adaptive-icon>

0 commit comments

Comments
 (0)