forked from ReChronoRain/HyperCeiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c21c591
commit ae0df9c
Showing
23 changed files
with
232 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
plugins { | ||
alias(libs.plugins.android.library) | ||
} | ||
|
||
android { | ||
namespace = "com.sevtinge.provision" | ||
compileSdk = 35 | ||
|
||
defaultConfig { | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles("consumer-rules.pro") | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
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")) | ||
} | ||
} | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(21) | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
api(libs.core) | ||
api(libs.collection) | ||
api(libs.recyclerview) | ||
api(libs.fragment) | ||
api(libs.lifecycle.common) | ||
api(libs.coordinatorlayout) | ||
api(libs.constraintlayout) { | ||
exclude("androidx.appcompat", "appcompat") | ||
} | ||
|
||
api( | ||
fileTree( | ||
mapOf("dir" to "../libs", "include" to listOf("*-debug.aar")) | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/OldWeather.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.