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