Merge "Fix back and cancel flows" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
486fdc0b68
@@ -674,8 +674,9 @@
|
|||||||
android:label="@string/controls_providers_title"
|
android:label="@string/controls_providers_title"
|
||||||
android:theme="@style/Theme.ControlsManagement"
|
android:theme="@style/Theme.ControlsManagement"
|
||||||
android:showForAllUsers="true"
|
android:showForAllUsers="true"
|
||||||
android:clearTaskOnLaunch="true"
|
android:finishOnTaskLaunch="true"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
|
android:launchMode="singleInstance"
|
||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
|
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
|
||||||
android:visibleToInstantApps="true">
|
android:visibleToInstantApps="true">
|
||||||
</activity>
|
</activity>
|
||||||
@@ -683,6 +684,7 @@
|
|||||||
<activity android:name=".controls.management.ControlsEditingActivity"
|
<activity android:name=".controls.management.ControlsEditingActivity"
|
||||||
android:theme="@style/Theme.ControlsManagement"
|
android:theme="@style/Theme.ControlsManagement"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
|
android:noHistory="true"
|
||||||
android:showForAllUsers="true"
|
android:showForAllUsers="true"
|
||||||
android:finishOnTaskLaunch="true"
|
android:finishOnTaskLaunch="true"
|
||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
|
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
|
||||||
@@ -694,6 +696,7 @@
|
|||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:showForAllUsers="true"
|
android:showForAllUsers="true"
|
||||||
android:finishOnTaskLaunch="true"
|
android:finishOnTaskLaunch="true"
|
||||||
|
android:launchMode="singleInstance"
|
||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
|
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
|
||||||
android:visibleToInstantApps="true">
|
android:visibleToInstantApps="true">
|
||||||
</activity>
|
</activity>
|
||||||
|
|||||||
@@ -2696,6 +2696,9 @@
|
|||||||
<!-- Controls management editing screen, text to indicate that all the favorites have been removed [CHAR LIMIT=NONE] -->
|
<!-- Controls management editing screen, text to indicate that all the favorites have been removed [CHAR LIMIT=NONE] -->
|
||||||
<string name="controls_favorite_removed">All controls removed</string>
|
<string name="controls_favorite_removed">All controls removed</string>
|
||||||
|
|
||||||
|
<!-- Controls management favorites screen, See other apps with changes made [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="controls_favorite_toast_no_changes">Changes not saved</string>
|
||||||
|
|
||||||
<!-- Controls management controls screen error on load message [CHAR LIMIT=60] -->
|
<!-- Controls management controls screen error on load message [CHAR LIMIT=60] -->
|
||||||
<string name="controls_favorite_load_error">The list of all controls could not be loaded.</string>
|
<string name="controls_favorite_load_error">The list of all controls could not be loaded.</string>
|
||||||
<!-- Controls management controls screen header for Other zone [CHAR LIMIT=60] -->
|
<!-- Controls management controls screen header for Other zone [CHAR LIMIT=60] -->
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ object ControlsAnimations {
|
|||||||
allowEnterTransitionOverlap = true
|
allowEnterTransitionOverlap = true
|
||||||
enterTransition = enterWindowTransition(view.getId())
|
enterTransition = enterWindowTransition(view.getId())
|
||||||
exitTransition = exitWindowTransition(view.getId())
|
exitTransition = exitWindowTransition(view.getId())
|
||||||
|
reenterTransition = enterWindowTransition(view.getId())
|
||||||
|
returnTransition = exitWindowTransition(view.getId())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +88,11 @@ object ControlsAnimations {
|
|||||||
showAnimation = false
|
showAnimation = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
|
||||||
|
fun resetAnimation() {
|
||||||
|
view.translationY = 0f
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.systemui.controls.management
|
package com.android.systemui.controls.management
|
||||||
|
|
||||||
import android.app.ActivityOptions
|
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@@ -70,10 +69,6 @@ class ControlsEditingActivity @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
@@ -102,6 +97,23 @@ class ControlsEditingActivity @Inject constructor(
|
|||||||
currentUserTracker.stopTracking()
|
currentUserTracker.stopTracking()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
globalActionsComponent.handleShowGlobalActionsMenu()
|
||||||
|
animateExitAndFinish()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun animateExitAndFinish() {
|
||||||
|
val rootView = requireViewById<ViewGroup>(R.id.controls_management_root)
|
||||||
|
ControlsAnimations.exitAnimation(
|
||||||
|
rootView,
|
||||||
|
object : Runnable {
|
||||||
|
override fun run() {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).start()
|
||||||
|
}
|
||||||
|
|
||||||
private fun bindViews() {
|
private fun bindViews() {
|
||||||
setContentView(R.layout.controls_management)
|
setContentView(R.layout.controls_management)
|
||||||
|
|
||||||
@@ -124,35 +136,13 @@ class ControlsEditingActivity @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun bindButtons() {
|
private fun bindButtons() {
|
||||||
requireViewById<Button>(R.id.other_apps).apply {
|
|
||||||
visibility = View.VISIBLE
|
|
||||||
setText(R.string.controls_menu_add)
|
|
||||||
setOnClickListener {
|
|
||||||
saveFavorites()
|
|
||||||
val intent = Intent(this@ControlsEditingActivity,
|
|
||||||
ControlsFavoritingActivity::class.java).apply {
|
|
||||||
putExtras(this@ControlsEditingActivity.intent)
|
|
||||||
putExtra(ControlsFavoritingActivity.EXTRA_SINGLE_STRUCTURE, true)
|
|
||||||
}
|
|
||||||
startActivity(intent, ActivityOptions
|
|
||||||
.makeSceneTransitionAnimation(this@ControlsEditingActivity).toBundle())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val rootView = requireViewById<ViewGroup>(R.id.controls_management_root)
|
val rootView = requireViewById<ViewGroup>(R.id.controls_management_root)
|
||||||
saveButton = requireViewById<Button>(R.id.done).apply {
|
saveButton = requireViewById<Button>(R.id.done).apply {
|
||||||
isEnabled = false
|
isEnabled = false
|
||||||
setText(R.string.save)
|
setText(R.string.save)
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
saveFavorites()
|
saveFavorites()
|
||||||
ControlsAnimations.exitAnimation(
|
animateExitAndFinish()
|
||||||
rootView,
|
|
||||||
object : Runnable {
|
|
||||||
override fun run() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
).start()
|
|
||||||
globalActionsComponent.handleShowGlobalActionsMenu()
|
globalActionsComponent.handleShowGlobalActionsMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import android.view.ViewStub
|
|||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.viewpager2.widget.ViewPager2
|
import androidx.viewpager2.widget.ViewPager2
|
||||||
import com.android.systemui.Prefs
|
import com.android.systemui.Prefs
|
||||||
import com.android.systemui.R
|
import com.android.systemui.R
|
||||||
@@ -65,6 +66,7 @@ class ControlsFavoritingActivity @Inject constructor(
|
|||||||
// If provided, show this structure page first
|
// If provided, show this structure page first
|
||||||
const val EXTRA_STRUCTURE = "extra_structure"
|
const val EXTRA_STRUCTURE = "extra_structure"
|
||||||
const val EXTRA_SINGLE_STRUCTURE = "extra_single_structure"
|
const val EXTRA_SINGLE_STRUCTURE = "extra_single_structure"
|
||||||
|
internal const val EXTRA_FROM_PROVIDER_SELECTOR = "extra_from_provider_selector"
|
||||||
private const val TOOLTIP_PREFS_KEY = Prefs.Key.CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT
|
private const val TOOLTIP_PREFS_KEY = Prefs.Key.CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT
|
||||||
private const val TOOLTIP_MAX_SHOWN = 2
|
private const val TOOLTIP_MAX_SHOWN = 2
|
||||||
}
|
}
|
||||||
@@ -72,6 +74,7 @@ class ControlsFavoritingActivity @Inject constructor(
|
|||||||
private var component: ComponentName? = null
|
private var component: ComponentName? = null
|
||||||
private var appName: CharSequence? = null
|
private var appName: CharSequence? = null
|
||||||
private var structureExtra: CharSequence? = null
|
private var structureExtra: CharSequence? = null
|
||||||
|
private var fromProviderSelector = false
|
||||||
|
|
||||||
private lateinit var structurePager: ViewPager2
|
private lateinit var structurePager: ViewPager2
|
||||||
private lateinit var statusText: TextView
|
private lateinit var statusText: TextView
|
||||||
@@ -107,7 +110,10 @@ class ControlsFavoritingActivity @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
finish()
|
if (!fromProviderSelector) {
|
||||||
|
globalActionsComponent.handleShowGlobalActionsMenu()
|
||||||
|
}
|
||||||
|
animateExitAndFinish()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@@ -118,6 +124,7 @@ class ControlsFavoritingActivity @Inject constructor(
|
|||||||
appName = intent.getCharSequenceExtra(EXTRA_APP)
|
appName = intent.getCharSequenceExtra(EXTRA_APP)
|
||||||
structureExtra = intent.getCharSequenceExtra(EXTRA_STRUCTURE) ?: ""
|
structureExtra = intent.getCharSequenceExtra(EXTRA_STRUCTURE) ?: ""
|
||||||
component = intent.getParcelableExtra<ComponentName>(Intent.EXTRA_COMPONENT_NAME)
|
component = intent.getParcelableExtra<ComponentName>(Intent.EXTRA_COMPONENT_NAME)
|
||||||
|
fromProviderSelector = intent.getBooleanExtra(EXTRA_FROM_PROVIDER_SELECTOR, false)
|
||||||
|
|
||||||
bindViews()
|
bindViews()
|
||||||
}
|
}
|
||||||
@@ -268,18 +275,38 @@ class ControlsFavoritingActivity @Inject constructor(
|
|||||||
bindButtons()
|
bindButtons()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun animateExitAndFinish() {
|
||||||
|
val rootView = requireViewById<ViewGroup>(R.id.controls_management_root)
|
||||||
|
ControlsAnimations.exitAnimation(
|
||||||
|
rootView,
|
||||||
|
object : Runnable {
|
||||||
|
override fun run() {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).start()
|
||||||
|
}
|
||||||
|
|
||||||
private fun bindButtons() {
|
private fun bindButtons() {
|
||||||
otherAppsButton = requireViewById<Button>(R.id.other_apps).apply {
|
otherAppsButton = requireViewById<Button>(R.id.other_apps).apply {
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
val i = Intent()
|
val i = Intent().apply {
|
||||||
i.setComponent(
|
component = ComponentName(context, ControlsProviderSelectorActivity::class.java)
|
||||||
ComponentName(context, ControlsProviderSelectorActivity::class.java))
|
}
|
||||||
|
if (doneButton.isEnabled) {
|
||||||
|
// The user has made changes
|
||||||
|
Toast.makeText(
|
||||||
|
applicationContext,
|
||||||
|
R.string.controls_favorite_toast_no_changes,
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
startActivity(i, ActivityOptions
|
startActivity(i, ActivityOptions
|
||||||
.makeSceneTransitionAnimation(this@ControlsFavoritingActivity).toBundle())
|
.makeSceneTransitionAnimation(this@ControlsFavoritingActivity).toBundle())
|
||||||
|
animateExitAndFinish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val rootView = requireViewById<ViewGroup>(R.id.controls_management_root)
|
|
||||||
doneButton = requireViewById<Button>(R.id.done).apply {
|
doneButton = requireViewById<Button>(R.id.done).apply {
|
||||||
isEnabled = false
|
isEnabled = false
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
@@ -290,15 +317,7 @@ class ControlsFavoritingActivity @Inject constructor(
|
|||||||
StructureInfo(component!!, it.structureName, favoritesForStorage)
|
StructureInfo(component!!, it.structureName, favoritesForStorage)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
animateExitAndFinish()
|
||||||
ControlsAnimations.exitAnimation(
|
|
||||||
rootView,
|
|
||||||
object : Runnable {
|
|
||||||
override fun run() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
).start()
|
|
||||||
globalActionsComponent.handleShowGlobalActionsMenu()
|
globalActionsComponent.handleShowGlobalActionsMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import com.android.systemui.broadcast.BroadcastDispatcher
|
|||||||
import com.android.systemui.controls.controller.ControlsController
|
import com.android.systemui.controls.controller.ControlsController
|
||||||
import com.android.systemui.dagger.qualifiers.Background
|
import com.android.systemui.dagger.qualifiers.Background
|
||||||
import com.android.systemui.dagger.qualifiers.Main
|
import com.android.systemui.dagger.qualifiers.Main
|
||||||
|
import com.android.systemui.globalactions.GlobalActionsComponent
|
||||||
import com.android.systemui.settings.CurrentUserTracker
|
import com.android.systemui.settings.CurrentUserTracker
|
||||||
import com.android.systemui.util.LifecycleActivity
|
import com.android.systemui.util.LifecycleActivity
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
@@ -47,6 +48,7 @@ class ControlsProviderSelectorActivity @Inject constructor(
|
|||||||
@Background private val backExecutor: Executor,
|
@Background private val backExecutor: Executor,
|
||||||
private val listingController: ControlsListingController,
|
private val listingController: ControlsListingController,
|
||||||
private val controlsController: ControlsController,
|
private val controlsController: ControlsController,
|
||||||
|
private val globalActionsComponent: GlobalActionsComponent,
|
||||||
broadcastDispatcher: BroadcastDispatcher
|
broadcastDispatcher: BroadcastDispatcher
|
||||||
) : LifecycleActivity() {
|
) : LifecycleActivity() {
|
||||||
|
|
||||||
@@ -95,12 +97,17 @@ class ControlsProviderSelectorActivity @Inject constructor(
|
|||||||
visibility = View.VISIBLE
|
visibility = View.VISIBLE
|
||||||
setText(com.android.internal.R.string.cancel)
|
setText(com.android.internal.R.string.cancel)
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
this@ControlsProviderSelectorActivity.finishAffinity()
|
onBackPressed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
requireViewById<View>(R.id.done).visibility = View.GONE
|
requireViewById<View>(R.id.done).visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
globalActionsComponent.handleShowGlobalActionsMenu()
|
||||||
|
animateExitAndFinish()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
currentUserTracker.startTracking()
|
currentUserTracker.startTracking()
|
||||||
@@ -144,7 +151,7 @@ class ControlsProviderSelectorActivity @Inject constructor(
|
|||||||
putExtra(ControlsFavoritingActivity.EXTRA_APP,
|
putExtra(ControlsFavoritingActivity.EXTRA_APP,
|
||||||
listingController.getAppLabel(it))
|
listingController.getAppLabel(it))
|
||||||
putExtra(Intent.EXTRA_COMPONENT_NAME, it)
|
putExtra(Intent.EXTRA_COMPONENT_NAME, it)
|
||||||
flags = Intent.FLAG_ACTIVITY_SINGLE_TOP
|
putExtra(ControlsFavoritingActivity.EXTRA_FROM_PROVIDER_SELECTOR, true)
|
||||||
}
|
}
|
||||||
startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(this).toBundle())
|
startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(this).toBundle())
|
||||||
}
|
}
|
||||||
@@ -155,4 +162,16 @@ class ControlsProviderSelectorActivity @Inject constructor(
|
|||||||
currentUserTracker.stopTracking()
|
currentUserTracker.stopTracking()
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun animateExitAndFinish() {
|
||||||
|
val rootView = requireViewById<ViewGroup>(R.id.controls_management_root)
|
||||||
|
ControlsAnimations.exitAnimation(
|
||||||
|
rootView,
|
||||||
|
object : Runnable {
|
||||||
|
override fun run() {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).start()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user