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

Commit 52aa023c authored by Ioana Alexandru's avatar Ioana Alexandru Committed by Android (Google) Code Review
Browse files

Merge "Remove padding and background from app icons in notifs" into main

parents 73a196df 79464aed
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