Fixed dimensions and padding throughout the homescreen
This commit is contained in:
parent
823b121cc7
commit
1d64ddb7f5
@ -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<ViewGroup.MarginLayoutParams> {
|
||||
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
|
||||
}
|
@ -81,6 +81,7 @@
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@{viewModel.insets.bottom + (int) @dimen/l1}"
|
||||
app:fabSize="normal"
|
||||
app:layout_anchor="@+id/main_bottom_bar"
|
||||
app:srcCompat="@drawable/ic_superuser_md2" />
|
||||
|
@ -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">
|
||||
|
||||
<LinearLayout
|
||||
@ -255,11 +258,12 @@
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
itemBinding="@{viewModel.itemBinding}"
|
||||
items="@{viewModel.itemsMainline}"
|
||||
nestedScrollingEnabled="@{false}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:fadingEdgeLength="@dimen/l1"
|
||||
items="@{viewModel.itemsMainline}"
|
||||
android:layout_width="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="@dimen/l1"
|
||||
android:requiresFadingEdge="horizontal"
|
||||
@ -291,11 +295,11 @@
|
||||
style="?styleCardNormal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
android:layout_marginEnd="@dimen/l1"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/support_icon_dia"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
@ -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" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
itemBinding="@{viewModel.itemBinding}"
|
||||
items="@{viewModel.itemsApp}"
|
||||
nestedScrollingEnabled="@{false}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
items="@{viewModel.itemsApp}"
|
||||
android:layout_width="wrap_content"
|
||||
android:fadingEdgeLength="@dimen/l1"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="@dimen/l1"
|
||||
@ -361,9 +366,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/l1"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/support_icon_common"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
@ -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" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
itemBinding="@{viewModel.itemBinding}"
|
||||
items="@{viewModel.itemsProject}"
|
||||
nestedScrollingEnabled="@{false}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:fadingEdgeLength="@dimen/l1"
|
||||
items="@{viewModel.itemsProject}"
|
||||
android:layout_width="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="@dimen/l1"
|
||||
android:requiresFadingEdge="horizontal"
|
||||
|
@ -46,7 +46,6 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
style="?styleImageSmall"
|
||||
android:layout_marginStart="@dimen/l_50"
|
||||
android:layout_height="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/developer_link_name"
|
||||
app:layout_constraintStart_toEndOf="@+id/developer_link_name"
|
||||
|
@ -16,4 +16,7 @@
|
||||
<dimen name="l2">32dp</dimen>
|
||||
|
||||
<dimen name="r1">8dp</dimen>
|
||||
|
||||
<!--l1 + fab size-->
|
||||
<dimen name="margin_fab">80dp</dimen>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user