diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt b/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt index 9c71461a0702..0092667d2b9e 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt @@ -58,6 +58,7 @@ import androidx.appcompat.app.AlertDialog import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.TooltipCompat +import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback import androidx.core.content.edit @@ -2207,12 +2208,23 @@ open class DeckPicker : dueTree = result launchCatchingTask { renderPage(collectionHasNoCards) } // Update the mini statistics bar as well - reviewSummaryTextView.setSingleLine() launchCatchingTask { reviewSummaryTextView.text = withCol { - sched.studiedToday() + // Backend returns studiedToday() with newlines for HTML formatting,so we replace them with spaces. + sched.studiedToday().replace("\n", " ") } + val fabLinearLayout = findViewById(R.id.fabLinearLayout) + // OnPreDrawListener make sure to execute logic before view is drawn + reviewSummaryTextView.viewTreeObserver.addOnPreDrawListener { + // Adjust bottom margin of fabLinearLayout based on reviewSummaryTextView height + if (reviewSummaryTextView.lineCount > 1) { + val layoutParams = fabLinearLayout.layoutParams as CoordinatorLayout.LayoutParams + layoutParams.setMargins(0, 0, 0, reviewSummaryTextView.height / 2) + fabLinearLayout.layoutParams = layoutParams + } + true + } } Timber.d("Startup - Deck List UI Completed") } diff --git a/AnkiDroid/src/main/res/layout/deck_picker.xml b/AnkiDroid/src/main/res/layout/deck_picker.xml index 1d31f141cfad..f5bce585d22f 100644 --- a/AnkiDroid/src/main/res/layout/deck_picker.xml +++ b/AnkiDroid/src/main/res/layout/deck_picker.xml @@ -46,6 +46,10 @@