Prevent keyboard to pop over result pages.

This commit is contained in:
Antoine POPINEAU 2020-07-11 17:24:53 +02:00
parent b9e9272336
commit e4da4af3f3
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
2 changed files with 4 additions and 8 deletions

View File

@ -12,7 +12,6 @@ import com.github.apognu.otter.fragments.ArtistsFragment
import com.github.apognu.otter.repositories.*
import com.github.apognu.otter.utils.Album
import com.github.apognu.otter.utils.Artist
import com.github.apognu.otter.utils.log
import com.github.apognu.otter.utils.untilNetwork
import kotlinx.android.synthetic.main.activity_search.*
import java.net.URLEncoder
@ -38,6 +37,8 @@ class SearchActivity : AppCompatActivity() {
results.layoutManager = LinearLayoutManager(this)
results.adapter = it
}
search.requestFocus()
}
override fun onResume() {
@ -48,8 +49,6 @@ class SearchActivity : AppCompatActivity() {
tracksRepository = TracksSearchRepository(this@SearchActivity, "")
favoritesRepository = FavoritesRepository(this@SearchActivity)
search.requestFocus()
search.setOnQueryTextListener(object : androidx.appcompat.widget.SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(rawQuery: String?): Boolean {
search.clearFocus()
@ -79,7 +78,7 @@ class SearchActivity : AppCompatActivity() {
refresh()
}
albumsRepository.fetch(Repository.Origin.Network.origin).untilNetwork(lifecycleScope) { albums, _, _ ,_ ->
albumsRepository.fetch(Repository.Origin.Network.origin).untilNetwork(lifecycleScope) { albums, _, _, _ ->
done++
adapter.albums.addAll(albums)

View File

@ -150,10 +150,7 @@ class TracksFragment : OtterFragment<Track, TracksAdapter>() {
lifecycleScope.launch(Main) {
CommandBus.get().collect { command ->
when (command) {
is Command.RefreshTrack -> {
log("${command.track?.title} -> ${command.track?.favorite}")
refreshCurrentTrack(command.track)
}
is Command.RefreshTrack -> refreshCurrentTrack(command.track)
}
}
}