Merge "Fix back and cancel flows" into rvc-dev am: 486fdc0b68 am: 7f6ae176bf am: 62028aaedb
Change-Id: I3786c3eb46d8d648e1740b463f59f8951cb877e2
This commit is contained in:
@@ -674,8 +674,9 @@
|
||||
android:label="@string/controls_providers_title"
|
||||
android:theme="@style/Theme.ControlsManagement"
|
||||
android:showForAllUsers="true"
|
||||
android:clearTaskOnLaunch="true"
|
||||
android:finishOnTaskLaunch="true"
|
||||
android:excludeFromRecents="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
|
||||
android:visibleToInstantApps="true">
|
||||
</activity>
|
||||
@@ -683,6 +684,7 @@
|
||||
<activity android:name=".controls.management.ControlsEditingActivity"
|
||||
android:theme="@style/Theme.ControlsManagement"
|
||||
android:excludeFromRecents="true"
|
||||
android:noHistory="true"
|
||||
android:showForAllUsers="true"
|
||||
android:finishOnTaskLaunch="true"
|
||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
|
||||
@@ -694,6 +696,7 @@
|
||||
android:excludeFromRecents="true"
|
||||
android:showForAllUsers="true"
|
||||
android:finishOnTaskLaunch="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
|
||||
android:visibleToInstantApps="true">
|
||||
</activity>
|
||||
|
||||
@@ -2696,6 +2696,9 @@
|
||||
<!-- 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>
|
||||
|
||||
<!-- 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] -->
|
||||
<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] -->
|
||||
|
||||
@@ -76,6 +76,8 @@ object ControlsAnimations {
|
||||
allowEnterTransitionOverlap = true
|
||||
enterTransition = enterWindowTransition(view.getId())
|
||||
exitTransition = exitWindowTransition(view.getId())
|
||||
reenterTransition = enterWindowTransition(view.getId())
|
||||
returnTransition = exitWindowTransition(view.getId())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +88,11 @@ object ControlsAnimations {
|
||||
showAnimation = false
|
||||
}
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
|
||||
fun resetAnimation() {
|
||||
view.translationY = 0f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.systemui.controls.management
|
||||
|
||||
import android.app.ActivityOptions
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
@@ -70,10 +69,6 @@ class ControlsEditingActivity @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@@ -102,6 +97,23 @@ class ControlsEditingActivity @Inject constructor(
|
||||
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() {
|
||||
setContentView(R.layout.controls_management)
|
||||
|
||||
@@ -124,35 +136,13 @@ class ControlsEditingActivity @Inject constructor(
|
||||
}
|
||||
|
||||
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)
|
||||
saveButton = requireViewById<Button>(R.id.done).apply {
|
||||
isEnabled = false
|
||||
setText(R.string.save)
|
||||
setOnClickListener {
|
||||
saveFavorites()
|
||||
ControlsAnimations.exitAnimation(
|
||||
rootView,
|
||||
object : Runnable {
|
||||
override fun run() {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
).start()
|
||||
animateExitAndFinish()
|
||||
globalActionsComponent.handleShowGlobalActionsMenu()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.view.ViewStub
|
||||
import android.widget.Button
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.android.systemui.Prefs
|
||||
import com.android.systemui.R
|
||||
@@ -65,6 +66,7 @@ class ControlsFavoritingActivity @Inject constructor(
|
||||
// If provided, show this structure page first
|
||||
const val EXTRA_STRUCTURE = "extra_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_MAX_SHOWN = 2
|
||||
}
|
||||
@@ -72,6 +74,7 @@ class ControlsFavoritingActivity @Inject constructor(
|
||||
private var component: ComponentName? = null
|
||||
private var appName: CharSequence? = null
|
||||
private var structureExtra: CharSequence? = null
|
||||
private var fromProviderSelector = false
|
||||
|
||||
private lateinit var structurePager: ViewPager2
|
||||
private lateinit var statusText: TextView
|
||||
@@ -107,7 +110,10 @@ class ControlsFavoritingActivity @Inject constructor(
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
finish()
|
||||
if (!fromProviderSelector) {
|
||||
globalActionsComponent.handleShowGlobalActionsMenu()
|
||||
}
|
||||
animateExitAndFinish()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@@ -118,6 +124,7 @@ class ControlsFavoritingActivity @Inject constructor(
|
||||
appName = intent.getCharSequenceExtra(EXTRA_APP)
|
||||
structureExtra = intent.getCharSequenceExtra(EXTRA_STRUCTURE) ?: ""
|
||||
component = intent.getParcelableExtra<ComponentName>(Intent.EXTRA_COMPONENT_NAME)
|
||||
fromProviderSelector = intent.getBooleanExtra(EXTRA_FROM_PROVIDER_SELECTOR, false)
|
||||
|
||||
bindViews()
|
||||
}
|
||||
@@ -268,18 +275,38 @@ class ControlsFavoritingActivity @Inject constructor(
|
||||
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() {
|
||||
otherAppsButton = requireViewById<Button>(R.id.other_apps).apply {
|
||||
setOnClickListener {
|
||||
val i = Intent()
|
||||
i.setComponent(
|
||||
ComponentName(context, ControlsProviderSelectorActivity::class.java))
|
||||
val i = Intent().apply {
|
||||
component = 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
|
||||
.makeSceneTransitionAnimation(this@ControlsFavoritingActivity).toBundle())
|
||||
animateExitAndFinish()
|
||||
}
|
||||
}
|
||||
|
||||
val rootView = requireViewById<ViewGroup>(R.id.controls_management_root)
|
||||
doneButton = requireViewById<Button>(R.id.done).apply {
|
||||
isEnabled = false
|
||||
setOnClickListener {
|
||||
@@ -290,15 +317,7 @@ class ControlsFavoritingActivity @Inject constructor(
|
||||
StructureInfo(component!!, it.structureName, favoritesForStorage)
|
||||
)
|
||||
}
|
||||
|
||||
ControlsAnimations.exitAnimation(
|
||||
rootView,
|
||||
object : Runnable {
|
||||
override fun run() {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
).start()
|
||||
animateExitAndFinish()
|
||||
globalActionsComponent.handleShowGlobalActionsMenu()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.android.systemui.broadcast.BroadcastDispatcher
|
||||
import com.android.systemui.controls.controller.ControlsController
|
||||
import com.android.systemui.dagger.qualifiers.Background
|
||||
import com.android.systemui.dagger.qualifiers.Main
|
||||
import com.android.systemui.globalactions.GlobalActionsComponent
|
||||
import com.android.systemui.settings.CurrentUserTracker
|
||||
import com.android.systemui.util.LifecycleActivity
|
||||
import java.util.concurrent.Executor
|
||||
@@ -47,6 +48,7 @@ class ControlsProviderSelectorActivity @Inject constructor(
|
||||
@Background private val backExecutor: Executor,
|
||||
private val listingController: ControlsListingController,
|
||||
private val controlsController: ControlsController,
|
||||
private val globalActionsComponent: GlobalActionsComponent,
|
||||
broadcastDispatcher: BroadcastDispatcher
|
||||
) : LifecycleActivity() {
|
||||
|
||||
@@ -95,12 +97,17 @@ class ControlsProviderSelectorActivity @Inject constructor(
|
||||
visibility = View.VISIBLE
|
||||
setText(com.android.internal.R.string.cancel)
|
||||
setOnClickListener {
|
||||
this@ControlsProviderSelectorActivity.finishAffinity()
|
||||
onBackPressed()
|
||||
}
|
||||
}
|
||||
requireViewById<View>(R.id.done).visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
globalActionsComponent.handleShowGlobalActionsMenu()
|
||||
animateExitAndFinish()
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
currentUserTracker.startTracking()
|
||||
@@ -144,7 +151,7 @@ class ControlsProviderSelectorActivity @Inject constructor(
|
||||
putExtra(ControlsFavoritingActivity.EXTRA_APP,
|
||||
listingController.getAppLabel(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())
|
||||
}
|
||||
@@ -155,4 +162,16 @@ class ControlsProviderSelectorActivity @Inject constructor(
|
||||
currentUserTracker.stopTracking()
|
||||
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