Skip to content

Commit

Permalink
CHANGELOG: Fixed QS footer actions layout margins
Browse files Browse the repository at this point in the history
  • Loading branch information
siavash79 committed Dec 23, 2023
1 parent bf586b8 commit a06cddd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/edit2MakeNewCanary
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Editing this file will trigger the build script for a new canary..
Editing this file will trigger the build script for a new canary.
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ public class QSFooterManager extends XposedModPack {
private static final String listenPackage = Constants.SYSTEM_UI_PACKAGE;
private static boolean customQSFooterTextEnabled = false;
private static String customText = "";
private Object QSFV;
private Object QSFooterView;
private final StringFormatter stringFormatter = new StringFormatter();

private TextView mChargingIndicator;
private boolean mCharging = false;
private boolean mQSOpen = false;
private static boolean ChargingInfoOnQSEnabled = false;
private LinearLayout mQSFooterContainer;
private Boolean mIsComposeFooterAction = null;


public void updatePrefs(String... Key) {
Expand Down Expand Up @@ -74,7 +75,7 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th
hookAllConstructors(QSFooterViewClass, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
QSFV = param.thisObject;
QSFooterView = param.thisObject;
}
});

Expand Down Expand Up @@ -107,11 +108,19 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
});

hookAllMethods(QSContainerImplClass, "updateResources", new XC_MethodHook() {
@SuppressLint("DiscouragedApi")
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mQSFooterContainer.getLayoutParams();
lp.leftMargin = -1*getIntField(param.thisObject, "mTilesPageMargin");
lp.rightMargin = lp.leftMargin;
if(mIsComposeFooterAction == null)
{
mIsComposeFooterAction = ((View)param.thisObject).findViewById(mContext.getResources().getIdentifier("qs_footer_actions", "id", mContext.getPackageName())).getClass().getName().contains("Compose");
}
int margin = mIsComposeFooterAction
? -1 * getIntField(param.thisObject, "mTilesPageMargin")
: 0;
lp.leftMargin = margin;
lp.rightMargin = margin;
}
});

Expand Down Expand Up @@ -165,9 +174,9 @@ private void createQSBatteryIndicator(FrameLayout QSContainerImpl) {
private void setQSFooterText() {
try {
if (customQSFooterTextEnabled) {
TextView mBuildText = (TextView) getObjectField(QSFV, "mBuildText");
TextView mBuildText = (TextView) getObjectField(QSFooterView, "mBuildText");

setObjectField(QSFV,
setObjectField(QSFooterView,
"mShouldShowBuildText",
customText.trim().length() > 0);

Expand All @@ -176,7 +185,7 @@ private void setQSFooterText() {
mBuildText.setSelected(true);
});
} else {
callMethod(QSFV,
callMethod(QSFooterView,
"setBuildText");
}
} catch (Throwable ignored) {
Expand Down

0 comments on commit a06cddd

Please sign in to comment.