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 android.service.notification.SnoozeCriterion; 18 import android.service.notification.StatusBarNotification; 19 import android.view.MotionEvent; 20 import android.view.View; 21 import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; 22 23 import com.android.systemui.plugins.annotations.DependsOn; 24 import com.android.systemui.plugins.annotations.ProvidesInterface; 25 import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption; 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 53 /** Returns true if the gesture should be rejected. */ isFalseGesture()54 boolean isFalseGesture(); 55 swipedFarEnough(float translation, float viewSize)56 public boolean swipedFarEnough(float translation, float viewSize); 57 swipedFastEnough(float translation, float velocity)58 public boolean swipedFastEnough(float translation, float velocity); 59 60 @ProvidesInterface(version = SnoozeOption.VERSION) 61 public interface SnoozeOption { 62 public static final int VERSION = 2; 63 getSnoozeCriterion()64 public SnoozeCriterion getSnoozeCriterion(); 65 getDescription()66 public CharSequence getDescription(); 67 getConfirmation()68 public CharSequence getConfirmation(); 69 getMinutesToSnoozeFor()70 public int getMinutesToSnoozeFor(); 71 getAccessibilityAction()72 public AccessibilityAction getAccessibilityAction(); 73 } 74 } 75