Loading src/com/android/settings/bluetooth/ui/view/DeviceDetailsFragmentFormatter.kt +18 −0 Original line number Diff line number Diff line Loading @@ -26,9 +26,13 @@ import android.os.Bundle import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.core.graphics.drawable.toDrawable import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.compose.collectAsStateWithLifecycle Loading Loading @@ -227,6 +231,7 @@ class DeviceDetailsFragmentFormatterImpl( dashboardFragment.lifecycleScope.launch { if (isLoading) { scrollToTop() dashboardFragment.setLoading(false, false) isLoading = false } Loading Loading @@ -493,6 +498,19 @@ class DeviceDetailsFragmentFormatterImpl( } } private fun scrollToTop() { // Temporary fix to make sure the screen is scroll to the top when rendering. ComposePreference(context).apply { order = -1 isEnabled = false isSelectable = false setContent { Spacer(modifier = Modifier.height(1.dp)) } }.also { dashboardFragment.preferenceScreen.addPreference(it) dashboardFragment.scrollToPreference(it) } } private fun getPreferenceKey(settingId: Int) = "DEVICE_SETTING_${settingId}" private class SpotlightPreference(context: Context) : Preference(context) { Loading tests/robotests/src/com/android/settings/bluetooth/ui/view/DeviceDetailsFragmentFormatterTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -404,7 +404,7 @@ class DeviceDetailsFragmentFormatterTest { for (i in 0..<fragment.preferenceScreen.preferenceCount) { prefs.add(fragment.preferenceScreen.getPreference(i)) } return prefs return prefs.filter { it.key != null } } class TestFragment(context: Context) : DashboardFragment() { Loading Loading
src/com/android/settings/bluetooth/ui/view/DeviceDetailsFragmentFormatter.kt +18 −0 Original line number Diff line number Diff line Loading @@ -26,9 +26,13 @@ import android.os.Bundle import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.core.graphics.drawable.toDrawable import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.compose.collectAsStateWithLifecycle Loading Loading @@ -227,6 +231,7 @@ class DeviceDetailsFragmentFormatterImpl( dashboardFragment.lifecycleScope.launch { if (isLoading) { scrollToTop() dashboardFragment.setLoading(false, false) isLoading = false } Loading Loading @@ -493,6 +498,19 @@ class DeviceDetailsFragmentFormatterImpl( } } private fun scrollToTop() { // Temporary fix to make sure the screen is scroll to the top when rendering. ComposePreference(context).apply { order = -1 isEnabled = false isSelectable = false setContent { Spacer(modifier = Modifier.height(1.dp)) } }.also { dashboardFragment.preferenceScreen.addPreference(it) dashboardFragment.scrollToPreference(it) } } private fun getPreferenceKey(settingId: Int) = "DEVICE_SETTING_${settingId}" private class SpotlightPreference(context: Context) : Preference(context) { Loading
tests/robotests/src/com/android/settings/bluetooth/ui/view/DeviceDetailsFragmentFormatterTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -404,7 +404,7 @@ class DeviceDetailsFragmentFormatterTest { for (i in 0..<fragment.preferenceScreen.preferenceCount) { prefs.add(fragment.preferenceScreen.getPreference(i)) } return prefs return prefs.filter { it.key != null } } class TestFragment(context: Context) : DashboardFragment() { Loading