Skip to content

Commit

Permalink
Improve button behaviour in book detail pages slightly
Browse files Browse the repository at this point in the history
This ensures that button text is ellipsized and buttons only ever have
a single line of text. This at least stops buttons causing havoc on
very small screens.

Affects: https://ebce-lyrasis.atlassian.net/browse/PP-631
  • Loading branch information
io7m committed Oct 25, 2023
1 parent c43fa22 commit 13305d6
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.librarysimplified.ui.catalog

import android.content.Context
import android.content.res.ColorStateList
import android.text.TextUtils
import android.util.TypedValue
import android.view.Gravity
import android.view.View
Expand Down Expand Up @@ -73,6 +74,8 @@ class CatalogButtons(
button.text = this.context.getString(text)
button.contentDescription = this.context.getString(description)
button.layoutParams = this.buttonLayoutParameters(heightMatchParent)
button.maxLines = 1
button.ellipsize = TextUtils.TruncateAt.END
button.setOnClickListener {
button.isEnabled = false
onClick.invoke(button)
Expand Down

0 comments on commit 13305d6

Please sign in to comment.