Skip to content

Commit

Permalink
Revert insets changes
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Dec 29, 2022
1 parent e7ecbe6 commit b5c8a05
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@
package space.celestia.mobilecelestia.common

import android.content.res.Configuration
import androidx.core.view.DisplayCutoutCompat
import androidx.core.view.WindowInsetsCompat
import kotlin.math.max

class EdgeInsets(val left: Int = 0, val top: Int = 0, val right: Int = 0, val bottom: Int = 0) {
constructor(insets: WindowInsetsCompat?) : this(
insets?.stableInsetLeft ?: 0,
insets?.stableInsetTop ?: 0,
insets?.stableInsetRight ?: 0,
insets?.stableInsetBottom ?: 0)
constructor(insets: WindowInsetsCompat?) : this(insets?.displayCutout)

constructor(cutout: DisplayCutoutCompat?) : this(
cutout?.safeInsetLeft ?: 0,
cutout?.safeInsetTop ?: 0,
cutout?.safeInsetRight ?: 0,
cutout?.safeInsetBottom ?: 0)

constructor(edgeInsets: EdgeInsets, roundedCorners: RoundedCorners, configuration: Configuration) : this(
if (configuration.orientation == Configuration.ORIENTATION_PORTRAIT) edgeInsets.left else max(edgeInsets.left, max(roundedCorners.topLeft, roundedCorners.bottomLeft)),
Expand Down

0 comments on commit b5c8a05

Please sign in to comment.