Merge "Controls - Remove 'power menu' from strings" into sc-dev am: 5881d68cd4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14602035

Change-Id: Ibb52db39bb0a2d0de6119084c76f515aacd648a6
This commit is contained in:
TreeHugger Robot
2021-05-17 22:34:54 +00:00
committed by Automerger Merge Worker
3 changed files with 18 additions and 32 deletions

View File

@@ -2718,15 +2718,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>
@@ -2755,7 +2748,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>
@@ -2847,7 +2840,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) {