Handle public access in the home screen
In public access mode we can only read articles. Disable swiping articles in the listing to read them and remove the menu items to read all articles and to access sources settings.
This commit is contained in:
parent
e3e8cc8a79
commit
04f3937095
@ -114,10 +114,16 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
|
||||
}
|
||||
}
|
||||
|
||||
val swipeDirs = if (appSettingsService.getPublicAccess()) {
|
||||
0
|
||||
} else {
|
||||
ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT
|
||||
}
|
||||
|
||||
val simpleItemTouchCallback =
|
||||
object : ItemTouchHelper.SimpleCallback(
|
||||
0,
|
||||
ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT
|
||||
swipeDirs
|
||||
) {
|
||||
override fun getSwipeDirs(
|
||||
recyclerView: RecyclerView,
|
||||
@ -510,6 +516,10 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
val inflater = menuInflater
|
||||
inflater.inflate(R.menu.home_menu, menu)
|
||||
if (appSettingsService.getPublicAccess()) {
|
||||
menu.removeItem(R.id.readAll)
|
||||
menu.removeItem(R.id.action_sources)
|
||||
}
|
||||
|
||||
val searchItem = menu.findItem(R.id.action_search)
|
||||
val searchView = searchItem.getActionView() as SearchView
|
||||
|
Loading…
Reference in New Issue
Block a user