main: band-aid bottom sheets flipping out pre-30
Caused by busted legacy window insets behavior biting me again.
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
package org.oxycblt.auxio.ui
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.WindowInsets
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import androidx.annotation.AttrRes
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A [FrameLayout] that works around the pre-Android 10 behavior of propagating
|
||||||
|
* mutated insets to sibling views. Wrap this around views that to isolate
|
||||||
|
* mutated window insets.
|
||||||
|
*
|
||||||
|
* @author Alexander Capehart (OxygenCobalt)
|
||||||
|
*/
|
||||||
|
class EatInsetsFrameLayout
|
||||||
|
@JvmOverloads
|
||||||
|
constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr: Int = 0) :
|
||||||
|
FrameLayout(context, attrs, defStyleAttr) {
|
||||||
|
init {
|
||||||
|
clipToPadding = false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispatchApplyWindowInsets(insets: WindowInsets): WindowInsets {
|
||||||
|
super.dispatchApplyWindowInsets(insets)
|
||||||
|
return insets
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-2
@@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.oxycblt.auxio.home
|
package org.oxycblt.auxio.ui
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
@@ -40,8 +40,8 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onApplyWindowInsets(insets: WindowInsets): WindowInsets {
|
override fun onApplyWindowInsets(insets: WindowInsets): WindowInsets {
|
||||||
// Prevent excessive layouts by using translation instead of padding.
|
|
||||||
updatePadding(bottom = insets.systemBarInsetsCompat.bottom)
|
updatePadding(bottom = insets.systemBarInsetsCompat.bottom)
|
||||||
return insets
|
return insets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
android:background="?attr/colorSurface">
|
android:background="?attr/colorSurface">
|
||||||
|
|
||||||
|
|
||||||
<FrameLayout
|
<org.oxycblt.auxio.ui.EatInsetsFrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="org.oxycblt.auxio.ui.BottomSheetContentBehavior">
|
app:layout_behavior="org.oxycblt.auxio.ui.BottomSheetContentBehavior">
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
tools:layout="@layout/fragment_home" />
|
tools:layout="@layout/fragment_home" />
|
||||||
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.home.EdgeFrameLayout
|
<org.oxycblt.auxio.ui.EdgeFrameLayout
|
||||||
android:id="@+id/main_fab_container"
|
android:id="@+id/main_fab_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -55,9 +55,9 @@
|
|||||||
android:contentDescription="@string/lbl_shuffle"
|
android:contentDescription="@string/lbl_shuffle"
|
||||||
android:src="@drawable/ic_shuffle_off_24" />
|
android:src="@drawable/ic_shuffle_off_24" />
|
||||||
|
|
||||||
</org.oxycblt.auxio.home.EdgeFrameLayout>
|
</org.oxycblt.auxio.ui.EdgeFrameLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</org.oxycblt.auxio.ui.EatInsetsFrameLayout>
|
||||||
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
tools:listitem="@layout/item_song" />
|
tools:listitem="@layout/item_song" />
|
||||||
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.home.EdgeFrameLayout
|
<org.oxycblt.auxio.ui.EdgeFrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
@@ -53,5 +53,5 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</org.oxycblt.auxio.home.EdgeFrameLayout>
|
</org.oxycblt.auxio.ui.EdgeFrameLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
android:background="?attr/colorSurface"
|
android:background="?attr/colorSurface"
|
||||||
android:transitionGroup="true">
|
android:transitionGroup="true">
|
||||||
|
|
||||||
<FrameLayout
|
<org.oxycblt.auxio.ui.EatInsetsFrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="org.oxycblt.auxio.ui.BottomSheetContentBehavior">
|
app:layout_behavior="org.oxycblt.auxio.ui.BottomSheetContentBehavior">
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:visibility="invisible" />
|
android:visibility="invisible" />
|
||||||
|
|
||||||
<org.oxycblt.auxio.home.EdgeFrameLayout
|
<org.oxycblt.auxio.ui.EdgeFrameLayout
|
||||||
android:id="@+id/main_fab_container"
|
android:id="@+id/main_fab_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -60,9 +60,9 @@
|
|||||||
android:contentDescription="@string/lbl_shuffle"
|
android:contentDescription="@string/lbl_shuffle"
|
||||||
android:src="@drawable/ic_shuffle_off_24" />
|
android:src="@drawable/ic_shuffle_off_24" />
|
||||||
|
|
||||||
</org.oxycblt.auxio.home.EdgeFrameLayout>
|
</org.oxycblt.auxio.ui.EdgeFrameLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</org.oxycblt.auxio.ui.EatInsetsFrameLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/main_sheet_scrim"
|
android:id="@+id/main_sheet_scrim"
|
||||||
|
|||||||
+1
-1
Submodule media updated: 4b3084e1b6...9a0e432c08
Reference in New Issue
Block a user