using lowercased phrases for "search" screen titles

Recents updated to say "search updates & history" which changes based on the tab you're in
Library updated to say "search your library"
This commit is contained in:
Jays2Kings 2021-04-25 12:05:30 -04:00
parent 371b77e75f
commit fdc976d4f9
6 changed files with 21 additions and 8 deletions

View File

@ -111,6 +111,7 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.util.Locale
import kotlin.math.abs import kotlin.math.abs
import kotlin.math.max import kotlin.math.max
import kotlin.math.roundToInt import kotlin.math.roundToInt
@ -213,11 +214,7 @@ class LibraryController(
override fun getTitle(): String? { override fun getTitle(): String? {
setSubtitle() setSubtitle()
// return if (!showCategoryInTitle || binding.headerTitle.text.isNullOrBlank() || binding.recyclerCover.isClickable) { return searchTitle(view?.context?.getString(R.string.your_library)?.lowercase(Locale.ROOT))
return searchTitle(view?.context?.getString(R.string.library))
// } else {
// binding.headerTitle.text.toString()
// }
} }
private var scrollListener = object : RecyclerView.OnScrollListener() { private var scrollListener = object : RecyclerView.OnScrollListener() {

View File

@ -58,6 +58,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.cancel import kotlinx.coroutines.cancel
import java.util.Locale
import kotlin.math.abs import kotlin.math.abs
import kotlin.math.max import kotlin.math.max
import kotlin.math.min import kotlin.math.min
@ -111,7 +112,15 @@ class RecentsController(bundle: Bundle? = null) :
override fun getTitle(): String? { override fun getTitle(): String? {
return if (showingDownloads) { return if (showingDownloads) {
resources?.getString(R.string.download_queue) resources?.getString(R.string.download_queue)
} else searchTitle(resources?.getString(R.string.recents)) } else searchTitle(
view?.context?.getString(
when (presenter.viewType) {
RecentsPresenter.VIEW_TYPE_ONLY_HISTORY -> R.string.history
RecentsPresenter.VIEW_TYPE_ONLY_UPDATES -> R.string.updates
else -> R.string.updates_and_history
}
)?.lowercase(Locale.ROOT)
)
} }
override fun createBinding(inflater: LayoutInflater) = RecentsControllerBinding.inflate(inflater) override fun createBinding(inflater: LayoutInflater) = RecentsControllerBinding.inflate(inflater)
@ -476,11 +485,13 @@ class RecentsController(bundle: Bundle? = null) :
fun tempJumpTo(viewType: Int) { fun tempJumpTo(viewType: Int) {
presenter.toggleGroupRecents(viewType, false) presenter.toggleGroupRecents(viewType, false)
activityBinding?.mainTabs?.selectTab(activityBinding?.mainTabs?.getTabAt(viewType)) activityBinding?.mainTabs?.selectTab(activityBinding?.mainTabs?.getTabAt(viewType))
updateTitleAndMenu()
} }
private fun setViewType(viewType: Int) { private fun setViewType(viewType: Int) {
if (viewType != presenter.viewType) { if (viewType != presenter.viewType) {
presenter.toggleGroupRecents(viewType) presenter.toggleGroupRecents(viewType)
updateTitleAndMenu()
} }
} }

View File

@ -58,6 +58,7 @@ class RecentsPresenter(
var heldItems: HashMap<Int, List<RecentMangaItem>> = hashMapOf() var heldItems: HashMap<Int, List<RecentMangaItem>> = hashMapOf()
private var shouldMoveToTop = false private var shouldMoveToTop = false
var viewType: Int = preferences.recentsViewType().get() var viewType: Int = preferences.recentsViewType().get()
private set
private fun resetOffsets() { private fun resetOffsets() {
finished = false finished = false

View File

@ -28,6 +28,7 @@ import rx.Subscription
import rx.subscriptions.CompositeSubscription import rx.subscriptions.CompositeSubscription
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.util.Locale
abstract class SettingsController : PreferenceController() { abstract class SettingsController : PreferenceController() {
@ -98,7 +99,7 @@ abstract class SettingsController : PreferenceController() {
open fun getTitle(): String? { open fun getTitle(): String? {
if (this is FloatingSearchInterface) { if (this is FloatingSearchInterface) {
return searchTitle(preferenceScreen?.title?.toString()) return searchTitle(preferenceScreen?.title?.toString()?.lowercase(Locale.ROOT))
} }
return preferenceScreen?.title?.toString() return preferenceScreen?.title?.toString()
} }

View File

@ -59,6 +59,7 @@ import kotlinx.android.parcel.Parcelize
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.util.Date import java.util.Date
import java.util.Locale
import kotlin.math.abs import kotlin.math.abs
import kotlin.math.max import kotlin.math.max
@ -110,7 +111,7 @@ class BrowseController :
else -> R.string.source_migration else -> R.string.source_migration
} }
) )
} else searchTitle(view?.context?.getString(R.string.sources)) } else searchTitle(view?.context?.getString(R.string.sources)?.lowercase(Locale.ROOT))
} }
val presenter = SourcePresenter(this) val presenter = SourcePresenter(this)

View File

@ -113,6 +113,7 @@
<!-- Library --> <!-- Library -->
<string name="library">Library</string> <string name="library">Library</string>
<string name="your_library">Your library</string>
<string name="updating_library">Updating library</string> <string name="updating_library">Updating library</string>
<string name="selected_">Selected: %1$d</string> <string name="selected_">Selected: %1$d</string>
<string name="local">Local</string> <string name="local">Local</string>
@ -213,6 +214,7 @@
<!-- Recents --> <!-- Recents -->
<string name="recents">Recents</string> <string name="recents">Recents</string>
<string name="updates_and_history">Updates &amp; history</string>
<string name="updates">Updates</string> <string name="updates">Updates</string>
<string name="newly_added">Newly added</string> <string name="newly_added">Newly added</string>
<string name="history">History</string> <string name="history">History</string>