Skip to content

Commit

Permalink
Fix header image overlapping other custom elements
Browse files Browse the repository at this point in the history
Signed-off-by: DrDisagree <[email protected]>
  • Loading branch information
Mahmud0808 committed Sep 5, 2024
1 parent 89a33e6 commit 1dcf0f5
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import com.drdisagree.iconify.common.Preferences.HEADER_CLOCK_TOPMARGIN
import com.drdisagree.iconify.common.Preferences.HIDE_STATUS_ICONS_SWITCH
import com.drdisagree.iconify.common.Preferences.ICONIFY_HEADER_CLOCK_TAG
import com.drdisagree.iconify.common.Preferences.ICONIFY_QS_HEADER_CONTAINER_SHADE_TAG
import com.drdisagree.iconify.common.Preferences.ICONIFY_QS_HEADER_CONTAINER_TAG
import com.drdisagree.iconify.common.Preferences.OP_QS_HEADER_SWITCH
import com.drdisagree.iconify.common.Preferences.QSPANEL_HIDE_CARRIER
import com.drdisagree.iconify.common.Resources
Expand Down Expand Up @@ -294,9 +295,18 @@ class HeaderClockA14(context: Context?) : ModPack(context!!) {
addView(mQsIconsContainer)
}


(mQsHeaderContainer.parent as? ViewGroup)?.removeView(mQsHeaderContainer)
mQuickStatusBarHeader!!.addView(mQsHeaderContainer, -1)
val headerImageAvailable = mQuickStatusBarHeader!!.findViewWithTag<ViewGroup?>(
ICONIFY_QS_HEADER_CONTAINER_TAG
)
mQuickStatusBarHeader!!.addView(
mQsHeaderContainer,
if (headerImageAvailable == null) {
-1
} else {
mQuickStatusBarHeader!!.indexOfChild(headerImageAvailable) + 1
}
)

handleOldHeaderView(param)

Expand All @@ -323,8 +333,19 @@ class HeaderClockA14(context: Context?) : ModPack(context!!) {
mQsHeaderContainerShade.visibility = View.VISIBLE
} else {
if (mQsHeaderContainer.parent != mQuickStatusBarHeader) {
val headerImageAvailable =
mQuickStatusBarHeader!!.findViewWithTag<ViewGroup?>(
ICONIFY_QS_HEADER_CONTAINER_TAG
)
(mQsHeaderContainer.parent as? ViewGroup)?.removeView(mQsHeaderContainer)
mQuickStatusBarHeader?.addView(mQsHeaderContainer, 0)
mQuickStatusBarHeader?.addView(
mQsHeaderContainer,
if (headerImageAvailable == null) {
0
} else {
mQuickStatusBarHeader!!.indexOfChild(headerImageAvailable) + 1
}
)
}
mQsHeaderContainerShade.visibility = View.GONE
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import com.drdisagree.iconify.common.Preferences.HEADER_IMAGE_LANDSCAPE_SWITCH
import com.drdisagree.iconify.common.Preferences.HEADER_IMAGE_OVERLAP
import com.drdisagree.iconify.common.Preferences.HEADER_IMAGE_SWITCH
import com.drdisagree.iconify.common.Preferences.HEADER_IMAGE_ZOOMTOFIT
import com.drdisagree.iconify.common.Preferences.ICONIFY_QS_HEADER_CONTAINER_TAG
import com.drdisagree.iconify.xposed.ModPack
import com.drdisagree.iconify.xposed.modules.utils.ViewHelper.toPx
import com.drdisagree.iconify.xposed.utils.XPrefs.Xprefs
Expand Down Expand Up @@ -126,7 +127,9 @@ class HeaderImage(context: Context?) : ModPack(context!!) {
hookAllMethods(quickStatusBarHeader, "onFinishInflate", object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) {
val mQuickStatusBarHeader = param.thisObject as FrameLayout
mQsHeaderLayout = FadingEdgeLayout(mContext)
mQsHeaderLayout = FadingEdgeLayout(mContext).apply {
tag = ICONIFY_QS_HEADER_CONTAINER_TAG
}

val layoutParams = LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, TypedValue.applyDimension(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import com.drdisagree.iconify.BuildConfig
import com.drdisagree.iconify.common.Const.FRAMEWORK_PACKAGE
import com.drdisagree.iconify.common.Const.SYSTEMUI_PACKAGE
import com.drdisagree.iconify.common.Preferences.ICONIFY_QS_HEADER_CONTAINER_SHADE_TAG
import com.drdisagree.iconify.common.Preferences.ICONIFY_QS_HEADER_CONTAINER_TAG
import com.drdisagree.iconify.common.Preferences.OP_QS_HEADER_BLUR_LEVEL
import com.drdisagree.iconify.common.Preferences.OP_QS_HEADER_EXPANSION_Y
import com.drdisagree.iconify.common.Preferences.OP_QS_HEADER_SWITCH
Expand Down Expand Up @@ -400,7 +401,17 @@ class OpQsHeader(context: Context?) : ModPack(context!!) {
}

(mQsHeaderContainer.parent as? ViewGroup)?.removeView(mQsHeaderContainer)
mQuickStatusBarHeader!!.addView(mQsHeaderContainer, -1)
val headerImageAvailable = mQuickStatusBarHeader!!.findViewWithTag<ViewGroup?>(
ICONIFY_QS_HEADER_CONTAINER_TAG
)
mQuickStatusBarHeader!!.addView(
mQsHeaderContainer,
if (headerImageAvailable == null) {
-1
} else {
mQuickStatusBarHeader!!.indexOfChild(headerImageAvailable) + 1
}
)

val relativeLayout = RelativeLayout(mContext).apply {
layoutParams = RelativeLayout.LayoutParams(
Expand Down Expand Up @@ -479,8 +490,19 @@ class OpQsHeader(context: Context?) : ModPack(context!!) {
mQsHeaderContainerShade.visibility = View.VISIBLE
} else {
if (mQsHeaderContainer.parent != mQuickStatusBarHeader) {
val headerImageAvailable =
mQuickStatusBarHeader!!.findViewWithTag<ViewGroup?>(
ICONIFY_QS_HEADER_CONTAINER_TAG
)
(mQsHeaderContainer.parent as? ViewGroup)?.removeView(mQsHeaderContainer)
mQuickStatusBarHeader?.addView(mQsHeaderContainer, -1)
mQuickStatusBarHeader?.addView(
mQsHeaderContainer,
if (headerImageAvailable == null) {
0
} else {
mQuickStatusBarHeader!!.indexOfChild(headerImageAvailable) + 1
}
)
}
mQsHeaderContainerShade.visibility = View.GONE
}
Expand Down

0 comments on commit 1dcf0f5

Please sign in to comment.