NotificationMenuRowPlugin.java revision 9d03a5254f5c7ac00071d56b91ddc15a3d761ed6
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;
1895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport android.view.MotionEvent;
1995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport android.view.View;
2095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport android.view.ViewGroup;
2195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
2295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport java.util.ArrayList;
2395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
2495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.Plugin;
2595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.annotations.DependsOn;
2695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.annotations.ProvidesInterface;
2795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.OnMenuEventListener;
2895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption;
2995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorimport com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem;
3095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
3195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor@ProvidesInterface(action = NotificationMenuRowPlugin.ACTION,
3295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor        version = NotificationMenuRowPlugin.VERSION)
3395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor@DependsOn(target = OnMenuEventListener.class)
3495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor@DependsOn(target = MenuItem.class)
3595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor@DependsOn(target = NotificationSwipeActionHelper.class)
3695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor@DependsOn(target = SnoozeOption.class)
3795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellorpublic interface NotificationMenuRowPlugin extends Plugin {
3895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
3995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public static final String ACTION = "com.android.systemui.action.PLUGIN_NOTIFICATION_MENU_ROW";
404c19760b9131a67b379f9b7060c5830cb5beaad7Mady Mellor    public static final int VERSION = 2;
4195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
4295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    @ProvidesInterface(version = OnMenuEventListener.VERSION)
4395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public interface OnMenuEventListener {
4495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor        public static final int VERSION = 1;
4595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor        public void onMenuClicked(View row, int x, int y, MenuItem menu);
4695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
4795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor        public void onMenuReset(View row);
4895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
4995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor        public void onMenuShown(View row);
5095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    }
5195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
5295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    @ProvidesInterface(version = MenuItem.VERSION)
5395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public interface MenuItem {
5495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor        public static final int VERSION = 1;
5595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor        public View getMenuView();
5695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
5795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor        public View getGutsView();
5895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
5995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor        public String getContentDescription();
6095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    }
6195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
6295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    /**
6395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor     * @return a list of items to populate the menu 'behind' a notification.
6495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor     */
6595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public ArrayList<MenuItem> getMenuItems(Context context);
6695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
6795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    /**
6895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor     * @return the {@link MenuItem} to display when a notification is long pressed.
6995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor     */
7095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public MenuItem getLongpressMenuItem(Context context);
7195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
7295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public void setMenuItems(ArrayList<MenuItem> items);
7395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
7495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public void setMenuClickListener(OnMenuEventListener listener);
7595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
7695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public void setSwipeActionHelper(NotificationSwipeActionHelper listener);
7795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
7895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public void setAppName(String appName);
7995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
8095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public void createMenu(ViewGroup parent);
8195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
8295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public View getMenuView();
8395d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
8495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public boolean isMenuVisible();
8595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
8695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public void resetMenu();
8795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
8895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public void onTranslationUpdate(float translation);
8995d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
9095d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public void onHeightUpdate();
9195d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
924c19760b9131a67b379f9b7060c5830cb5beaad7Mady Mellor    public void onNotificationUpdated();
934c19760b9131a67b379f9b7060c5830cb5beaad7Mady Mellor
9495d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public boolean onTouchEvent(View view, MotionEvent ev, float velocity);
9595d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor
9695d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    public default boolean useDefaultMenuItems() {
9795d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor        return false;
9895d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor    }
999d03a5254f5c7ac00071d56b91ddc15a3d761ed6Mady Mellor
1009d03a5254f5c7ac00071d56b91ddc15a3d761ed6Mady Mellor    public default void onConfigurationChanged() {
1019d03a5254f5c7ac00071d56b91ddc15a3d761ed6Mady Mellor    }
10295d743c38c919dd500d9dcacf9f998500d403d9eMady Mellor}
103