Remove deprecated functions (#404)

This commit is contained in:
davidoskky 2022-02-05 18:18:25 +01:00 committed by GitHub
parent def75b6431
commit 5b540dbc38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}
}