Fix tooltip crash and positioning
There was a missing attribute that was crashing on inflating the tooltip. Also, after adding animations, positioning was wrong. Test: manual Fixes: 154955165 Change-Id: I44b48e158e48f867e6268fc5493c3d9f987c617d
This commit is contained in:
@@ -670,6 +670,7 @@
|
||||
<item name="android:colorBackground">@android:color/black</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:statusBarColor">@*android:color/transparent</item>
|
||||
<item name="wallpaperTextColor">@*android:color/primary_text_material_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Control">
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.systemui.controls.management
|
||||
|
||||
import android.animation.Animator
|
||||
import android.animation.AnimatorListenerAdapter
|
||||
import android.app.ActivityOptions
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
@@ -163,7 +165,23 @@ class ControlsFavoritingActivity @Inject constructor(
|
||||
pageIndicator.visibility =
|
||||
if (listOfStructures.size > 1) View.VISIBLE else View.GONE
|
||||
|
||||
ControlsAnimations.enterAnimation(pageIndicator).start()
|
||||
ControlsAnimations.enterAnimation(pageIndicator).apply {
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
// Position the tooltip if necessary after animations are complete
|
||||
// so we can get the position on screen. The tooltip is not
|
||||
// rooted in the layout root.
|
||||
if (pageIndicator.visibility == View.VISIBLE &&
|
||||
mTooltipManager != null) {
|
||||
val p = IntArray(2)
|
||||
pageIndicator.getLocationOnScreen(p)
|
||||
val x = p[0] + pageIndicator.width / 2
|
||||
val y = p[1] + pageIndicator.height
|
||||
mTooltipManager?.show(R.string.controls_structure_tooltip, x, y)
|
||||
}
|
||||
}
|
||||
})
|
||||
}.start()
|
||||
ControlsAnimations.enterAnimation(structurePager).start()
|
||||
}
|
||||
}, Consumer { runnable -> cancelLoadRunnable = runnable })
|
||||
@@ -225,27 +243,6 @@ class ControlsFavoritingActivity @Inject constructor(
|
||||
}
|
||||
pageIndicator = requireViewById<ManagementPageIndicator>(
|
||||
R.id.structure_page_indicator).apply {
|
||||
addOnLayoutChangeListener(object : View.OnLayoutChangeListener {
|
||||
override fun onLayoutChange(
|
||||
v: View,
|
||||
left: Int,
|
||||
top: Int,
|
||||
right: Int,
|
||||
bottom: Int,
|
||||
oldLeft: Int,
|
||||
oldTop: Int,
|
||||
oldRight: Int,
|
||||
oldBottom: Int
|
||||
) {
|
||||
if (v.visibility == View.VISIBLE && mTooltipManager != null) {
|
||||
val p = IntArray(2)
|
||||
v.getLocationOnScreen(p)
|
||||
val x = p[0] + (right - left) / 2
|
||||
val y = p[1] + bottom - top
|
||||
mTooltipManager?.show(R.string.controls_structure_tooltip, x, y)
|
||||
}
|
||||
}
|
||||
})
|
||||
visibilityListener = {
|
||||
if (it != View.VISIBLE) {
|
||||
mTooltipManager?.hide(true)
|
||||
|
||||
Reference in New Issue
Block a user