Skip to content
This repository has been archived by the owner on Aug 17, 2020. It is now read-only.

Commit

Permalink
Add colored circle background to qs tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
suphon-t committed Mar 18, 2018
1 parent 0fe885f commit 27ae6ed
Show file tree
Hide file tree
Showing 7 changed files with 633 additions and 406 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/xyz/paphonb/androidpify/MainHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ object MainHook : IXposedHookZygoteInit, IXposedHookLoadPackage, IXposedHookInit
LeftClockHook.handleLoadPackage(lpparam)
CustomizationsHook.handleLoadPackage(lpparam)
NotificationStackHook.handleLoadPackage(lpparam)
QuickSettingsHook.handleLoadPackage(lpparam)
SettingsHook.handleLoadPackage(lpparam)

if (lpparam.packageName == PACKAGE_OWN) {
Expand All @@ -59,6 +60,7 @@ object MainHook : IXposedHookZygoteInit, IXposedHookLoadPackage, IXposedHookInit
override fun handleInitPackageResources(resparam: XC_InitPackageResources.InitPackageResourcesParam) {
modResInternal = XModuleResources.createInstance(MODULE_PATH, resparam.res)
NotificationStackHook.handleInitPackageResources(resparam)
QuickSettingsHook.handleInitPackageResources(resparam)
SettingsHook.handleInitPackageResources(resparam)
}

Expand Down

Large diffs are not rendered by default.

570 changes: 570 additions & 0 deletions app/src/main/java/xyz/paphonb/androidpify/hooks/QuickSettingsHook.kt

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions app/src/main/java/xyz/paphonb/androidpify/utils/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,48 @@
package xyz.paphonb.androidpify.utils

import android.content.Context
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.support.annotation.ColorInt
import xyz.paphonb.androidpify.MainHook


@ColorInt
fun Context.getColorAccent(): Int {
return getColorAttr(android.R.attr.colorAccent)
}

@ColorInt
fun Context.getColorError(): Int {
return getColorAttr(android.R.attr.colorError)
}

@ColorInt
fun Context.getDefaultColor(resId: Int): Int {
return resources.getColorStateList(resId, theme).defaultColor
}

@ColorInt
fun Context.getDisabled(inputColor: Int): Int {
return applyAlphaAttr(android.R.attr.disabledAlpha, inputColor)
}

@ColorInt
fun Context.applyAlphaAttr(attr: Int, inputColor: Int): Int {
val ta = obtainStyledAttributes(intArrayOf(attr))
val alpha = ta.getFloat(0, 0f)
ta.recycle()
return applyAlpha(alpha, inputColor)
}

@ColorInt
fun applyAlpha(a: Float, inputColor: Int): Int {
var alpha = a
alpha *= Color.alpha(inputColor)
return Color.argb(alpha.toInt(), Color.red(inputColor), Color.green(inputColor),
Color.blue(inputColor))
}

@ColorInt
fun Context.getColorAttr(attr: Int): Int {
val ta = obtainStyledAttributes(intArrayOf(attr))
Expand All @@ -28,6 +67,20 @@ fun Context.getColorAttr(attr: Int): Int {
return colorAccent
}

fun Context.getThemeAttr(attr: Int): Int {
val ta = obtainStyledAttributes(intArrayOf(attr))
val theme = ta.getResourceId(0, 0)
ta.recycle()
return theme
}

fun Context.getDrawablAttr(attr: Int): Drawable? {
val ta = obtainStyledAttributes(intArrayOf(attr))
val drawable = ta.getDrawable(0)
ta.recycle()
return drawable
}

fun Any.logI(msg: String) {
MainHook.logI(javaClass.simpleName, msg)
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_qs_circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="40.0dip" android:width="40.0dip" android:viewportWidth="2.2" android:viewportHeight="2.2"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#ffffffff" android:pathData="M.1,1.1 c0,.55 .45,1 1,1 c.55,0 1,-.45 1,-1 c0,-.55 -.45,-1 -1,-1 c-.55,0 -1,.45 -1,1" />
</vector>
1 change: 1 addition & 0 deletions app/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<item name="quick_qs_status_icons" type="id" />
<item name="signal_cluster" type="id" />
<item name="quick_qs_footer_layout" type="id" />
<item name="qs_tile_background" type="id" />
</resources>
2 changes: 1 addition & 1 deletion scripts/deploy-telegram.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cp app/build/outputs/apk/release/app-release.apk ${APK_NAME}
CHANGELOG="$(./scripts/changelog.sh)
<a href=\"https://github.com/${TRAVIS_REPO_SLUG}/compare/${TRAVIS_COMMIT_RANGE}\">View on GitHub</a>"

curl -F chat_id="-1001259165513" -F sticker="CAADBQADKAADTBCSGmapM3AUlzaHAg" https://api.telegram.org/bot${BOT_TOKEN}/sendSticker
curl -F chat_id="-1001259165513" -F sticker="CAADBAAD8R8AAmSKPgABCOk3mg-Zvf0C" https://api.telegram.org/bot${BOT_TOKEN}/sendSticker
curl -F chat_id="-1001259165513" -F document=@"${APK_NAME}" https://api.telegram.org/bot${BOT_TOKEN}/sendDocument
curl -F chat_id="-1001259165513" -F text="${CHANGELOG}" -F parse_mode="HTML" -F disable_web_page_preview="true" https://api.telegram.org/bot${BOT_TOKEN}/sendMessage

Expand Down

0 comments on commit 27ae6ed

Please sign in to comment.