Cleanup and fixes

This commit is contained in:
Jobobby04 2021-10-18 23:09:26 -04:00
parent 14d6e8dd94
commit 2f203f7a1d
11 changed files with 31 additions and 136 deletions

View File

@ -321,7 +321,7 @@ class MangaPresenter(
withUIContext { view?.onFetchMangaInfoDone() } withUIContext { view?.onFetchMangaInfoDone() }
} catch (e: Throwable) { } catch (e: Throwable) {
xLogE("Error getting manga details", e) this@MangaPresenter.xLogE("Error getting manga details", e)
withUIContext { view?.onFetchMangaInfoError(e) } withUIContext { view?.onFetchMangaInfoError(e) }
} }
} }

View File

@ -392,16 +392,6 @@ class MangaInfoHeaderAdapter(
// Update description TextView. // Update description TextView.
binding.mangaSummaryText.text = updateDescription(manga.description, (fromSource || isTablet).not()) binding.mangaSummaryText.text = updateDescription(manga.description, (fromSource || isTablet).not())
// SY -->
if (manga.description == "meta") {
binding.mangaSummaryText.text = ""
/*binding.mangaInfoToggleLess.updateLayoutParams<ConstraintLayout.LayoutParams> {
topToBottom = -1
bottomToBottom = binding.mangaSummaryText.id
}*/
}
// SY <--
// Update genres list // Update genres list
if (!manga.genre.isNullOrBlank()) { if (!manga.genre.isNullOrBlank()) {
binding.mangaGenresTagsCompactChips.setChips( binding.mangaGenresTagsCompactChips.setChips(
@ -484,6 +474,9 @@ class MangaInfoHeaderAdapter(
private fun updateDescription(description: String?, isCurrentlyExpanded: Boolean): CharSequence { private fun updateDescription(description: String?, isCurrentlyExpanded: Boolean): CharSequence {
return when { return when {
description.isNullOrBlank() -> view.context.getString(R.string.unknown) description.isNullOrBlank() -> view.context.getString(R.string.unknown)
// SY -->
description == "meta" -> ""
// SY <--
isCurrentlyExpanded -> isCurrentlyExpanded ->
description description
.replace(Regex(" +\$", setOf(RegexOption.MULTILINE)), "") .replace(Regex(" +\$", setOf(RegexOption.MULTILINE)), "")

View File

@ -106,11 +106,11 @@ class HttpPageLoader(
ReaderPage(index, page.url, page.imageUrl) ReaderPage(index, page.url, page.imageUrl)
} }
if (preferences.aggressivePageLoading().get()) { if (preferences.aggressivePageLoading().get()) {
rp.mapNotNull { rp.forEach {
if (it.status == Page.QUEUE) { if (it.status == Page.QUEUE) {
PriorityPage(it, 0) queue.offer(PriorityPage(it, 0))
} else null }
}.forEach { queue.offer(it) } }
} }
rp rp
// SY <-- // SY <--

View File

@ -51,10 +51,12 @@ class SettingsLibraryController : SettingsController() {
private val db: DatabaseHelper = Injekt.get() private val db: DatabaseHelper = Injekt.get()
private val trackManager: TrackManager by injectLazy() private val trackManager: TrackManager by injectLazy()
// SY -->
/** /**
* Sheet containing filter/sort/display items. * Sheet containing filter/sort/display items.
*/ */
private var settingsSheet: LibrarySettingsSheet? = null private var settingsSheet: LibrarySettingsSheet? = null
// SY <--
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply { override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
titleRes = R.string.pref_category_library titleRes = R.string.pref_category_library

View File

@ -71,6 +71,7 @@ class SettingsReaderController : SettingsController() {
summaryRes = R.string.pref_show_navigation_mode_summary summaryRes = R.string.pref_show_navigation_mode_summary
defaultValue = false defaultValue = false
} }
// SY -->
switchPreference { switchPreference {
key = Keys.forceHorizontalSeekbar key = Keys.forceHorizontalSeekbar
titleRes = R.string.pref_force_horz_seekbar titleRes = R.string.pref_force_horz_seekbar
@ -91,6 +92,7 @@ class SettingsReaderController : SettingsController() {
defaultValue = false defaultValue = false
preferences.forceHorizontalSeekbar().asImmediateFlow { isVisible = !it }.launchIn(viewScope) preferences.forceHorizontalSeekbar().asImmediateFlow { isVisible = !it }.launchIn(viewScope)
} }
// SY <--
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
switchPreference { switchPreference {
key = Keys.trueColor key = Keys.trueColor
@ -410,6 +412,7 @@ class SettingsReaderController : SettingsController() {
} }
} }
// SY -->
preferenceCategory { preferenceCategory {
titleRes = R.string.page_downloading titleRes = R.string.page_downloading
@ -499,7 +502,6 @@ class SettingsReaderController : SettingsController() {
} }
} }
// EXH -->
preferenceCategory { preferenceCategory {
titleRes = R.string.pref_category_fork titleRes = R.string.pref_category_fork
@ -550,9 +552,10 @@ class SettingsReaderController : SettingsController() {
preferences.pageLayout().asImmediateFlow { isVisible = it != PagerConfig.PageLayout.SINGLE_PAGE } preferences.pageLayout().asImmediateFlow { isVisible = it != PagerConfig.PageLayout.SINGLE_PAGE }
} }
} }
// EXH <-- // SY <--
} }
// SY -->
class ReaderBottomButtonsDialog : DialogController() { class ReaderBottomButtonsDialog : DialogController() {
private val preferences: PreferencesHelper = Injekt.get() private val preferences: PreferencesHelper = Injekt.get()
@ -586,4 +589,5 @@ class SettingsReaderController : SettingsController() {
.create() .create()
} }
} }
// SY <--
} }

View File

@ -123,6 +123,7 @@ class SettingsSecurityController : SettingsController() {
titleRes = R.string.hide_notification_content titleRes = R.string.hide_notification_content
defaultValue = false defaultValue = false
} }
// SY -->
preference { preference {
key = "pref_edit_lock_times" key = "pref_edit_lock_times"
titleRes = R.string.action_edit_biometric_lock_times titleRes = R.string.action_edit_biometric_lock_times
@ -149,8 +150,10 @@ class SettingsSecurityController : SettingsController() {
SetLockedDaysDialog().showDialog(router) SetLockedDaysDialog().showDialog(router)
} }
} }
// SY <--
} }
// SY -->
class SetLockedDaysDialog(bundle: Bundle? = null) : DialogController(bundle) { class SetLockedDaysDialog(bundle: Bundle? = null) : DialogController(bundle) {
val preferences: PreferencesHelper by injectLazy() val preferences: PreferencesHelper by injectLazy()
@ -212,4 +215,5 @@ class SettingsSecurityController : SettingsController() {
.create() .create()
} }
} }
// SY <--
} }

View File

@ -1,115 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/manga_summary_section"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<TextView
android:id="@+id/manga_summary_text"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:clickable="true"
android:focusable="true"
android:maxLines="2"
android:textIsSelectable="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Collapsed summary content Collapsed summary content Collapsed summary content Collapsed summary content Collapsed summary content Collapsed summary content" />
<View
android:id="@+id/manga_info_toggle_more_scrim"
android:layout_width="20dp"
android:layout_height="0dp"
android:background="@drawable/manga_info_more_gradient"
android:backgroundTint="?android:attr/colorBackground"
app:layout_constraintBottom_toBottomOf="@+id/manga_summary_text"
app:layout_constraintEnd_toStartOf="@id/manga_info_toggle_more"
app:layout_constraintTop_toTopOf="@+id/manga_info_toggle_more" />
<com.google.android.material.button.MaterialButton
android:id="@+id/manga_info_toggle_more"
style="@style/Widget.Tachiyomi.Button.InlineButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingEnd="16dp"
android:text="@string/manga_info_expand"
android:textAlignment="viewEnd"
app:layout_constraintBottom_toBottomOf="@+id/manga_summary_text"
app:layout_constraintEnd_toEndOf="parent" />
<com.google.android.material.button.MaterialButton
android:id="@+id/manga_info_toggle_less"
style="@style/Widget.Tachiyomi.Button.InlineButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingEnd="16dp"
android:text="@string/manga_info_collapse"
android:textAlignment="viewEnd"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/manga_summary_text" />
<HorizontalScrollView
android:id="@+id/manga_genres_tags_compact"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:requiresFadingEdge="horizontal"
android:scrollbars="none"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/manga_summary_text">
<com.google.android.material.chip.ChipGroup
android:id="@+id/manga_genres_tags_compact_chips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp"
app:chipSpacingHorizontal="4dp"
app:singleLine="true" />
</HorizontalScrollView>
<com.google.android.material.chip.ChipGroup
android:id="@+id/manga_genres_tags_full_chips"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone"
app:chipSpacingHorizontal="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/manga_info_toggle_less" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/genre_groups"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone"
tools:listitem="@layout/manga_info_genre_grouping"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/manga_info_toggle_less"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -86,6 +86,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:padding="8dp" android:padding="8dp"
android:textColor="?attr/colorOnToolbar"
android:text="@string/eh_autoscroll" /> android:text="@string/eh_autoscroll" />
<EditText <EditText
@ -104,6 +105,7 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="\?" android:text="\?"
android:textColor="?attr/colorOnToolbar"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
</LinearLayout> </LinearLayout>
@ -120,6 +122,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:textColor="?attr/colorOnToolbar"
android:text="@string/eh_retry_all" /> android:text="@string/eh_retry_all" />
<Button <Button
@ -128,6 +131,7 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="\?" android:text="\?"
android:textColor="?attr/colorOnToolbar"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
<Button <Button
@ -136,6 +140,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:textColor="?attr/colorOnToolbar"
android:text="@string/eh_boost_page" /> android:text="@string/eh_boost_page" />
<Button <Button
@ -144,6 +149,7 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="\?" android:text="\?"
android:textColor="?attr/colorOnToolbar"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
</LinearLayout> </LinearLayout>

View File

@ -54,7 +54,7 @@
android:contentDescription="@string/action_start_reading" android:contentDescription="@string/action_start_reading"
android:padding="6dp" android:padding="6dp"
android:src="@drawable/ic_start_reading_24dp" android:src="@drawable/ic_start_reading_24dp"
android:tint="@android:color/white" /> app:tint="@android:color/white" />
</FrameLayout> </FrameLayout>
<LinearLayout <LinearLayout

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -53,7 +54,7 @@
android:contentDescription="@string/action_start_reading" android:contentDescription="@string/action_start_reading"
android:padding="6dp" android:padding="6dp"
android:src="@drawable/ic_start_reading_24dp" android:src="@drawable/ic_start_reading_24dp"
android:tint="@android:color/white" /> app:tint="@android:color/white" />
</FrameLayout> </FrameLayout>
<LinearLayout <LinearLayout

View File

@ -30,14 +30,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:contentDescription="@string/action_save" android:contentDescription="@string/action_save"
android:tint="?attr/colorAccent"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/filter_btn" app:layout_constraintEnd_toStartOf="@+id/filter_btn"
app:layout_constraintHorizontal_bias="1" app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toEndOf="@+id/reset_btn" app:layout_constraintStart_toEndOf="@+id/reset_btn"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_save_black_24dp" /> app:srcCompat="@drawable/ic_save_black_24dp"
app:tint="?attr/colorAccent" />
<Button <Button
android:id="@+id/filter_btn" android:id="@+id/filter_btn"