Skip to content

Commit

Permalink
feat: Optimize project dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Hu Shenghao <[email protected]>
  • Loading branch information
hushenghao committed Dec 5, 2024
1 parent 5e25e9f commit 12f5922
Show file tree
Hide file tree
Showing 50 changed files with 338 additions and 1,001 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### v3.2.1

- Optimize APK file size

### v3.2.0 (2024-12-03)

- Add Android 16 preview
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG_zh.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 更新日志

### v3.2.1

- 优化 APK 文件大小

### v3.2.0 (2024-12-03)

- 添加 Android 16 预览
Expand Down
7 changes: 4 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {

defaultConfig {
applicationId = "com.dede.android_eggs"
versionCode = 55
versionName = "3.2.0"
versionCode = 56
versionName = "3.2.1"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

resourceConfigurations += listOf(
Expand Down Expand Up @@ -95,8 +95,10 @@ android {
"META-INF/*.version",
"META-INF/NOTICE.*",
"META-INF/LICENSE",
"META-INF/**/LICENSE.txt",
"kotlin/**.kotlin_builtins",
"DebugProbesKt.bin",
"*.properties"
)
}

Expand All @@ -115,7 +117,6 @@ dependencies {
implementation(libs.androidx.lifecycle)
implementation(libs.androidx.viewmodel)
implementation(libs.androidx.livedata)
implementation(libs.google.material)
implementation(libs.androidx.startup)

implementation(libs.androidx.compose.activity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.dede.android_eggs.fake_test
import androidx.core.graphics.drawable.toBitmap
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import com.dede.android_eggs.R
import com.dede.android_eggs.fake_test.utils.EasterEggsServer
import com.dede.android_eggs.fake_test.utils.ResponseUtils.toResponse
import com.dede.basic.createThemeWrapperContext
Expand All @@ -26,8 +25,9 @@ class ClockAnalogSimpleDialUtil {
@Test
fun generate() {
val context = InstrumentationRegistry.getInstrumentation().targetContext
val drawableRes = com.dede.android_eggs.views.widget.R.drawable.clock_analog_simple_dial
val wrapperContext = context.createThemeWrapperContext()
val drawable = wrapperContext.requireDrawable(R.drawable.clock_analog_simple_dial)
val drawable = wrapperContext.requireDrawable(drawableRes)
val bitmap = drawable.toBitmap()

//bitmap = bitmap.scale(IMAGE_SIZE, IMAGE_SIZE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.dede.android_eggs

import androidx.fragment.app.FragmentActivity
import androidx.activity.ComponentActivity
import com.dede.android_eggs.inject.FlavorFeatures

class FlavorFeaturesImpl : FlavorFeatures {
override fun call(activity: FragmentActivity) {
override fun call(activity: ComponentActivity) {
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dede.android_eggs.inject

import androidx.fragment.app.FragmentActivity
import androidx.activity.ComponentActivity
import com.dede.android_eggs.FlavorFeaturesImpl

interface FlavorFeatures {
Expand All @@ -14,5 +14,5 @@ interface FlavorFeatures {
}
}

fun call(activity: FragmentActivity)
fun call(activity: ComponentActivity)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ import android.app.Application
import android.content.Context
import androidx.startup.Initializer
import com.dede.android_eggs.util.ActivityActionDispatcher
import com.dede.android_eggs.views.settings.compose.prefs.DynamicColorPrefUtil
import com.dede.android_eggs.views.settings.compose.prefs.ThemePrefUtil
import com.dede.basic.GlobalContext

class ApplicationInitializer : Initializer<Unit> {

override fun create(context: Context) {
val application = context.applicationContext as Application
// apply compat style
DynamicColorPrefUtil.apply(application)
ThemePrefUtil.apply(application)
ActivityActionDispatcher.register(application)
}

Expand Down
14 changes: 0 additions & 14 deletions app/src/main/java/com/dede/android_eggs/ui/Icons.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ fun rememberThemedHashImageBitmap(
height: Int = 32
): ImageBitmap {
val context = LocalContext.current
return remember(hash, ThemeUtils.isSystemNightMode(context)) {
return remember(hash, ThemeUtils.isDarkMode(context.resources)) {
var bitmap = checkNotNull(BlurHashDecoder.decode(hash, width, height)) {
"BlurHash decode error! hash: ".format(hash)
}
if (ThemeUtils.isSystemNightMode(context)) {
if (ThemeUtils.isDarkMode(context.resources)) {
val nightMode =
Bitmap.createBitmap(bitmap.width, bitmap.height, Bitmap.Config.ARGB_8888)
val paint = Paint(Paint.ANTI_ALIAS_FLAG)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class ActivityActionDispatcher : Application.ActivityLifecycleCallbacks {
}
}

private val actions = arrayListOf(
PermissionRequestAction(),
private val actions: List<ActivityAction> = arrayListOf(
PlatLogoActivityAction(),
WarningDialogAction(),
PlatLogoActivityAction()
PermissionRequestAction(),
)

override fun onActivityPreCreated(activity: Activity, savedInstanceState: Bundle?) {
Expand Down
Loading

0 comments on commit 12f5922

Please sign in to comment.