Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b75ba9b6 authored by Luca Zuccarini's avatar Luca Zuccarini
Browse files

Move some base launchable views to the animation library.

This is so that Launcher can also use them. Also creates a
LaunchableTextview.

Bug: 250588519
Test: manual
Change-Id: I5efd2fbe4fd35629d9422bb515fc7e62a4f1f138
parent 1ca9fd74
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
 *
 */

package com.android.systemui.common.ui.view
package com.android.systemui.animation.view

import android.content.Context
import android.util.AttributeSet
@@ -23,6 +23,7 @@ import android.widget.ImageView
import com.android.systemui.animation.LaunchableView
import com.android.systemui.animation.LaunchableViewDelegate

/** An [ImageView] that also implements [LaunchableView]. */
class LaunchableImageView : ImageView, LaunchableView {
    private val delegate =
        LaunchableViewDelegate(
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.systemui.common.ui.view
package com.android.systemui.animation.view

import android.content.Context
import android.util.AttributeSet
+49 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.android.systemui.animation.view

import android.content.Context
import android.util.AttributeSet
import android.widget.TextView
import com.android.systemui.animation.LaunchableView
import com.android.systemui.animation.LaunchableViewDelegate

/** A [TextView] that also implements [LaunchableView]. */
class LaunchableTextView : TextView, LaunchableView {
    private val delegate =
        LaunchableViewDelegate(
            this,
            superSetVisibility = { super.setVisibility(it) },
        )

    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
    constructor(
        context: Context?,
        attrs: AttributeSet?,
        defStyleAttr: Int,
    ) : super(context, attrs, defStyleAttr)

    override fun setShouldBlockVisibilityChanges(block: Boolean) {
        delegate.setShouldBlockVisibilityChanges(block)
    }

    override fun setVisibility(visibility: Int) {
        delegate.setVisibility(visibility)
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.systemui.common.ui.view.LaunchableLinearLayout
<com.android.systemui.animation.view.LaunchableLinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="0dp"
    android:layout_height="@dimen/qs_security_footer_single_line_height"
@@ -63,4 +63,4 @@
        android:src="@*android:drawable/ic_chevron_end"
        android:autoMirrored="true"
        android:tint="?android:attr/textColorSecondary" />
</com.android.systemui.common.ui.view.LaunchableLinearLayout>
 No newline at end of file
</com.android.systemui.animation.view.LaunchableLinearLayout>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
    android:layout_width="wrap_content"
    android:paddingVertical="@dimen/dream_overlay_complication_home_controls_padding">

    <com.android.systemui.common.ui.view.LaunchableImageView
    <com.android.systemui.animation.view.LaunchableImageView
        android:id="@+id/home_controls_chip"
        android:layout_height="@dimen/keyguard_affordance_fixed_height"
        android:layout_width="@dimen/keyguard_affordance_fixed_width"
Loading