Controls - Remove 'power menu' from strings

Update all strings to reference Quick Settings. When setting up
controls, directly link to the ControlsProviderSelectorActivity
instead of going through an intermediary screen that was only
necessary for the power menu.

Fixes: 187829179
Test: manual
Change-Id: Ida1cce6201f4dc3c16c533879df11ef9fee92c0b
This commit is contained in:
Matt Pietal
2021-05-17 10:45:34 -04:00
parent bd5c79d216
commit 0b77fde2cf
3 changed files with 18 additions and 32 deletions

View File

@@ -2724,15 +2724,8 @@
<string name="accessibility_floating_button_action_double_tap_to_toggle">toggle</string>
<!-- Device Controls strings -->
<!-- Device Controls empty state, title [CHAR LIMIT=30] -->
<string name="quick_controls_title">Device controls</string>
<!-- Device Controls empty state, subtitle [CHAR LIMIT=100] -->
<string name="quick_controls_subtitle">Add controls for your connected devices</string>
<!-- Device Controls setup, title [CHAR LIMIT=50] -->
<string name="quick_controls_setup_title">Set up device controls</string>
<!-- Device Controls setup, subtitle [CHAR LIMIT=100] -->
<string name="quick_controls_setup_subtitle">Hold the Power button to access your controls</string>
<!-- Device Controls, Quick Settings tile title [CHAR LIMIT=30] -->
<string name="quick_controls_title">Home controls</string>
<!-- Controls management providers screen title [CHAR LIMIT=60]-->
<string name="controls_providers_title">Choose app to add controls</string>
@@ -2761,7 +2754,7 @@
<!-- Controls management controls screen default title [CHAR LIMIT=30] -->
<string name="controls_favorite_default_title">Controls</string>
<!-- Controls management controls screen subtitle [CHAR LIMIT=NONE] -->
<string name="controls_favorite_subtitle">Choose controls to access from the power menu</string>
<string name="controls_favorite_subtitle">Choose controls to access from Quick Settings</string>
<!-- Controls management editing screen, user direction for rearranging controls [CHAR LIMIT=NONE] -->
<string name="controls_favorite_rearrange">Hold &amp; drag to rearrange controls</string>
@@ -2853,7 +2846,7 @@
<!-- Stateless control message informing the user that a routine has started [CHAR_LIMIT=30] -->
<string name="controls_in_progress">In progress</string>
<!-- Tooltip informing user where the recently added controls are [CHAR_LIMIT=100] -->
<string name="controls_added_tooltip">Hold Power button to see new controls</string>
<string name="controls_added_tooltip">Open Quick Settings to see new controls</string>
<!-- Controls menu, add [CHAR_LIMIT=30] -->
<string name="controls_menu_add">Add controls</string>

View File

@@ -55,8 +55,9 @@ class ControlsProviderSelectorActivity @Inject constructor(
companion object {
private const val TAG = "ControlsProviderSelectorActivity"
const val BACK_SHOULD_EXIT = "back_should_exit"
}
private var backShouldExit = false
private lateinit var recyclerView: RecyclerView
private val currentUserTracker = object : CurrentUserTracker(broadcastDispatcher) {
private val startingUser = listingController.currentUserId
@@ -102,13 +103,17 @@ class ControlsProviderSelectorActivity @Inject constructor(
}
}
requireViewById<View>(R.id.done).visibility = View.GONE
backShouldExit = intent.getBooleanExtra(BACK_SHOULD_EXIT, false)
}
override fun onBackPressed() {
val i = Intent().apply {
component = ComponentName(applicationContext, ControlsActivity::class.java)
if (!backShouldExit) {
val i = Intent().apply {
component = ComponentName(applicationContext, ControlsActivity::class.java)
}
startActivity(i, ActivityOptions.makeSceneTransitionAnimation(this).toBundle())
}
startActivity(i, ActivityOptions.makeSceneTransitionAnimation(this).toBundle())
animateExitAndFinish()
}

View File

@@ -217,22 +217,8 @@ class ControlsUiControllerImpl @Inject constructor (
}
private fun showInitialSetupView(items: List<SelectionItem>) {
val inflater = LayoutInflater.from(context)
inflater.inflate(R.layout.controls_no_favorites, parent, true)
val viewGroup = parent.requireViewById(R.id.controls_no_favorites_group) as ViewGroup
viewGroup.setOnClickListener { _: View -> startProviderSelectorActivity() }
val subtitle = parent.requireViewById<TextView>(R.id.controls_subtitle)
subtitle.setText(context.resources.getString(R.string.quick_controls_subtitle))
val iconRowGroup = parent.requireViewById(R.id.controls_icon_row) as ViewGroup
items.forEach {
val imageView = inflater.inflate(R.layout.controls_icon, viewGroup, false) as ImageView
imageView.setContentDescription(it.getTitle())
imageView.setImageDrawable(it.icon)
iconRowGroup.addView(imageView)
}
startProviderSelectorActivity()
onDismiss.run()
}
private fun startFavoritingActivity(si: StructureInfo) {
@@ -261,7 +247,9 @@ class ControlsUiControllerImpl @Inject constructor (
}
private fun startProviderSelectorActivity() {
startActivity(Intent(activityContext, ControlsProviderSelectorActivity::class.java))
val i = Intent(activityContext, ControlsProviderSelectorActivity::class.java)
i.putExtra(ControlsProviderSelectorActivity.BACK_SHOULD_EXIT, true)
startActivity(i)
}
private fun startActivity(intent: Intent) {