NotificationSwipeActionHelper.java revision 920fd89aefee6b39aa634d6bb49c0669a86a63e3
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 15package com.android.systemui.plugins.statusbar; 16 17import com.android.systemui.plugins.annotations.DependsOn; 18import com.android.systemui.plugins.annotations.ProvidesInterface; 19import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption; 20 21import android.service.notification.SnoozeCriterion; 22import android.service.notification.StatusBarNotification; 23import android.view.MotionEvent; 24import android.view.View; 25import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; 26 27@ProvidesInterface(version = NotificationSwipeActionHelper.VERSION) 28@DependsOn(target = SnoozeOption.class) 29public 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 */ 37 public void dismiss(View animView, float velocity); 38 39 /** 40 * Call this to snap a notification to provided {@code targetLeft}. 41 */ 42 public void snap(View animView, float velocity, float targetLeft); 43 44 /** 45 * Call this to snooze a notification based on the provided {@link SnoozeOption}. 46 */ 47 public void snooze(StatusBarNotification sbn, SnoozeOption snoozeOption); 48 49 public float getMinDismissVelocity(); 50 51 public boolean isDismissGesture(MotionEvent ev); 52 53 public boolean isFalseGesture(MotionEvent ev); 54 55 public boolean swipedFarEnough(float translation, float viewSize); 56 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 63 public SnoozeCriterion getSnoozeCriterion(); 64 65 public CharSequence getDescription(); 66 67 public CharSequence getConfirmation(); 68 69 public int getMinutesToSnoozeFor(); 70 71 public AccessibilityAction getAccessibilityAction(); 72 } 73} 74