From e79f8b7e5a697a3ea4deddf57efaa02add436a29 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 6 Nov 2019 11:12:57 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/widget/page/ContentView.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt index 15f3c5127..4f371949d 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt @@ -5,6 +5,7 @@ import android.content.Context import android.graphics.Typeface import android.graphics.drawable.Drawable import android.util.AttributeSet +import android.view.Gravity import android.widget.FrameLayout import android.widget.ImageView import androidx.appcompat.widget.AppCompatImageView @@ -102,10 +103,16 @@ class ContentView : FrameLayout { } fun setContent(textPage: TextPage?) { - content_text_view.text = textPage?.text - tv_bottom_left.text = textPage?.title - pageSize = textPage?.pageSize ?: 0 - setPageIndex(textPage?.index) + if (textPage != null) { + content_text_view.gravity = Gravity.START + content_text_view.text = textPage.text + tv_bottom_left.text = textPage.title + pageSize = textPage.pageSize + setPageIndex(textPage.index) + } else { + content_text_view.gravity = Gravity.CENTER + content_text_view.setText(R.string.data_loading) + } } @SuppressLint("SetTextI18n")