blob: f4c4924b4b9aeb0bb263b37302feebdd113c0bd0 [file] [log] [blame]
Ned Burnsc5864672019-02-20 12:57:29 -05001/*
Ned Burns012048d2020-01-08 19:57:30 -05002 * Copyright (C) 2020 The Android Open Source Project
Ned Burnsc5864672019-02-20 12:57:29 -05003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Ned Burns012048d2020-01-08 19:57:30 -050017package com.android.systemui.statusbar.notification.collection.inflation;
Ned Burnsc5864672019-02-20 12:57:29 -050018
19import android.annotation.Nullable;
20
21import com.android.systemui.statusbar.NotificationUiAdjustment;
22import com.android.systemui.statusbar.notification.InflationException;
23import com.android.systemui.statusbar.notification.NotificationEntryManager;
Ned Burns012048d2020-01-08 19:57:30 -050024import com.android.systemui.statusbar.notification.collection.NotificationEntry;
Kevin Hanbd142932020-03-10 18:27:50 -070025import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder;
Ned Burnsc5864672019-02-20 12:57:29 -050026
27/**
28 * Used by the {@link NotificationEntryManager}. When notifications are added or updated, the binder
29 * is asked to (re)inflate and prepare their views. This inflation must occur off the main thread.
30 */
31public interface NotificationRowBinder {
32 /**
33 * Called when a notification has been added or updated. The binder must asynchronously inflate
34 * and bind the views associated with the notification.
35 *
36 * TODO: The caller is notified when the inflation completes, but this is currently a very
37 * roundabout business. Add an explicit completion/failure callback to this method.
38 */
39 void inflateViews(
40 NotificationEntry entry,
Kevin Hanbd142932020-03-10 18:27:50 -070041 Runnable onDismissRunnable,
42 NotificationRowContentBinder.InflationCallback callback)
Ned Burnsc5864672019-02-20 12:57:29 -050043 throws InflationException;
44
45 /**
46 * Called when the ranking has been updated (but not add or remove has been done). The binder
47 * should inspect the old and new adjustments and re-inflate the entry's views if necessary
48 * (e.g. if something important changed).
49 */
50 void onNotificationRankingUpdated(
51 NotificationEntry entry,
52 @Nullable Integer oldImportance,
53 NotificationUiAdjustment oldAdjustment,
54 NotificationUiAdjustment newAdjustment);
55}