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

Commit 79464aed authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Remove padding and background from app icons in notifs

Bug: 335211019
Flag: ACONFIG android.app.notifications_use_app_icon DEVELOPMENT
Test: checked how different notification styles look with the flag
on/off

Change-Id: Ie2404b92117fe0463897319b77d5995c9a0dce31
parent 5e899586
Loading
Loading
Loading
Loading
+60 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.internal.widget;

import android.app.Flags;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RemoteViews;

import androidx.annotation.Nullable;

/**
 * An image view that holds the icon displayed on the left side of a notification row.
 */
@RemoteViews.RemoteView
public class NotificationRowIconView extends CachingIconView {
    public NotificationRowIconView(Context context) {
        super(context);
    }

    public NotificationRowIconView(Context context,
            @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public NotificationRowIconView(Context context, @Nullable AttributeSet attrs,
            int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public NotificationRowIconView(Context context, @Nullable AttributeSet attrs, int defStyleAttr,
            int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    protected void onFinishInflate() {
        // If showing the app icon, we don't need background or padding.
        if (Flags.notificationsUseAppIcon()) {
            setPadding(0, 0, 0, 0);
            setBackground(null);
        }

        super.onFinishInflate();
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@
        android:visibility="gone"
        />

    <com.android.internal.widget.CachingIconView
    <com.android.internal.widget.NotificationRowIconView
        android:id="@+id/icon"
        android:layout_width="@dimen/notification_icon_circle_size"
        android:layout_height="@dimen/notification_icon_circle_size"
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@
        android:visibility="gone"
        />

    <com.android.internal.widget.CachingIconView
    <com.android.internal.widget.NotificationRowIconView
        android:id="@+id/icon"
        android:layout_width="@dimen/notification_icon_circle_size"
        android:layout_height="@dimen/notification_icon_circle_size"
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
    android:gravity="center_vertical"
    android:theme="@style/Theme.DeviceDefault.Notification"
    android:importantForAccessibility="no">
    <com.android.internal.widget.CachingIconView
    <com.android.internal.widget.NotificationRowIconView
        android:id="@+id/icon"
        android:layout_width="@dimen/notification_icon_circle_size"
        android:layout_height="@dimen/notification_icon_circle_size"
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@
        android:visibility="gone"
        />

    <com.android.internal.widget.CachingIconView
    <com.android.internal.widget.NotificationRowIconView
        android:id="@+id/icon"
        android:layout_width="@dimen/notification_icon_circle_size"
        android:layout_height="@dimen/notification_icon_circle_size"
Loading