mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-26 08:54:16 +01:00
Rework focus for controller
This commit is contained in:
parent
3c23302b82
commit
7a5684e57f
@ -203,17 +203,18 @@ class MainActivity : AppCompatActivity() {
|
||||
// Return candidate when span index matches
|
||||
if (currentSpanIndex == (candidate.layoutParams as LayoutParams).spanIndex) return candidate
|
||||
}
|
||||
if (nextFocus == null) {
|
||||
nextFocus?.let { if ((it.layoutParams as LayoutParams).spanIndex == currentSpanIndex) return nextFocus }
|
||||
|
||||
binding.appBarLayout.setExpanded(false) // End of list, hide app bar, so bottom row is fully visible
|
||||
binding.appList.smoothScrollToPosition(adapter.itemCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
View.FOCUS_UP -> {
|
||||
if (nextFocus?.isFocusable != true) {
|
||||
binding.searchBar.requestFocus()
|
||||
binding.appBarLayout.setExpanded(true)
|
||||
binding.appList.smoothScrollToPosition(0)
|
||||
return null
|
||||
}
|
||||
}
|
||||
@ -249,7 +250,7 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
private fun handleState(state : MainState) = when (state) {
|
||||
MainState.Loading -> {
|
||||
binding.refreshIcon.animate().rotationBy(-180f)
|
||||
binding.refreshIcon.apply { animate().rotation(rotation - 180f) }
|
||||
binding.swipeRefreshLayout.isRefreshing = true
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ package emu.skyline
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import emu.skyline.databinding.SettingsActivityBinding
|
||||
@ -30,6 +31,10 @@ class SettingsActivity : AppCompatActivity() {
|
||||
setSupportActionBar(binding.titlebar.toolbar)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
window.decorView.findViewById<View>(android.R.id.content).viewTreeObserver.addOnTouchModeChangeListener { isInTouchMode ->
|
||||
if (!isInTouchMode) binding.titlebar.appBarLayout.setExpanded(false)
|
||||
}
|
||||
|
||||
supportFragmentManager
|
||||
.beginTransaction()
|
||||
.replace(R.id.settings, preferenceFragment)
|
||||
|
@ -4,9 +4,7 @@
|
||||
android:id="@+id/app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"
|
||||
android:keyboardNavigationCluster="false"
|
||||
android:touchscreenBlocksFocus="false">
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
|
Loading…
Reference in New Issue
Block a user