Ned Burns | c586467 | 2019-02-20 12:57:29 -0500 | [diff] [blame] | 1 | /* |
Ned Burns | 012048d | 2020-01-08 19:57:30 -0500 | [diff] [blame] | 2 | * Copyright (C) 2020 The Android Open Source Project |
Ned Burns | c586467 | 2019-02-20 12:57:29 -0500 | [diff] [blame] | 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 | |
Ned Burns | 012048d | 2020-01-08 19:57:30 -0500 | [diff] [blame] | 17 | package com.android.systemui.statusbar.notification.collection.inflation; |
Ned Burns | c586467 | 2019-02-20 12:57:29 -0500 | [diff] [blame] | 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; |
Ned Burns | 012048d | 2020-01-08 19:57:30 -0500 | [diff] [blame] | 24 | import com.android.systemui.statusbar.notification.collection.NotificationEntry; |
Kevin Han | bd14293 | 2020-03-10 18:27:50 -0700 | [diff] [blame] | 25 | import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder; |
Ned Burns | c586467 | 2019-02-20 12:57:29 -0500 | [diff] [blame] | 26 | |
| 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 | */ |
| 31 | public 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 Han | bd14293 | 2020-03-10 18:27:50 -0700 | [diff] [blame] | 41 | Runnable onDismissRunnable, |
| 42 | NotificationRowContentBinder.InflationCallback callback) |
Ned Burns | c586467 | 2019-02-20 12:57:29 -0500 | [diff] [blame] | 43 | 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 | } |