diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt index 70ec25d..d00162e 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt @@ -137,28 +137,34 @@ class ReaderActivity : AppCompatActivity(), DIAware { inflater.inflate(R.menu.reader_menu, menu) toolbarMenu = menu - if (allItems.isNotEmpty() && allItems[currentItem].starred) { - canRemoveFromFavorite() - } else { - canFavorite() - } alignmentMenu() - binding.pager.registerOnPageChangeCallback( - object : ViewPager2.OnPageChangeCallback() { - - override fun onPageSelected(position: Int) { - super.onPageSelected(position) - - if (allItems[position].starred) { - canRemoveFromFavorite() - } else { - canFavorite() - } - readItem(allItems[position]) - } + if (appSettingsService.getPublicAccess()) { + menu.removeItem(R.id.star) + } else { + if (allItems.isNotEmpty() && allItems[currentItem].starred) { + canRemoveFromFavorite() + } else { + canFavorite() } - ) + + + binding.pager.registerOnPageChangeCallback( + object : ViewPager2.OnPageChangeCallback() { + + override fun onPageSelected(position: Int) { + super.onPageSelected(position) + + if (allItems[position].starred) { + canRemoveFromFavorite() + } else { + canFavorite() + } + readItem(allItems[position]) + } + } + ) + } return true } @@ -177,7 +183,7 @@ class ReaderActivity : AppCompatActivity(), DIAware { when (item.itemId) { android.R.id.home -> { - onBackPressed() + onBackPressedDispatcher.onBackPressed() return true } R.id.star -> {