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

Commit 577441d1 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[Chipbar] Update font weight and spacing after button.

Bug: 267821684
Test: media push to receiver flow w/ app icon (light & dark theme)
Test: media pull to phone flow w/ generic icon (light & dark theme)
Test: active unlock flow (light & dark theme)

Change-Id: I7f11c26e55454aa614747aab65d330b33114269c
parent f304ffc9
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:textSize="@dimen/chipbar_text_size"
            style="@style/Chipbar.Text"
            android:textColor="@color/chipbar_text_and_icon_color"
            android:alpha="0.0"
            />
@@ -84,9 +84,9 @@
            android:id="@+id/end_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="?androidprv:attr/textColorOnAccent"
            android:layout_marginStart="@dimen/chipbar_end_item_start_margin"
            android:textSize="@dimen/chipbar_text_size"
            style="@style/Chipbar.Text"
            android:textColor="?androidprv:attr/textColorOnAccent"
            android:paddingStart="@dimen/chipbar_outer_padding"
            android:paddingEnd="@dimen/chipbar_outer_padding"
            android:paddingTop="@dimen/chipbar_end_button_vertical_padding"
+1 −0
Original line number Diff line number Diff line
@@ -1110,6 +1110,7 @@
    <!-- Chipbar -->
    <!-- (Used for media tap-to-transfer chip for sender device and active unlock) -->
    <dimen name="chipbar_outer_padding">16dp</dimen>
    <dimen name="chipbar_outer_padding_half">8dp</dimen>
    <dimen name="chipbar_text_size">16sp</dimen>
    <dimen name="chipbar_start_icon_size">24dp</dimen>
    <dimen name="chipbar_end_icon_size">20dp</dimen>
+9 −0
Original line number Diff line number Diff line
@@ -70,6 +70,15 @@
        <item name="android:fontWeight">700</item>
    </style>

    <style name="Chipbar" />

    <style name="Chipbar.Text" parent="@*android:style/TextAppearance.DeviceDefault.Notification.Title">
        <!-- Text size should be kept in sync with the notification conversation header size. (The
             conversation header doesn't have a defined style, so the size must be copied here.)
             See notification_template_conversation_header.xml. -->
        <item name="android:textSize">16sp</item>
    </style>

    <style name="TextAppearance" />

    <style name="TextAppearance.QS">
+19 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.view.WindowManager
import android.view.accessibility.AccessibilityManager
import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.DimenRes
import androidx.annotation.IdRes
import androidx.annotation.VisibleForTesting
import com.android.internal.widget.CachingIconView
@@ -180,8 +181,9 @@ constructor(

        // Button
        val buttonView = currentView.requireViewById<TextView>(R.id.end_button)
        if (newInfo.endItem is ChipbarEndItem.Button) {
            TextViewBinder.bind(buttonView, newInfo.endItem.text)
        val hasButton = newInfo.endItem is ChipbarEndItem.Button
        if (hasButton) {
            TextViewBinder.bind(buttonView, (newInfo.endItem as ChipbarEndItem.Button).text)

            val onClickListener =
                View.OnClickListener { clickedView ->
@@ -196,6 +198,12 @@ constructor(
            buttonView.visibility = View.GONE
        }

        currentView
            .getInnerView()
            .setEndPadding(
                if (hasButton) R.dimen.chipbar_outer_padding_half else R.dimen.chipbar_outer_padding
            )

        // ---- Overall accessibility ----
        val iconDesc = newInfo.startIcon.icon.contentDescription
        val loadedIconDesc =
@@ -309,6 +317,15 @@ constructor(
        viewUtil.setRectToViewWindowLocation(view, outRect)
    }

    private fun View.setEndPadding(@DimenRes endPaddingDimen: Int) {
        this.setPaddingRelative(
            this.paddingStart,
            this.paddingTop,
            context.resources.getDimensionPixelSize(endPaddingDimen),
            this.paddingBottom,
        )
    }

    private fun Boolean.visibleIfTrue(): Int {
        return if (this) {
            View.VISIBLE