From 5b540dbc38989569e17b32677bd76be2ec52ada3 Mon Sep 17 00:00:00 2001 From: davidoskky Date: Sat, 5 Feb 2022 18:18:25 +0100 Subject: [PATCH] Remove deprecated functions (#404) --- .../amine/bou/readerforselfoss/HomeActivity.kt | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt index b3e1c40..89ff52e 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt @@ -18,7 +18,6 @@ import androidx.appcompat.app.ActionBarDrawerToggle import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.SearchView -import androidx.core.view.MenuItemCompat import androidx.core.view.doOnNextLayout import androidx.drawerlayout.widget.DrawerLayout import androidx.recyclerview.widget.* @@ -248,7 +247,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { ): Boolean = false override fun onSwiped(viewHolder: RecyclerView.ViewHolder, swipeDir: Int) { - val position = viewHolder.adapterPosition + val position = viewHolder.bindingAdapterPosition val i = items.elementAtOrNull(position) if (i != null) { @@ -1134,22 +1133,12 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { return false } - override fun onActivityResult(req: Int, result: Int, data: Intent?) { - when (req) { - MENU_PREFERENCES -> { - //drawer.closeDrawer() - recreate() - } - else -> super.onActivityResult(req, result, data) - } - } - override fun onCreateOptionsMenu(menu: Menu): Boolean { val inflater = menuInflater inflater.inflate(R.menu.home_menu, menu) val searchItem = menu.findItem(R.id.action_search) - val searchView = MenuItemCompat.getActionView(searchItem) as SearchView + val searchView = searchItem.getActionView() as SearchView searchView.setOnQueryTextListener(this) return true @@ -1264,8 +1253,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { .addTag("selfoss-loading") .build() - - WorkManager.getInstance().enqueueUniquePeriodicWork("selfoss-loading", ExistingPeriodicWorkPolicy.KEEP, backgroundWork) + WorkManager.getInstance(baseContext).enqueueUniquePeriodicWork("selfoss-loading", ExistingPeriodicWorkPolicy.KEEP, backgroundWork) } }