Skip to content

Commit

Permalink
opt: 项目文件整理
Browse files Browse the repository at this point in the history
  • Loading branch information
lingqiqi5211 committed Jan 19, 2025
1 parent 6fec459 commit 5739ee8
Show file tree
Hide file tree
Showing 23 changed files with 199 additions and 270 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ android {
}

dependencies {
compileOnly(project(":hidden-api"))
compileOnly(project(":app:hidden-api"))
compileOnly(libs.xposed.api)

implementation(libs.dexkit)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 0 additions & 13 deletions app/processor/build.gradle

This file was deleted.

14 changes: 14 additions & 0 deletions app/processor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
id("java-library")
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

dependencies {
implementation(libs.auto.service)
annotationProcessor(libs.auto.service)
}
54 changes: 0 additions & 54 deletions app/proguard-log.pro

This file was deleted.

35 changes: 23 additions & 12 deletions app/provision/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,36 @@ android {
compileSdk = 35

defaultConfig {
minSdk = 33

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
}
create("beta") {
isMinifyEnabled = false
setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
}
create("canary") {
isMinifyEnabled = false
setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
}
debug {
isMinifyEnabled = false
setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_22
targetCompatibility = JavaVersion.VERSION_22

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
}

val buildTypes = "debug"

dependencies {
api(libs.core)
api(libs.collection)
Expand All @@ -41,5 +48,9 @@ dependencies {
exclude("androidx.appcompat", "appcompat")
}

api(fileTree(mapOf("dir" to "../libs", "include" to listOf("*-${buildTypes}.aar"))))
api(
fileTree(
mapOf("dir" to "../libs", "include" to listOf("*-debug.aar"))
)
)
}
4 changes: 0 additions & 4 deletions app/provision/src/main/AndroidManifest.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.sevtinge.hyperceiler.module.hook.systemui.NotificationFix;
import com.sevtinge.hyperceiler.module.hook.systemui.NotificationFreeform;
import com.sevtinge.hyperceiler.module.hook.systemui.RemoveMiuiMultiWinSwitch;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.OldWeather;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.media.MediaPicture;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.media.SquigglyProgress;
import com.sevtinge.hyperceiler.module.hook.systemui.StatusBarActions;
Expand Down Expand Up @@ -251,6 +252,7 @@ public void handleLoadPackage() {
mPrefsMap.getBoolean("system_control_center_qs_tile_label"));
initHook(new MuteVisibleNotifications(), mPrefsMap.getBoolean("system_ui_control_center_mute_visible_notice"));
initHook(new SwitchCCAndNotification(), mPrefsMap.getBoolean("system_ui_control_center_switch_cc_and_notification"));
initHook(OldWeather.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_show_weather"));
initHook(NotificationWeather.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_show_weather"));
initHook(CompactNotificationsHook.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_compact_notice"));
/*initHook(CCGridOld.INSTANCE, mPrefsMap.getInt("system_control_center_cc_rows", 4) > 4 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.sevtinge.hyperceiler.module.hook.systemui.NotificationFix;
import com.sevtinge.hyperceiler.module.hook.systemui.NotificationFreeform;
import com.sevtinge.hyperceiler.module.hook.systemui.RemoveMiuiMultiWinSwitch;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.OldWeather;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.media.MediaPicture;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.media.SquigglyProgress;
import com.sevtinge.hyperceiler.module.hook.systemui.StatusBarActions;
Expand Down Expand Up @@ -205,6 +206,7 @@ public void handleLoadPackage() {
mPrefsMap.getBoolean("system_control_center_qs_tile_label"));
initHook(new MuteVisibleNotifications(), mPrefsMap.getBoolean("system_ui_control_center_mute_visible_notice"));
initHook(new SwitchCCAndNotification(), mPrefsMap.getBoolean("system_ui_control_center_switch_cc_and_notification"));
initHook(OldWeather.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_show_weather"));
initHook(NotificationWeather.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_show_weather"));
initHook(CompactNotificationsHook.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_compact_notice"));
/*initHook(CCGridOld.INSTANCE, mPrefsMap.getInt("system_control_center_cc_rows", 4) > 4 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.sevtinge.hyperceiler.module.hook.systemui.NotificationFix;
import com.sevtinge.hyperceiler.module.hook.systemui.NotificationFreeform;
import com.sevtinge.hyperceiler.module.hook.systemui.RemoveMiuiMultiWinSwitch;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.OldWeather;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.media.MediaPicture;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.media.SquigglyProgress;
import com.sevtinge.hyperceiler.module.hook.systemui.StatusBarActions;
Expand Down Expand Up @@ -242,6 +243,7 @@ public void handleLoadPackage() {
mPrefsMap.getBoolean("system_control_center_qs_tile_label"));
initHook(new MuteVisibleNotifications(), mPrefsMap.getBoolean("system_ui_control_center_mute_visible_notice"));
initHook(new SwitchCCAndNotification(), mPrefsMap.getBoolean("system_ui_control_center_switch_cc_and_notification"));
initHook(OldWeather.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_show_weather"));
initHook(NotificationWeather.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_show_weather"));
initHook(CompactNotificationsHook.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_compact_notice"));
/*initHook(CCGridOld.INSTANCE, mPrefsMap.getInt("system_control_center_cc_rows", 4) > 4 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.sevtinge.hyperceiler.module.hook.systemui.NotificationFix;
import com.sevtinge.hyperceiler.module.hook.systemui.NotificationFreeform;
import com.sevtinge.hyperceiler.module.hook.systemui.RemoveMiuiMultiWinSwitch;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.OldWeather;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.media.MediaPicture;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.media.SquigglyProgress;
import com.sevtinge.hyperceiler.module.hook.systemui.StatusBarActions;
Expand Down Expand Up @@ -232,6 +233,7 @@ public void handleLoadPackage() {
// mPrefsMap.getBoolean("system_control_center_qs_tile_label"));
initHook(new MuteVisibleNotifications(), mPrefsMap.getBoolean("system_ui_control_center_mute_visible_notice"));
initHook(new SwitchCCAndNotification(), mPrefsMap.getBoolean("system_ui_control_center_switch_cc_and_notification"));
initHook(OldWeather.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_show_weather"));
initHook(NotificationWeather.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_show_weather"));
initHook(CompactNotificationsHook.INSTANCE, mPrefsMap.getBoolean("system_ui_control_center_compact_notice"));
initHook(new QSGrid(), mPrefsMap.getBoolean("system_control_center_old_enable"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package com.sevtinge.hyperceiler.module.hook.systemui.controlcenter

import android.annotation.*
import android.content.*
import android.content.res.Configuration.ORIENTATION_LANDSCAPE
import android.content.res.Configuration.ORIENTATION_PORTRAIT
import android.view.*
Expand All @@ -30,7 +29,6 @@ import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createAfterHook
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createBeforeHook
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder
import com.sevtinge.hyperceiler.module.base.*
import com.sevtinge.hyperceiler.module.hook.systemui.*
import com.sevtinge.hyperceiler.utils.*
import com.sevtinge.hyperceiler.utils.api.LazyClass.miuiConfigs
import com.sevtinge.hyperceiler.utils.devicesdk.*
Expand All @@ -50,24 +48,6 @@ object NotificationWeather : BaseHook() {
// 及动画
private var vWeatherViewFolme: Any? = null

// 天气组件点击事件
private val weatherViewClickListener = View.OnClickListener {
val intent = Intent().apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
component = ComponentName(
"com.miui.weather2",
"com.miui.weather2.ActivityWeatherMain"
)
}

val clz = findClass(InterfacesImplManager.I_ACTIVITY_STARTER)
if (isMoreHyperOSVersion(2f)) {
InterfacesImplManager.sClassContainer[clz]
} else {
Dependency.get(clz)
}?.callMethod("startActivity", intent, true)
}

// 是否显示城市
private val isDisplayCity by lazy {
mPrefsMap.getBoolean("system_ui_control_center_show_weather_city")
Expand Down Expand Up @@ -292,7 +272,9 @@ object NotificationWeather : BaseHook() {
) + dp2px(5f)
}

setOnClickListener(weatherViewClickListener)
setOnClickListener {
startWeatherApp()
}
}

val viewParent = view.parent as ViewGroup
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* This file is part of HyperCeiler.
* HyperCeiler is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/
package com.sevtinge.hyperceiler.module.hook.systemui.controlcenter

import android.annotation.SuppressLint
import android.view.ViewGroup
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder
import com.sevtinge.hyperceiler.module.base.BaseHook

import com.sevtinge.hyperceiler.utils.setObjectField
import com.sevtinge.hyperceiler.view.WeatherView

// 经典控制中心添加天气信息
object OldWeather : BaseHook() {
private val isDisplayCity by lazy {
mPrefsMap.getBoolean("system_ui_control_center_show_weather_city")
}

@SuppressLint("DiscouragedApi")
override fun init() {
var mWeatherView: TextView?
loadClass("com.android.systemui.qs.MiuiQSHeaderView").methodFinder()
.filterByName("onFinishInflate")
.first().createHook {
after {
val viewGroup = it.thisObject as ViewGroup
val context = viewGroup.context
val layoutParam =
loadClass("androidx.constraintlayout.widget.ConstraintLayout\$LayoutParams")
.getConstructor(Int::class.java, Int::class.java)
.newInstance(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
) as ViewGroup.MarginLayoutParams

layoutParam.setObjectField(
"endToStart",
context.resources.getIdentifier(
"notification_shade_shortcut",
"id",
context.packageName
)
)
layoutParam.setObjectField(
"topToTop",
context.resources.getIdentifier(
"notification_shade_shortcut",
"id",
context.packageName
)
)
layoutParam.setObjectField(
"bottomToBottom",
context.resources.getIdentifier(
"notification_shade_shortcut",
"id",
context.packageName
)
)

mWeatherView = WeatherView(context, isDisplayCity).apply {
setTextAppearance(
context.resources.getIdentifier(
"TextAppearance.StatusBar.Expanded.Clock.QuickSettingDate",
"style",
context.packageName
)
)
layoutParams = layoutParam

setOnClickListener {
startWeatherApp()
}
}
viewGroup.addView(mWeatherView)
}
}
}

}
Loading

0 comments on commit 5739ee8

Please sign in to comment.