Skip to content
Merged

fix #192

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class MainActivity : BaseActivity() {
}
if (selectedFragment != null) {
supportFragmentManager.beginTransaction().replace(R.id.container, selectedFragment).commit()
updateSearchBarTitle(selectedFragment)
updateToolbarTitle(selectedFragment)
updateSearchViewHint(selectedFragment)
updateSearchViewChips(selectedFragment)
return@setOnItemSelectedListener true
Expand Down Expand Up @@ -328,12 +328,15 @@ class MainActivity : BaseActivity() {
}
binding.bottomNavigation.menu.findItem(initialItemId).isChecked = true
supportFragmentManager.beginTransaction().replace(R.id.container, initialFragment).commit()
updateSearchBarTitle(initialFragment)
updateToolbarTitle(initialFragment)
updateSearchViewHint(initialFragment)
updateSearchViewChips(initialFragment)
}

prefListener = OnSharedPreferenceChangeListener { _: SharedPreferences?, key: String? ->
if (key == "user_has_active_purchase" || key == "user_is_subscribed") {
getCurrentFragment()?.let { updateToolbarTitle(it) }
}
if (key == HIDE_HOME_PREFERENCE || key == HIDE_MOVIES_PREFERENCE || key == HIDE_SERIES_PREFERENCE || key == HIDE_SAVED_PREFERENCE || key == HIDE_ACCOUNT_PREFERENCE || key == HIDE_ACCOUNT_TKT_PREFERENCE) {
val menu1 = binding.bottomNavigation.menu
menu1.findItem(R.id.nav_home).isVisible =
Expand Down Expand Up @@ -616,6 +619,7 @@ class MainActivity : BaseActivity() {
if (BuildConfig.FLAVOR == "full") {
if (!isFreeUser && !hasActivePurchase && !isSubscribed) {
supportFragmentManager.setFragmentResultListener(BillingBottomSheetFragment.REQUEST_KEY, this) { _, _ ->
getCurrentFragment()?.let { updateToolbarTitle(it) }
if (!preferences.getBoolean("sync_provider_dialog_shown", false)) {
showSyncProviderDialog()
}
Expand Down Expand Up @@ -667,7 +671,7 @@ class MainActivity : BaseActivity() {
return supportFragmentManager.findFragmentById(R.id.container)
}

private fun updateSearchBarTitle(fragment: Fragment) {
private fun updateToolbarTitle(fragment: Fragment) {
val appName = if (BuildConfig.FLAVOR == "full" && (preferences.getBoolean("user_has_active_purchase", false) || preferences.getBoolean("user_is_subscribed", false))) {
getString(R.string.premium_title)
} else {
Expand All @@ -681,7 +685,8 @@ class MainActivity : BaseActivity() {
}
is ListFragment -> getString(R.string.title_saved)
is AccountDataFragment -> getString(R.string.title_account)
else -> appName
is AccountDataFragmentTkt -> getString(R.string.title_account)
else -> getString(R.string.app_name)
Comment thread
Copilot marked this conversation as resolved.
}
binding.toolbar.title = title
}
Expand Down Expand Up @@ -1389,6 +1394,7 @@ class MainActivity : BaseActivity() {
override fun onResume() {
ThemeHelper.applyAmoledTheme(this)
super.onResume()
getCurrentFragment()?.let { updateToolbarTitle(it) }
}

override fun onSupportNavigateUp(): Boolean {
Expand Down
Loading