mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Center big appbar icon for multi line titles
This commit is contained in:
parent
643061dd72
commit
2e143b35fc
4 changed files with 41 additions and 23 deletions
|
@ -43,6 +43,7 @@ class ExpandedAppBarLayout@JvmOverloads constructor(context: Context, attrs: Att
|
|||
val preferences: PreferencesHelper by injectLazy()
|
||||
var bigView: View? = null
|
||||
var imageView: ImageView? = null
|
||||
var imageLayout: FrameLayout? = null
|
||||
private var tabsFrameLayout: FrameLayout? = null
|
||||
var mainActivity: MainActivity? = null
|
||||
private var isExtraSmall = false
|
||||
|
@ -183,6 +184,7 @@ class ExpandedAppBarLayout@JvmOverloads constructor(context: Context, attrs: Att
|
|||
cardFrame = findViewById(R.id.card_frame)
|
||||
tabsFrameLayout = findViewById(R.id.tabs_frame_layout)
|
||||
imageView = findViewById(R.id.big_icon)
|
||||
imageLayout = findViewById(R.id.big_icon_layout)
|
||||
shrinkAppBarIfNeeded(resources.configuration)
|
||||
}
|
||||
|
||||
|
@ -244,6 +246,9 @@ class ExpandedAppBarLayout@JvmOverloads constructor(context: Context, attrs: Att
|
|||
height = 48.dpToPx
|
||||
width = 48.dpToPx
|
||||
}
|
||||
imageLayout?.updateLayoutParams<MarginLayoutParams> {
|
||||
height = 48.dpToPx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) :
|
|||
(activity as? AppCompatActivity)?.title = getTitle()
|
||||
(activity as? MainActivity)?.searchTitle = getSearchTitle()
|
||||
val icon = getBigIcon()
|
||||
activityBinding?.bigIcon?.isVisible = icon != null
|
||||
activityBinding?.bigIconLayout?.isVisible = icon != null
|
||||
if (icon != null) {
|
||||
activityBinding?.bigIcon?.setImageDrawable(getBigIcon())
|
||||
} else {
|
||||
|
|
|
@ -63,18 +63,26 @@
|
|||
android:paddingBottom="12dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/big_icon_layout"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintHeight_min="wrap"
|
||||
app:layout_constraintVertical_bias="1.0"
|
||||
android:layout_marginStart="16dp"
|
||||
app:layout_constraintTop_toTopOf="@id/big_title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/big_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/big_title">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/big_icon"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
tools:srcCompat="@mipmap/ic_launcher"
|
||||
app:layout_constraintBottom_toBottomOf="@id/big_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/big_title"
|
||||
android:layout_marginStart="16dp"
|
||||
/>
|
||||
android:layout_gravity="center"
|
||||
tools:srcCompat="@mipmap/ic_launcher" />
|
||||
</FrameLayout>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/big_title"
|
||||
|
@ -86,7 +94,7 @@
|
|||
android:layout_marginTop="52dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@id/big_icon"
|
||||
app:layout_constraintStart_toEndOf="@id/big_icon_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:drawableTint="?actionBarTintColor"
|
||||
|
|
|
@ -51,8 +51,6 @@
|
|||
android:maxLines="1"
|
||||
android:textColor="?actionBarTintColor"
|
||||
android:textSize="20sp"
|
||||
tools:drawableEnd="@drawable/ic_arrow_drop_down_24dp"
|
||||
tools:drawableStart="@drawable/ic_blank_24dp"
|
||||
tools:text="Title Text" />
|
||||
</eu.kanade.tachiyomi.ui.base.CenteredToolbar>
|
||||
|
||||
|
@ -62,19 +60,26 @@
|
|||
android:paddingBottom="12dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/big_icon"
|
||||
<FrameLayout
|
||||
android:id="@+id/big_icon_layout"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
tools:srcCompat="@mipmap/ic_launcher"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintHeight_min="wrap"
|
||||
app:layout_constraintVertical_bias="1.0"
|
||||
android:layout_marginStart="16dp"
|
||||
app:layout_constraintTop_toTopOf="@id/big_title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/big_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/big_title"
|
||||
android:layout_marginStart="16dp"
|
||||
/>
|
||||
|
||||
app:layout_constraintEnd_toStartOf="@id/big_title">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/big_icon"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_gravity="center"
|
||||
tools:srcCompat="@mipmap/ic_launcher" />
|
||||
</FrameLayout>
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/big_title"
|
||||
android:paddingStart="16dp"
|
||||
|
@ -85,14 +90,14 @@
|
|||
android:layout_marginTop="52dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@id/big_icon"
|
||||
app:layout_constraintStart_toEndOf="@id/big_icon_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:drawableTint="?actionBarTintColor"
|
||||
android:ellipsize="end"
|
||||
android:layout_gravity="start"
|
||||
android:textColor="?actionBarTintColor"
|
||||
tools:text="Title Text" />
|
||||
tools:text="Big Title" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<FrameLayout
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue