Fix and simplify layout

This commit is contained in:
tarsin committed 2023-03-12 14:03:10 +08:00
1 parent d920e8705f
commit 8708897751
3 files changed
+17 -52

No files matched your search

@@ -407,8 +407,7 @@ class GalleryDetailScene : CollapsingToolbarScene(), View.OnClickListener, Downl
} else {
binding.content.comments.comments.visibility = View.GONE
}
binding.content.previews.previews.setOnClickListener { navigateToPreview() }
binding.content.previews.recyclerView.run {
binding.content.recyclerView.run {
previewsAdapter = GalleryPreviewsAdapter {
mainActivity!!.startReaderActivity(mGalleryDetail!!, it.position)
}
@@ -728,18 +727,16 @@ class GalleryDetailScene : CollapsingToolbarScene(), View.OnClickListener, Downl
private fun bindPreviews(gd: GalleryDetail) {
_binding ?: return
binding.content.previews.run {
val previewList = gd.previewList
if (gd.previewPages <= 0 || previewList.isEmpty()) {
footerAdapter?.text = getString(R.string.no_previews)
return
} else if (gd.previewPages == 1) {
footerAdapter?.text = getString(R.string.no_more_previews)
} else {
footerAdapter?.text = getString(R.string.more_previews)
}
previewsAdapter?.submitList(previewList)
val previewList = gd.previewList
if (gd.previewPages <= 0 || previewList.isEmpty()) {
footerAdapter?.text = getString(R.string.no_previews)
return
} else if (gd.previewPages == 1) {
footerAdapter?.text = getString(R.string.no_more_previews)
} else {
footerAdapter?.text = getString(R.string.more_previews)
}
previewsAdapter?.submitList(previewList)
}
private fun getAllRatingText(rating: Float, ratingCount: Int): String {
@@ -15,6 +15,7 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
@@ -45,9 +46,12 @@
android:id="@+id/comments"
layout="@layout/gallery_detail_comments" />
<include
android:id="@+id/previews"
layout="@layout/gallery_detail_previews" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
app:fitsSystemWindowsInsets="bottom" />
</LinearLayout>
@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2015 Hippo Seven
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/previews"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:clickable="true"
android:divider="@drawable/spacer_keyline"
android:focusable="true"
android:orientation="vertical"
android:padding="@dimen/keyline_margin"
android:showDividers="middle"
app:fitsSystemWindowsInsets="bottom">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>