diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt index 9482e32fe..216d6420c 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt @@ -29,7 +29,6 @@ import io.legado.app.utils.getViewModelOfActivity import io.legado.app.utils.observeEvent import io.legado.app.utils.startActivity import kotlinx.android.synthetic.main.fragment_books.* -import kotlinx.android.synthetic.main.view_empty.* import org.jetbrains.anko.startActivity import kotlin.math.max @@ -110,7 +109,7 @@ class BooksFragment : BaseFragment(R.layout.fragment_books), else -> App.db.bookDao().observeByGroup(groupId) } bookshelfLiveData?.observe(this, { list -> - vw_empty.isGone = list.isNotEmpty() + tv_empty_msg.isGone = list.isNotEmpty() val books = when (getPrefInt(PreferKey.bookshelfSort)) { 1 -> list.sortedByDescending { it.latestChapterTime } 2 -> list.sortedBy { it.name } diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt index bceb905d1..610516a64 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt @@ -6,6 +6,7 @@ import android.view.MenuItem import android.view.SubMenu import android.view.View import androidx.appcompat.widget.SearchView +import androidx.core.view.isGone import androidx.lifecycle.LiveData import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.LinearLayoutManager @@ -43,6 +44,7 @@ class ExploreFragment : VMBaseFragment(R.layout.fragment_find_ override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { setSupportToolbar(toolbar) + tv_empty_msg.text = "当前没有发现源,关注公众号[开源阅读]添加带发现的书源!" initSearchView() initRecyclerView() initGroupData() @@ -111,6 +113,7 @@ class ExploreFragment : VMBaseFragment(R.layout.fragment_find_ App.db.bookSourceDao().liveExplore("%$key%") } liveExplore?.observe(viewLifecycleOwner, { + tv_empty_msg.isGone = it.isNotEmpty() val diffResult = DiffUtil .calculateDiff(ExploreDiffCallBack(ArrayList(adapter.getItems()), it)) adapter.setItems(it) diff --git a/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt b/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt index 39e1cd441..2143b4e48 100644 --- a/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt +++ b/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt @@ -138,23 +138,24 @@ class TitleBar(context: Context, attrs: AttributeSet?) : AppBarLayout(context, a } } - if (a.getBoolean(R.styleable.TitleBar_fitStatusBar, true)) { - topPadding = context.statusBarHeight - } + if (!isInEditMode) { + if (a.getBoolean(R.styleable.TitleBar_fitStatusBar, true)) { + topPadding = context.statusBarHeight + } - if (a.getBoolean(R.styleable.TitleBar_fitNavigationBar, false)) { - bottomPadding = context.navigationBarHeight - } + if (a.getBoolean(R.styleable.TitleBar_fitNavigationBar, false)) { + bottomPadding = context.navigationBarHeight + } - backgroundColor = context.primaryColor + backgroundColor = context.primaryColor - stateListAnimator = null - elevation = if (AppConfig.elevation < 0) { - context.elevation - } else { - AppConfig.elevation.toFloat() + stateListAnimator = null + elevation = if (AppConfig.elevation < 0) { + context.elevation + } else { + AppConfig.elevation.toFloat() + } } - a.recycle() } diff --git a/app/src/main/res/layout/fragment_books.xml b/app/src/main/res/layout/fragment_books.xml index 76a26a844..9ad51b407 100644 --- a/app/src/main/res/layout/fragment_books.xml +++ b/app/src/main/res/layout/fragment_books.xml @@ -17,7 +17,15 @@ - + diff --git a/app/src/main/res/layout/fragment_find_book.xml b/app/src/main/res/layout/fragment_find_book.xml index 8609db403..826d713ad 100644 --- a/app/src/main/res/layout/fragment_find_book.xml +++ b/app/src/main/res/layout/fragment_find_book.xml @@ -1,6 +1,7 @@ - @@ -17,6 +18,22 @@ + android:layout_height="0dp" + app:layout_constraintTop_toBottomOf="@+id/title_bar" + app:layout_constraintBottom_toBottomOf="parent" + tools:listitem="@layout/item_find_book" /> - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_find_book.xml b/app/src/main/res/layout/item_find_book.xml index 5ee810333..61ce006c7 100644 --- a/app/src/main/res/layout/item_find_book.xml +++ b/app/src/main/res/layout/item_find_book.xml @@ -24,7 +24,8 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:textColor="@color/primaryText" /> + android:textColor="@color/primaryText" + tools:text="起点中文" /> - - - - - \ No newline at end of file