1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file 5 * except in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the 10 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 11 * KIND, either express or implied. See the License for the specific language governing 12 * permissions and limitations under the License. 13 */ 14 15 package com.android.systemui.plugins.statusbar; 16 17 import com.android.systemui.plugins.annotations.DependsOn; 18 import com.android.systemui.plugins.annotations.ProvidesInterface; 19 import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption; 20 21 import android.service.notification.SnoozeCriterion; 22 import android.service.notification.StatusBarNotification; 23 import android.view.MotionEvent; 24 import android.view.View; 25 import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; 26 27 @ProvidesInterface(version = NotificationSwipeActionHelper.VERSION) 28 @DependsOn(target = SnoozeOption.class) 29 public interface NotificationSwipeActionHelper { 30 public static final String ACTION = "com.android.systemui.action.PLUGIN_NOTIFICATION_SWIPE_ACTION"; 31 32 public static final int VERSION = 1; 33 34 /** 35 * Call this to dismiss a notification. 36 */ dismiss(View animView, float velocity)37 public void dismiss(View animView, float velocity); 38 39 /** 40 * Call this to snap a notification to provided {@code targetLeft}. 41 */ snapOpen(View animView, int targetLeft, float velocity)42 public void snapOpen(View animView, int targetLeft, float velocity); 43 44 /** 45 * Call this to snooze a notification based on the provided {@link SnoozeOption}. 46 */ snooze(StatusBarNotification sbn, SnoozeOption snoozeOption)47 public void snooze(StatusBarNotification sbn, SnoozeOption snoozeOption); 48 getMinDismissVelocity()49 public float getMinDismissVelocity(); 50 isDismissGesture(MotionEvent ev)51 public boolean isDismissGesture(MotionEvent ev); 52 isFalseGesture(MotionEvent ev)53 public boolean isFalseGesture(MotionEvent ev); 54 swipedFarEnough(float translation, float viewSize)55 public boolean swipedFarEnough(float translation, float viewSize); 56 swipedFastEnough(float translation, float velocity)57 public boolean swipedFastEnough(float translation, float velocity); 58 59 @ProvidesInterface(version = SnoozeOption.VERSION) 60 public interface SnoozeOption { 61 public static final int VERSION = 2; 62 getSnoozeCriterion()63 public SnoozeCriterion getSnoozeCriterion(); 64 getDescription()65 public CharSequence getDescription(); 66 getConfirmation()67 public CharSequence getConfirmation(); 68 getMinutesToSnoozeFor()69 public int getMinutesToSnoozeFor(); 70 getAccessibilityAction()71 public AccessibilityAction getAccessibilityAction(); 72 } 73 } 74