Use Theme.SystemUI.Dialog for the TileRequest dialog

Also, use textColorOnAccent for the text and icon in an active tile so
the dialog displays correctly in light mode.

Test: manual, dialog and QS
Fixes: 207668351
Change-Id: Iadb68373827d50b9f2eff5f8c1425c7ce5ef05a6
This commit is contained in:
Fabian Kozynski
2021-11-24 12:42:38 -05:00
parent b08fc1d6e4
commit b1444e4dc1
6 changed files with 5 additions and 39 deletions

View File

@@ -30,7 +30,6 @@
android:layout_marginBottom="16dp"
android:textDirection="locale"
android:textAlignment="viewStart"
android:textAppearance="@style/TextAppearance.PrivacyDialog"
android:lineHeight="20sp"
android:textAppearance="@style/TextAppearance.Dialog.Body"
/>
</LinearLayout>

View File

@@ -654,16 +654,6 @@
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
</style>
<!-- TileService request dialog -->
<style name="TileRequestDialog" parent="Theme.SystemUI.QuickSettings.Dialog">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@drawable/qs_dialog_bg</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowCloseOnTouchOutside">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
</style>
<!-- USB Contaminant dialog -->
<style name ="USBContaminant" />

View File

@@ -18,11 +18,8 @@ package com.android.systemui.qs.external
import android.content.Context
import android.graphics.drawable.Icon
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.view.WindowInsets
import android.widget.TextView
import com.android.systemui.R
import com.android.systemui.plugins.qs.QSTile
@@ -38,25 +35,12 @@ import com.android.systemui.statusbar.phone.SystemUIDialog
*/
class TileRequestDialog(
context: Context
) : SystemUIDialog(context, R.style.TileRequestDialog) {
) : SystemUIDialog(context) {
companion object {
internal val CONTENT_ID = R.id.content
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window?.apply {
attributes.fitInsetsTypes = attributes.fitInsetsTypes or WindowInsets.Type.statusBars()
attributes.receiveInsetsIgnoringZOrder = true
setLayout(
context.resources
.getDimensionPixelSize(R.dimen.qs_tile_service_request_dialog_width),
WRAP_CONTENT
)
}
}
/**
* Set the data of the tile to add, to show the user.
*/
@@ -76,9 +60,7 @@ class TileRequestDialog(
context.resources.getDimensionPixelSize(R.dimen.qs_quick_tile_size)
)
}
val spacing = context.resources.getDimensionPixelSize(
R.dimen.qs_tile_service_request_content_space
)
val spacing = 0
setView(ll, spacing, spacing, spacing, spacing / 2)
}

View File

@@ -253,7 +253,7 @@ public class QSIconViewImpl extends QSIconView {
return Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary);
case Tile.STATE_ACTIVE:
return Utils.getColorAttrDefaultColor(context,
android.R.attr.textColorPrimaryInverse);
com.android.internal.R.attr.textColorOnAccent);
default:
Log.e("QSIconView", "Invalid state " + state);
return 0;

View File

@@ -88,7 +88,7 @@ open class QSTileViewImpl @JvmOverloads constructor(
private val colorUnavailable = Utils.applyAlpha(UNAVAILABLE_ALPHA, colorInactive)
private val colorLabelActive =
Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimaryInverse)
Utils.getColorAttrDefaultColor(context, com.android.internal.R.attr.textColorOnAccent)
private val colorLabelInactive =
Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary)
private val colorLabelUnavailable = Utils.applyAlpha(UNAVAILABLE_ALPHA, colorLabelInactive)

View File

@@ -59,11 +59,6 @@ class TileRequestDialogTest : SysuiTestCase() {
}
}
@Test
fun useCorrectTheme() {
assertThat(dialog.context.themeResId).isEqualTo(R.style.TileRequestDialog)
}
@Test
fun setTileData_hasCorrectViews() {
val icon = Icon.createWithResource(mContext, R.drawable.cloud)