• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
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 
17 package com.android.systemui.statusbar.notification.collection;
18 
19 import android.annotation.Nullable;
20 
21 import com.android.systemui.statusbar.NotificationUiAdjustment;
22 import com.android.systemui.statusbar.notification.InflationException;
23 import com.android.systemui.statusbar.notification.NotificationEntryManager;
24 
25 /**
26  * Used by the {@link NotificationEntryManager}. When notifications are added or updated, the binder
27  * is asked to (re)inflate and prepare their views. This inflation must occur off the main thread.
28  */
29 public interface NotificationRowBinder {
30     /**
31      * Called when a notification has been added or updated. The binder must asynchronously inflate
32      * and bind the views associated with the notification.
33      *
34      * TODO: The caller is notified when the inflation completes, but this is currently a very
35      * roundabout business. Add an explicit completion/failure callback to this method.
36      */
inflateViews( NotificationEntry entry, Runnable onDismissRunnable)37     void inflateViews(
38             NotificationEntry entry,
39             Runnable onDismissRunnable)
40             throws InflationException;
41 
42     /**
43      * Called when the ranking has been updated (but not add or remove has been done). The binder
44      * should inspect the old and new adjustments and re-inflate the entry's views if necessary
45      * (e.g. if something important changed).
46      */
onNotificationRankingUpdated( NotificationEntry entry, @Nullable Integer oldImportance, NotificationUiAdjustment oldAdjustment, NotificationUiAdjustment newAdjustment)47     void onNotificationRankingUpdated(
48             NotificationEntry entry,
49             @Nullable Integer oldImportance,
50             NotificationUiAdjustment oldAdjustment,
51             NotificationUiAdjustment newAdjustment);
52 }
53