Add FSI view
Bug: 243421660 Test: visual Change-Id: Ibb3f15cdba8c139235d3f43572f1a6844c7cdbb6
This commit is contained in:
49
packages/SystemUI/res-keyguard/layout/fsi_chrome_view.xml
Normal file
49
packages/SystemUI/res-keyguard/layout/fsi_chrome_view.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.android.systemui.statusbar.notification.fsi.FsiChromeView android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="50dp"
|
||||
android:orientation="vertical"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/fsi_chrome"
|
||||
android:layout_height="50dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fsi_app_icon"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fsi_app_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="10dp"
|
||||
android:textSize="22dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="AppName" />
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/fsi_fullscreen_button"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="fullscreen" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/fsi_dismiss_button"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="dismiss" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.systemui.statusbar.notification.fsi.FsiChromeView>
|
||||
@@ -218,6 +218,9 @@
|
||||
<!-- Radius for notifications corners with adjacent notifications -->
|
||||
<dimen name="notification_corner_radius_small">4dp</dimen>
|
||||
|
||||
<!-- Vertical padding of the FSI container -->
|
||||
<dimen name="fsi_chrome_vertical_padding">80dp</dimen>
|
||||
|
||||
<!-- the padding of the shelf icon container -->
|
||||
<dimen name="shelf_icon_container_padding">13dp</dimen>
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.android.systemui.statusbar.notification.fsi
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.Color.DKGRAY
|
||||
import android.graphics.Outline
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.ViewOutlineProvider
|
||||
import android.widget.Button
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.dagger.SysUISingleton
|
||||
import com.android.systemui.statusbar.notification.fsi.FsiDebug.Companion.log
|
||||
|
||||
@SysUISingleton
|
||||
class FsiChromeView
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0,
|
||||
defStyleRes: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr, defStyleRes) {
|
||||
|
||||
companion object {
|
||||
private const val classTag = "FsiChromeView"
|
||||
}
|
||||
|
||||
lateinit var chromeContainer: LinearLayout
|
||||
lateinit var appIconImageView: ImageView
|
||||
lateinit var appNameTextView: TextView
|
||||
lateinit var dismissButton: Button
|
||||
lateinit var fullscreenButton: Button
|
||||
|
||||
private val cornerRadius: Float =
|
||||
resources.getDimensionPixelSize(R.dimen.notification_corner_radius).toFloat()
|
||||
private val vertPadding: Int =
|
||||
resources.getDimensionPixelSize(R.dimen.fsi_chrome_vertical_padding)
|
||||
private val sidePadding: Int =
|
||||
resources.getDimensionPixelSize(R.dimen.notification_side_paddings)
|
||||
|
||||
init {
|
||||
log("$classTag init")
|
||||
}
|
||||
|
||||
override fun onFinishInflate() {
|
||||
log("$classTag onFinishInflate")
|
||||
super.onFinishInflate()
|
||||
|
||||
setBackgroundColor(Color.TRANSPARENT)
|
||||
setPadding(
|
||||
sidePadding,
|
||||
vertPadding,
|
||||
sidePadding,
|
||||
vertPadding
|
||||
) // Make smaller than fullscreen.
|
||||
|
||||
chromeContainer = findViewById(R.id.fsi_chrome)
|
||||
chromeContainer.setBackgroundColor(DKGRAY)
|
||||
|
||||
appIconImageView = findViewById(R.id.fsi_app_icon)
|
||||
appNameTextView = findViewById(R.id.fsi_app_name)
|
||||
dismissButton = findViewById(R.id.fsi_dismiss_button)
|
||||
fullscreenButton = findViewById(R.id.fsi_fullscreen_button)
|
||||
|
||||
outlineProvider =
|
||||
object : ViewOutlineProvider() {
|
||||
override fun getOutline(view: View, outline: Outline) {
|
||||
outline.setRoundRect(
|
||||
/* left */ sidePadding,
|
||||
/* top */ vertPadding,
|
||||
/* right */ view.width - sidePadding,
|
||||
/* bottom */ view.height - vertPadding,
|
||||
cornerRadius
|
||||
)
|
||||
}
|
||||
}
|
||||
clipToOutline = true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user