Loading app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurBackgroundView.kt +2 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package foundation.e.blisslauncher.core.customviews import android.content.Context import android.graphics.Canvas import android.graphics.Rect import android.graphics.drawable.Drawable import android.util.AttributeSet import android.view.View Loading Loading @@ -76,5 +77,5 @@ class BlurBackgroundView(context: Context, attrs: AttributeSet?) : View(context, createFullBlurDrawable() } override fun setInsets(insets: WindowInsets) {} override fun setInsets(insets: Rect) {} } app/src/main/java/foundation/e/blisslauncher/core/customviews/DockGridLayout.kt +4 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package foundation.e.blisslauncher.core.customviews import android.content.Context import android.graphics.Canvas import android.graphics.Rect import android.graphics.drawable.Drawable import android.util.AttributeSet import android.view.WindowInsets Loading Loading @@ -73,15 +74,15 @@ class DockGridLayout @JvmOverloads constructor( } } override fun setInsets(insets: WindowInsets?) { override fun setInsets(insets: Rect) { if (insets == null) return val deviceProfile = BlissLauncher.getApplication(context).deviceProfile val lp = layoutParams as InsettableRelativeLayout.LayoutParams lp.height = deviceProfile.hotseatCellHeightPx + insets.systemWindowInsetBottom lp.height = deviceProfile.hotseatCellHeightPx + insets.bottom setPadding( deviceProfile.iconDrawablePaddingPx / 2, 0, deviceProfile.iconDrawablePaddingPx / 2, insets.systemWindowInsetBottom deviceProfile.iconDrawablePaddingPx / 2, insets.bottom ) layoutParams = lp } Loading app/src/main/java/foundation/e/blisslauncher/core/customviews/HorizontalPager.java +3 −3 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class HorizontalPager extends ViewGroup implements Insettable { private Set<OnScrollListener> mListeners = new HashSet<>(); private boolean mIsUiCreated; private GestureDetectorCompat gestureDetectorCompat; private WindowInsets insets; private Rect insets; private float mLastMotionRawY; public HorizontalPager(Context context, AttributeSet attrs) { Loading Loading @@ -540,10 +540,10 @@ public class HorizontalPager extends ViewGroup implements Insettable { } @Override public void setInsets(WindowInsets insets) { public void setInsets(Rect insets) { if(insets == null) return; InsettableRelativeLayout.LayoutParams lp = (InsettableRelativeLayout.LayoutParams) getLayoutParams(); lp.topMargin = insets.getSystemWindowInsetTop(); lp.topMargin = insets.top; setLayoutParams(lp); updateInsetsForChildren(); this.insets = insets; Loading app/src/main/java/foundation/e/blisslauncher/core/customviews/Insettable.java +4 −3 Original line number Diff line number Diff line package foundation.e.blisslauncher.core.customviews; import android.graphics.Rect; import android.view.View; import android.view.WindowInsets; import androidx.annotation.NonNull; /** * Allows the implementing {@link View} to not draw underneath system bars. Loading @@ -10,5 +11,5 @@ import android.view.WindowInsets; */ public interface Insettable { void setInsets(WindowInsets insets); void setInsets(@NonNull Rect insets); } app/src/main/java/foundation/e/blisslauncher/core/customviews/InsettableFrameLayout.kt +19 −38 Original line number Diff line number Diff line Loading @@ -3,10 +3,8 @@ package foundation.e.blisslauncher.core.customviews import android.content.Context import android.graphics.Rect import android.util.AttributeSet import android.util.Log import android.view.View import android.view.ViewGroup import android.view.WindowInsets import android.widget.FrameLayout import foundation.e.blisslauncher.R Loading @@ -14,9 +12,7 @@ open class InsettableFrameLayout(mContext: Context, attrs: AttributeSet?) : Fram mContext, attrs ), Insettable { var windowInsets: WindowInsets? = null val insets: Rect /*val insets: Rect get() { var tempInsets = Rect() if (this.windowInsets != null) { Loading @@ -26,55 +22,40 @@ open class InsettableFrameLayout(mContext: Context, attrs: AttributeSet?) : Fram tempInsets.bottom = this.windowInsets!!.systemWindowInsetBottom } return tempInsets } }*/ private fun setFrameLayoutChildInsets(child: View, newInsets: WindowInsets?, oldInsets: Rect) { if (newInsets == null) return @JvmField val mInsets = Rect() private fun setFrameLayoutChildInsets(child: View, newInsets: Rect, oldInsets: Rect) { val lp: FrameLayout.LayoutParams = child.layoutParams as FrameLayout.LayoutParams if (child is Insettable) { Log.i("Insettable", "setIsnets for child") (child as Insettable).setInsets(newInsets) } /*else { lp.topMargin += newInsets.systemWindowInsetTop - oldInsets.top lp.leftMargin += newInsets.systemWindowInsetLeft - oldInsets.left lp.rightMargin += newInsets.systemWindowInsetRight - oldInsets.right lp.bottomMargin += newInsets.systemWindowInsetBottom - oldInsets.bottom }*/ child.layoutParams = lp } else { lp.topMargin += newInsets.top - oldInsets.top lp.leftMargin += newInsets.left - oldInsets.left lp.rightMargin += newInsets.right - oldInsets.right lp.bottomMargin += newInsets.bottom - oldInsets.bottom } override fun onApplyWindowInsets(insets: WindowInsets?): WindowInsets? { // BlissLauncher.getApplication(mContext).resetDeviceProfile() setInsets(insets) Log.d("InsettableFrameLayout", "On applyWindowInsets insets with: insets = $tag") return insets child.layoutParams = lp } override fun setInsets(insets: WindowInsets?) { Log.d("InsettableFrameLayout", "Setting insets with: insets = $tag") if (insets == null) return override fun setInsets(insets: Rect) { for (i in 0 until childCount) { val child = getChildAt(i) var oldInsets = Rect() if (this.windowInsets != null) { oldInsets.left = this.windowInsets!!.systemWindowInsetLeft oldInsets.top = this.windowInsets!!.systemWindowInsetTop oldInsets.right = this.windowInsets!!.systemWindowInsetRight oldInsets.bottom = this.windowInsets!!.systemWindowInsetBottom } setFrameLayoutChildInsets(child, insets, oldInsets) setFrameLayoutChildInsets(child, insets, mInsets) } this.windowInsets = insets mInsets.set(insets) } override fun onViewAdded(child: View) { super.onViewAdded(child) setFrameLayoutChildInsets(child, windowInsets, Rect()) setFrameLayoutChildInsets(child, mInsets, Rect()) } companion object { fun dispatchInsets(parent: ViewGroup, insets: WindowInsets) { fun dispatchInsets(parent: ViewGroup, insets: Rect) { val n = parent.childCount for (i in 0 until n) { val child = parent.getChildAt(i) Loading @@ -98,7 +79,7 @@ open class InsettableFrameLayout(mContext: Context, attrs: AttributeSet?) : Fram a.recycle() } constructor(width: Int, height: Int) : super(width, height) {} constructor(lp: ViewGroup.LayoutParams?) : super(lp!!) {} constructor(width: Int, height: Int) : super(width, height) constructor(lp: ViewGroup.LayoutParams?) : super(lp!!) } } Loading
app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurBackgroundView.kt +2 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package foundation.e.blisslauncher.core.customviews import android.content.Context import android.graphics.Canvas import android.graphics.Rect import android.graphics.drawable.Drawable import android.util.AttributeSet import android.view.View Loading Loading @@ -76,5 +77,5 @@ class BlurBackgroundView(context: Context, attrs: AttributeSet?) : View(context, createFullBlurDrawable() } override fun setInsets(insets: WindowInsets) {} override fun setInsets(insets: Rect) {} }
app/src/main/java/foundation/e/blisslauncher/core/customviews/DockGridLayout.kt +4 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package foundation.e.blisslauncher.core.customviews import android.content.Context import android.graphics.Canvas import android.graphics.Rect import android.graphics.drawable.Drawable import android.util.AttributeSet import android.view.WindowInsets Loading Loading @@ -73,15 +74,15 @@ class DockGridLayout @JvmOverloads constructor( } } override fun setInsets(insets: WindowInsets?) { override fun setInsets(insets: Rect) { if (insets == null) return val deviceProfile = BlissLauncher.getApplication(context).deviceProfile val lp = layoutParams as InsettableRelativeLayout.LayoutParams lp.height = deviceProfile.hotseatCellHeightPx + insets.systemWindowInsetBottom lp.height = deviceProfile.hotseatCellHeightPx + insets.bottom setPadding( deviceProfile.iconDrawablePaddingPx / 2, 0, deviceProfile.iconDrawablePaddingPx / 2, insets.systemWindowInsetBottom deviceProfile.iconDrawablePaddingPx / 2, insets.bottom ) layoutParams = lp } Loading
app/src/main/java/foundation/e/blisslauncher/core/customviews/HorizontalPager.java +3 −3 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class HorizontalPager extends ViewGroup implements Insettable { private Set<OnScrollListener> mListeners = new HashSet<>(); private boolean mIsUiCreated; private GestureDetectorCompat gestureDetectorCompat; private WindowInsets insets; private Rect insets; private float mLastMotionRawY; public HorizontalPager(Context context, AttributeSet attrs) { Loading Loading @@ -540,10 +540,10 @@ public class HorizontalPager extends ViewGroup implements Insettable { } @Override public void setInsets(WindowInsets insets) { public void setInsets(Rect insets) { if(insets == null) return; InsettableRelativeLayout.LayoutParams lp = (InsettableRelativeLayout.LayoutParams) getLayoutParams(); lp.topMargin = insets.getSystemWindowInsetTop(); lp.topMargin = insets.top; setLayoutParams(lp); updateInsetsForChildren(); this.insets = insets; Loading
app/src/main/java/foundation/e/blisslauncher/core/customviews/Insettable.java +4 −3 Original line number Diff line number Diff line package foundation.e.blisslauncher.core.customviews; import android.graphics.Rect; import android.view.View; import android.view.WindowInsets; import androidx.annotation.NonNull; /** * Allows the implementing {@link View} to not draw underneath system bars. Loading @@ -10,5 +11,5 @@ import android.view.WindowInsets; */ public interface Insettable { void setInsets(WindowInsets insets); void setInsets(@NonNull Rect insets); }
app/src/main/java/foundation/e/blisslauncher/core/customviews/InsettableFrameLayout.kt +19 −38 Original line number Diff line number Diff line Loading @@ -3,10 +3,8 @@ package foundation.e.blisslauncher.core.customviews import android.content.Context import android.graphics.Rect import android.util.AttributeSet import android.util.Log import android.view.View import android.view.ViewGroup import android.view.WindowInsets import android.widget.FrameLayout import foundation.e.blisslauncher.R Loading @@ -14,9 +12,7 @@ open class InsettableFrameLayout(mContext: Context, attrs: AttributeSet?) : Fram mContext, attrs ), Insettable { var windowInsets: WindowInsets? = null val insets: Rect /*val insets: Rect get() { var tempInsets = Rect() if (this.windowInsets != null) { Loading @@ -26,55 +22,40 @@ open class InsettableFrameLayout(mContext: Context, attrs: AttributeSet?) : Fram tempInsets.bottom = this.windowInsets!!.systemWindowInsetBottom } return tempInsets } }*/ private fun setFrameLayoutChildInsets(child: View, newInsets: WindowInsets?, oldInsets: Rect) { if (newInsets == null) return @JvmField val mInsets = Rect() private fun setFrameLayoutChildInsets(child: View, newInsets: Rect, oldInsets: Rect) { val lp: FrameLayout.LayoutParams = child.layoutParams as FrameLayout.LayoutParams if (child is Insettable) { Log.i("Insettable", "setIsnets for child") (child as Insettable).setInsets(newInsets) } /*else { lp.topMargin += newInsets.systemWindowInsetTop - oldInsets.top lp.leftMargin += newInsets.systemWindowInsetLeft - oldInsets.left lp.rightMargin += newInsets.systemWindowInsetRight - oldInsets.right lp.bottomMargin += newInsets.systemWindowInsetBottom - oldInsets.bottom }*/ child.layoutParams = lp } else { lp.topMargin += newInsets.top - oldInsets.top lp.leftMargin += newInsets.left - oldInsets.left lp.rightMargin += newInsets.right - oldInsets.right lp.bottomMargin += newInsets.bottom - oldInsets.bottom } override fun onApplyWindowInsets(insets: WindowInsets?): WindowInsets? { // BlissLauncher.getApplication(mContext).resetDeviceProfile() setInsets(insets) Log.d("InsettableFrameLayout", "On applyWindowInsets insets with: insets = $tag") return insets child.layoutParams = lp } override fun setInsets(insets: WindowInsets?) { Log.d("InsettableFrameLayout", "Setting insets with: insets = $tag") if (insets == null) return override fun setInsets(insets: Rect) { for (i in 0 until childCount) { val child = getChildAt(i) var oldInsets = Rect() if (this.windowInsets != null) { oldInsets.left = this.windowInsets!!.systemWindowInsetLeft oldInsets.top = this.windowInsets!!.systemWindowInsetTop oldInsets.right = this.windowInsets!!.systemWindowInsetRight oldInsets.bottom = this.windowInsets!!.systemWindowInsetBottom } setFrameLayoutChildInsets(child, insets, oldInsets) setFrameLayoutChildInsets(child, insets, mInsets) } this.windowInsets = insets mInsets.set(insets) } override fun onViewAdded(child: View) { super.onViewAdded(child) setFrameLayoutChildInsets(child, windowInsets, Rect()) setFrameLayoutChildInsets(child, mInsets, Rect()) } companion object { fun dispatchInsets(parent: ViewGroup, insets: WindowInsets) { fun dispatchInsets(parent: ViewGroup, insets: Rect) { val n = parent.childCount for (i in 0 until n) { val child = parent.getChildAt(i) Loading @@ -98,7 +79,7 @@ open class InsettableFrameLayout(mContext: Context, attrs: AttributeSet?) : Fram a.recycle() } constructor(width: Int, height: Int) : super(width, height) {} constructor(lp: ViewGroup.LayoutParams?) : super(lp!!) {} constructor(width: Int, height: Int) : super(width, height) constructor(lp: ViewGroup.LayoutParams?) : super(lp!!) } }