16c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira/* 26c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * Copyright (C) 2012 Google Inc. 36c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * Licensed to The Android Open Source Project. 46c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * 56c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * Licensed under the Apache License, Version 2.0 (the "License"); 66c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * you may not use this file except in compliance with the License. 76c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * You may obtain a copy of the License at 86c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * 96c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * http://www.apache.org/licenses/LICENSE-2.0 106c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * 116c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * Unless required by applicable law or agreed to in writing, software 126c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * distributed under the License is distributed on an "AS IS" BASIS, 136c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 146c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * See the License for the specific language governing permissions and 156c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * limitations under the License. 166c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira */ 176c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira 186c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereirapackage com.android.mail.ui; 196c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira 206c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereiraimport android.view.View; 216c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira 226c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira/** 236c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira * Represents an item that can be dismissed by the SwipeableListView. 246c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira */ 256c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereirapublic interface SwipeableItemView { 262102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei public SwipeableView getSwipeableView(); 276c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira 28a538984fcc19e7624f2650b119ede39bf1f35846mindyp public boolean canChildBeDismissed(); 29a538984fcc19e7624f2650b119ede39bf1f35846mindyp 30a538984fcc19e7624f2650b119ede39bf1f35846mindyp public void dismiss(); 31d064972c4a032f3c5cfcb236aa470273f7ac2ce0mindyp 3237a20ca39be842b4b4cb54d5b5ed418d49d950cfVikram Aggarwal /** 3337a20ca39be842b4b4cb54d5b5ed418d49d950cfVikram Aggarwal * Returns the minimum allowed displacement in the Y axis that is considered a scroll. After 3437a20ca39be842b4b4cb54d5b5ed418d49d950cfVikram Aggarwal * this displacement, all future events are considered scroll events rather than swipes. 3537a20ca39be842b4b4cb54d5b5ed418d49d950cfVikram Aggarwal * @return 3637a20ca39be842b4b4cb54d5b5ed418d49d950cfVikram Aggarwal */ 37d064972c4a032f3c5cfcb236aa470273f7ac2ce0mindyp public float getMinAllowScrollDistance(); 382102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei 392102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei public static class SwipeableView { 402102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei public static SwipeableView from(View view) { 412102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei view.setClickable(true); 422102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei return new SwipeableView(view); 432102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei } 442102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei 452102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei private final View mView; 462102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei private SwipeableView(View view) { 472102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei mView = view; 482102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei } 492102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei 502102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei public View getView() { 512102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei return mView; 522102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei } 532102b2c87a6cb39bc63fb7eff13dda64da56b72eMark Wei } 546c72a787b58a0bc3afcb71093eddf8c29d1cf5edMindy Pereira} 55