195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor/* 295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * Copyright (C) 2017 The Android Open Source Project 395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * 495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file 595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * except in compliance with the License. You may obtain a copy of the License at 695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * 795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * http://www.apache.org/licenses/LICENSE-2.0 895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * 995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * Unless required by applicable law or agreed to in writing, software distributed under the 1095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * KIND, either express or implied. See the License for the specific language governing 1295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * permissions and limitations under the License. 1395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor */ 1495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 1595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorpackage com.android.systemui.plugins.statusbar; 1695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 1795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport android.content.Context; 184ab2820e6c668ae7c55b300f126bb9f70c202ba3Mady Mellorimport android.service.notification.StatusBarNotification; 1995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport android.view.MotionEvent; 2095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport android.view.View; 2195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport android.view.ViewGroup; 2295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 2395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport java.util.ArrayList; 2495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 2595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.Plugin; 2695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.annotations.DependsOn; 2795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.annotations.ProvidesInterface; 2895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.OnMenuEventListener; 2995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption; 3095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem; 3195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 3295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor@ProvidesInterface(action = NotificationMenuRowPlugin.ACTION, 3395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor version = NotificationMenuRowPlugin.VERSION) 3495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor@DependsOn(target = OnMenuEventListener.class) 3595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor@DependsOn(target = MenuItem.class) 3695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor@DependsOn(target = NotificationSwipeActionHelper.class) 3795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor@DependsOn(target = SnoozeOption.class) 3895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorpublic interface NotificationMenuRowPlugin extends Plugin { 3995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 4095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public static final String ACTION = "com.android.systemui.action.PLUGIN_NOTIFICATION_MENU_ROW"; 414ab2820e6c668ae7c55b300f126bb9f70c202ba3Mady Mellor public static final int VERSION = 3; 4295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 4395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor @ProvidesInterface(version = OnMenuEventListener.VERSION) 4495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public interface OnMenuEventListener { 4595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public static final int VERSION = 1; 4695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public void onMenuClicked(View row, int x, int y, MenuItem menu); 4795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 4895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public void onMenuReset(View row); 4995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 5095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public void onMenuShown(View row); 5195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor } 5295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 5395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor @ProvidesInterface(version = MenuItem.VERSION) 5495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public interface MenuItem { 5595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public static final int VERSION = 1; 5695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public View getMenuView(); 5795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 5895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public View getGutsView(); 5995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 6095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public String getContentDescription(); 6195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor } 6295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 6395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor /** 6495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * @return a list of items to populate the menu 'behind' a notification. 6595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor */ 6695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public ArrayList<MenuItem> getMenuItems(Context context); 6795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 6895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor /** 6995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor * @return the {@link MenuItem} to display when a notification is long pressed. 7095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor */ 7195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public MenuItem getLongpressMenuItem(Context context); 7295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 7395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public void setMenuItems(ArrayList<MenuItem> items); 7495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 7595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public void setMenuClickListener(OnMenuEventListener listener); 7695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 7795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public void setSwipeActionHelper(NotificationSwipeActionHelper listener); 7895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 7995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public void setAppName(String appName); 8095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 814ab2820e6c668ae7c55b300f126bb9f70c202ba3Mady Mellor public void createMenu(ViewGroup parent, StatusBarNotification sbn); 8295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 8395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public View getMenuView(); 8495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 8595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public boolean isMenuVisible(); 8695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 8795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public void resetMenu(); 8895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 8995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public void onTranslationUpdate(float translation); 9095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 9195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public void onHeightUpdate(); 9295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 934ab2820e6c668ae7c55b300f126bb9f70c202ba3Mady Mellor public void onNotificationUpdated(StatusBarNotification sbn); 944c19760b9131a67b379f9b7060c5830cb5beaad7Mady Mellor 9595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public boolean onTouchEvent(View view, MotionEvent ev, float velocity); 9695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor 974ab2820e6c668ae7c55b300f126bb9f70c202ba3Mady Mellor public default boolean onInterceptTouchEvent(View view, MotionEvent ev) { 984ab2820e6c668ae7c55b300f126bb9f70c202ba3Mady Mellor return false; 994ab2820e6c668ae7c55b300f126bb9f70c202ba3Mady Mellor } 1004ab2820e6c668ae7c55b300f126bb9f70c202ba3Mady Mellor 10195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor public default boolean useDefaultMenuItems() { 10295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor return false; 10395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor } 1049d03a5254f5c7ac00071d56b91ddc15a3d761ed6Mady Mellor 1059d03a5254f5c7ac00071d56b91ddc15a3d761ed6Mady Mellor public default void onConfigurationChanged() { 1069d03a5254f5c7ac00071d56b91ddc15a3d761ed6Mady Mellor } 10795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor} 108