Merge "Fix kotlin nullable errors in Launcher3" into main
This commit is contained in:
@@ -83,8 +83,8 @@ constructor(
|
||||
override fun onFinishInflate() {
|
||||
super.onFinishInflate()
|
||||
|
||||
content = findViewById(R.id.content)
|
||||
arrow = findViewById(R.id.arrow)
|
||||
content = requireViewById(R.id.content)
|
||||
arrow = requireViewById(R.id.arrow)
|
||||
arrow.background =
|
||||
RoundedArrowDrawable(
|
||||
arrowWidth,
|
||||
|
||||
@@ -95,7 +95,7 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
|
||||
tooltipStep = TOOLTIP_STEP_FEATURES
|
||||
inflateTooltip(R.layout.taskbar_edu_swipe)
|
||||
tooltip?.run {
|
||||
findViewById<LottieAnimationView>(R.id.swipe_animation).supportLightTheme()
|
||||
requireViewById<LottieAnimationView>(R.id.swipe_animation).supportLightTheme()
|
||||
show()
|
||||
}
|
||||
}
|
||||
@@ -114,10 +114,10 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
|
||||
tooltipStep = TOOLTIP_STEP_NONE
|
||||
inflateTooltip(R.layout.taskbar_edu_features)
|
||||
tooltip?.run {
|
||||
val splitscreenAnim = findViewById<LottieAnimationView>(R.id.splitscreen_animation)
|
||||
val suggestionsAnim = findViewById<LottieAnimationView>(R.id.suggestions_animation)
|
||||
val settingsAnim = findViewById<LottieAnimationView>(R.id.settings_animation)
|
||||
val settingsEdu = findViewById<View>(R.id.settings_edu)
|
||||
val splitscreenAnim = requireViewById<LottieAnimationView>(R.id.splitscreen_animation)
|
||||
val suggestionsAnim = requireViewById<LottieAnimationView>(R.id.suggestions_animation)
|
||||
val settingsAnim = requireViewById<LottieAnimationView>(R.id.settings_animation)
|
||||
val settingsEdu = requireViewById<View>(R.id.settings_edu)
|
||||
splitscreenAnim.supportLightTheme()
|
||||
suggestionsAnim.supportLightTheme()
|
||||
settingsAnim.supportLightTheme()
|
||||
@@ -175,7 +175,7 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
|
||||
private fun createAccessibilityDelegate() =
|
||||
object : View.AccessibilityDelegate() {
|
||||
override fun performAccessibilityAction(
|
||||
host: View?,
|
||||
host: View,
|
||||
action: Int,
|
||||
args: Bundle?
|
||||
): Boolean {
|
||||
@@ -186,22 +186,22 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
|
||||
return super.performAccessibilityAction(host, action, args)
|
||||
}
|
||||
|
||||
override fun onPopulateAccessibilityEvent(host: View?, event: AccessibilityEvent?) {
|
||||
override fun onPopulateAccessibilityEvent(host: View, event: AccessibilityEvent) {
|
||||
super.onPopulateAccessibilityEvent(host, event)
|
||||
if (event?.eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
|
||||
event.text?.add(host?.context?.getText(R.string.taskbar_edu_a11y_title))
|
||||
if (event.eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
|
||||
event.text.add(host.context?.getText(R.string.taskbar_edu_a11y_title))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onInitializeAccessibilityNodeInfo(
|
||||
host: View?,
|
||||
info: AccessibilityNodeInfo?
|
||||
host: View,
|
||||
info: AccessibilityNodeInfo
|
||||
) {
|
||||
super.onInitializeAccessibilityNodeInfo(host, info)
|
||||
info?.addAction(
|
||||
info.addAction(
|
||||
AccessibilityNodeInfo.AccessibilityAction(
|
||||
R.id.close,
|
||||
host?.context?.getText(R.string.taskbar_edu_close)
|
||||
host.context?.getText(R.string.taskbar_edu_close)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -192,13 +192,13 @@ class VoiceInteractionWindowController(val context: TaskbarActivityContext) :
|
||||
removeOnAttachStateChangeListener(pendingAttachedToWindowListener)
|
||||
pendingAttachedToWindowListener =
|
||||
object : View.OnAttachStateChangeListener {
|
||||
override fun onViewAttachedToWindow(v: View?) {
|
||||
override fun onViewAttachedToWindow(v: View) {
|
||||
onAttachedToWindow()
|
||||
removeOnAttachStateChangeListener(this)
|
||||
pendingAttachedToWindowListener = null
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(v: View?) {}
|
||||
override fun onViewDetachedFromWindow(v: View) {}
|
||||
}
|
||||
addOnAttachStateChangeListener(pendingAttachedToWindowListener)
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ abstract class AbstractNavButtonLayoutter(
|
||||
protected val endContextualContainer: ViewGroup,
|
||||
protected val startContextualContainer: ViewGroup
|
||||
) : NavButtonLayoutter {
|
||||
protected val homeButton: ImageView = navButtonContainer.findViewById(R.id.home)
|
||||
protected val recentsButton: ImageView = navButtonContainer.findViewById(R.id.recent_apps)
|
||||
protected val backButton: ImageView = navButtonContainer.findViewById(R.id.back)
|
||||
protected val homeButton: ImageView = navButtonContainer.requireViewById(R.id.home)
|
||||
protected val recentsButton: ImageView = navButtonContainer.requireViewById(R.id.recent_apps)
|
||||
protected val backButton: ImageView = navButtonContainer.requireViewById(R.id.back)
|
||||
}
|
||||
|
||||
@@ -60,11 +60,12 @@ class NavButtonLayoutFactory {
|
||||
isThreeButtonNav: Boolean,
|
||||
phoneMode: Boolean
|
||||
): NavButtonLayoutter {
|
||||
val navButtonContainer = navButtonsView.findViewById<LinearLayout>(ID_END_NAV_BUTTONS)
|
||||
val navButtonContainer =
|
||||
navButtonsView.requireViewById<LinearLayout>(ID_END_NAV_BUTTONS)
|
||||
val endContextualContainer =
|
||||
navButtonsView.findViewById<ViewGroup>(ID_END_CONTEXTUAL_BUTTONS)
|
||||
navButtonsView.requireViewById<ViewGroup>(ID_END_CONTEXTUAL_BUTTONS)
|
||||
val startContextualContainer =
|
||||
navButtonsView.findViewById<ViewGroup>(ID_START_CONTEXTUAL_BUTTONS)
|
||||
navButtonsView.requireViewById<ViewGroup>(ID_START_CONTEXTUAL_BUTTONS)
|
||||
val isPhoneNavMode = phoneMode && isThreeButtonNav
|
||||
return when {
|
||||
isPhoneNavMode -> {
|
||||
|
||||
@@ -121,7 +121,7 @@ class TaskMenuViewWithArrow<T : BaseDraggingActivity> : ArrowPopup<T> {
|
||||
|
||||
override fun onFinishInflate() {
|
||||
super.onFinishInflate()
|
||||
optionLayout = findViewById(R.id.menu_option_layout)
|
||||
optionLayout = requireViewById(R.id.menu_option_layout)
|
||||
}
|
||||
|
||||
private fun populateAndShowForTask(
|
||||
@@ -193,8 +193,8 @@ class TaskMenuViewWithArrow<T : BaseDraggingActivity> : ArrowPopup<T> {
|
||||
mActivityContext.layoutInflater.inflate(R.layout.task_view_menu_option, this, false)
|
||||
as LinearLayout
|
||||
menuOption.setIconAndLabelFor(
|
||||
menuOptionView.findViewById(R.id.icon),
|
||||
menuOptionView.findViewById(R.id.text)
|
||||
menuOptionView.requireViewById(R.id.icon),
|
||||
menuOptionView.requireViewById(R.id.text)
|
||||
)
|
||||
val lp = menuOptionView.layoutParams as LayoutParams
|
||||
lp.width = menuWidth
|
||||
|
||||
@@ -181,7 +181,7 @@ class GridSizeMigrationUtilTest {
|
||||
intentIndex = c.getColumnIndex(INTENT)
|
||||
val cellXIndex = c.getColumnIndex(CELLX)
|
||||
val cellYIndex = c.getColumnIndex(CELLY)
|
||||
val locMap = HashMap<String, Point>()
|
||||
val locMap = HashMap<String?, Point>()
|
||||
while (c.moveToNext()) {
|
||||
locMap[Intent.parseUri(c.getString(intentIndex), 0).getPackage()] =
|
||||
Point(c.getInt(cellXIndex), c.getInt(cellYIndex))
|
||||
@@ -424,13 +424,13 @@ class GridSizeMigrationUtilTest {
|
||||
c.close()
|
||||
}
|
||||
|
||||
private fun parseLocMap(context: Context, c: Cursor): Map<String, Triple<Int, Int, Int>> {
|
||||
private fun parseLocMap(context: Context, c: Cursor): Map<String?, Triple<Int, Int, Int>> {
|
||||
// Check workspace items
|
||||
val intentIndex = c.getColumnIndex(INTENT)
|
||||
val screenIndex = c.getColumnIndex(SCREEN)
|
||||
val cellXIndex = c.getColumnIndex(CELLX)
|
||||
val cellYIndex = c.getColumnIndex(CELLY)
|
||||
val locMap = mutableMapOf<String, Triple<Int, Int, Int>>()
|
||||
val locMap = mutableMapOf<String?, Triple<Int, Int, Int>>()
|
||||
while (c.moveToNext()) {
|
||||
locMap[Intent.parseUri(c.getString(intentIndex), 0).getPackage()] =
|
||||
Triple(c.getInt(screenIndex), c.getInt(cellXIndex), c.getInt(cellYIndex))
|
||||
@@ -606,7 +606,7 @@ class GridSizeMigrationUtilTest {
|
||||
val screenIndex = c.getColumnIndex(SCREEN)
|
||||
|
||||
// Get in which screen the icon is
|
||||
val locMap = HashMap<String, Int>()
|
||||
val locMap = HashMap<String?, Int>()
|
||||
while (c.moveToNext()) {
|
||||
locMap[Intent.parseUri(c.getString(intentIndex), 0).getPackage()] =
|
||||
c.getInt(screenIndex)
|
||||
@@ -668,7 +668,7 @@ class GridSizeMigrationUtilTest {
|
||||
val screenIndex = c.getColumnIndex(SCREEN)
|
||||
|
||||
// Get in which screen the icon is
|
||||
val locMap = HashMap<String, Int>()
|
||||
val locMap = HashMap<String?, Int>()
|
||||
while (c.moveToNext()) {
|
||||
locMap[Intent.parseUri(c.getString(intentIndex), 0).getPackage()] =
|
||||
c.getInt(screenIndex)
|
||||
@@ -728,7 +728,7 @@ class GridSizeMigrationUtilTest {
|
||||
val screenIndex = c.getColumnIndex(SCREEN)
|
||||
|
||||
// Get in which screen the icon is
|
||||
val locMap = HashMap<String, Int>()
|
||||
val locMap = HashMap<String?, Int>()
|
||||
while (c.moveToNext()) {
|
||||
locMap[Intent.parseUri(c.getString(intentIndex), 0).getPackage()] =
|
||||
c.getInt(screenIndex)
|
||||
|
||||
Reference in New Issue
Block a user