mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-15 02:18:04 -04:00
Merge pull request #3525 from kiwix/Issue#3523
Fixed the redundancy of the 'All-Books-Mode' option for Bookmarks, Notes, and History in custom apps.
This commit is contained in:
commit
ae413559fe
@ -164,4 +164,10 @@ object ActivityExtensions {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the package name of the current activity's application is not equal to 'org.kiwix.kiwixmobile',
|
||||
* indicating that it is a custom application.
|
||||
*/
|
||||
fun Activity.isCustomApp(): Boolean = packageName != "org.kiwix.kiwixmobile"
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.base.BaseFragment
|
||||
import org.kiwix.kiwixmobile.core.base.FragmentActivityExtensions
|
||||
import org.kiwix.kiwixmobile.core.databinding.FragmentPageBinding
|
||||
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.isCustomApp
|
||||
import org.kiwix.kiwixmobile.core.extensions.closeKeyboard
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.core.page.adapter.OnItemClickListener
|
||||
@ -141,8 +142,12 @@ abstract class PageFragment : OnItemClickListener, BaseFragment(), FragmentActiv
|
||||
fragmentPageBinding?.recyclerView?.adapter = pageAdapter
|
||||
fragmentPageBinding?.noPage?.text = noItemsString
|
||||
|
||||
fragmentPageBinding?.pageSwitch?.text = switchString
|
||||
fragmentPageBinding?.pageSwitch?.isChecked = switchIsChecked
|
||||
fragmentPageBinding?.pageSwitch?.apply {
|
||||
text = switchString
|
||||
isChecked = switchIsChecked
|
||||
// hide switches for custom apps, see more info here https://github.com/kiwix/kiwix-android/issues/3523
|
||||
visibility = if (requireActivity().isCustomApp()) GONE else VISIBLE
|
||||
}
|
||||
compositeDisposable.add(pageViewModel.effects.subscribe { it.invokeWith(activity) })
|
||||
fragmentPageBinding?.pageSwitch?.setOnCheckedChangeListener { _, isChecked ->
|
||||
pageViewModel.actions.offer(Action.UserClickedShowAllToggle(isChecked))
|
||||
|
Loading…
x
Reference in New Issue
Block a user