diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt b/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt index b7efa39f6..d08a20702 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt +++ b/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt @@ -1,6 +1,7 @@ package com.topjohnwu.magisk.utils import android.view.View +import android.view.ViewGroup import android.widget.TextSwitcher import android.widget.TextView import android.widget.ViewSwitcher @@ -9,6 +10,7 @@ import androidx.annotation.DrawableRes import androidx.appcompat.widget.AppCompatImageView import androidx.appcompat.widget.Toolbar import androidx.core.view.postDelayed +import androidx.core.view.updateLayoutParams import androidx.databinding.BindingAdapter import androidx.databinding.InverseBindingAdapter import androidx.databinding.InverseBindingListener @@ -265,4 +267,28 @@ fun TextSwitcher.setTextBinding(text: CharSequence) { if (currentText != text) { setText(text) } +} + +@BindingAdapter( + "android:layout_marginLeft", + "android:layout_marginTop", + "android:layout_marginRight", + "android:layout_marginBottom", + requireAll = false +) +fun View.setMargins( + marginLeft: Int?, + marginTop: Int?, + marginRight: Int?, + marginBottom: Int? +) = updateLayoutParams { + marginLeft?.let { leftMargin = it } + marginTop?.let { topMargin = it } + marginRight?.let { rightMargin = it } + marginBottom?.let { bottomMargin = it } +} + +@BindingAdapter("nestedScrollingEnabled") +fun RecyclerView.setNestedScrolling(enabled: Boolean) { + isNestedScrollingEnabled = enabled } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main_md2.xml b/app/src/main/res/layout/activity_main_md2.xml index 06cb7d3bd..02cd771a3 100644 --- a/app/src/main/res/layout/activity_main_md2.xml +++ b/app/src/main/res/layout/activity_main_md2.xml @@ -81,6 +81,7 @@ diff --git a/app/src/main/res/layout/fragment_home_md2.xml b/app/src/main/res/layout/fragment_home_md2.xml index 141d18422..22a49a23a 100644 --- a/app/src/main/res/layout/fragment_home_md2.xml +++ b/app/src/main/res/layout/fragment_home_md2.xml @@ -17,7 +17,10 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" - android:padding="@dimen/l1" + android:paddingStart="@dimen/l1" + android:paddingTop="@dimen/l1" + android:paddingEnd="@dimen/l1" + android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/margin_fab}" tools:layout_marginTop="24dp"> @@ -309,17 +313,18 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end" + android:text="\@diareuse" android:textAppearance="?appearanceTextCaptionNormal" android:textStyle="bold" - android:text="\@diareuse" tools:ignore="HardcodedText" /> @@ -377,17 +382,18 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="sans-serif-black" + android:text="@string/home_links_project" android:textAppearance="?appearanceTextCaptionNormal" - android:textStyle="bold" - android:text="@string/home_links_project" /> + android:textStyle="bold" /> 32dp 8dp + + + 80dp \ No newline at end of file