summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/layout/phone_favorite_regular_row_view.xml66
-rw-r--r--res/layout/phone_favorite_tile_view.xml56
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteFragment.java3
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteListView.java112
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteTileView.java98
-rw-r--r--src/com/android/dialer/list/PhoneFavoritesTileAdapter.java177
6 files changed, 10 insertions, 502 deletions
diff --git a/res/layout/phone_favorite_regular_row_view.xml b/res/layout/phone_favorite_regular_row_view.xml
index d046fdb3d..ff8b47a42 100644
--- a/res/layout/phone_favorite_regular_row_view.xml
+++ b/res/layout/phone_favorite_regular_row_view.xml
@@ -50,7 +50,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
- android:textColor="@color/dialtacts_primary_text_color"/>
+ android:textColor="@color/dialtacts_primary_text_color"
android:singleLine="true"
android:fadingEdge="horizontal"
android:fadingEdgeLength="3dip"
@@ -67,68 +67,4 @@
</LinearLayout>
</RelativeLayout>
-
- <LinearLayout
- android:id="@+id/favorite_remove_dialogue"
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true"
- android:gravity="center_vertical"
- android:alpha="0.0"
- android:visibility="gone">
-
- <TextView
- android:id="@+id/favorite_remove_dialogue_text"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:paddingStart="@dimen/favorites_row_undo_text_side_padding"
- android:paddingEnd="@dimen/favorites_row_undo_text_side_padding"
- android:text="@string/favorite_hidden"
- android:ellipsize="marquee"
- android:fontFamily="sans-serif"
- android:textSize="14sp"
- android:textColor="@color/undo_dialogue_text_color"
- android:singleLine="true"
- android:gravity="center_vertical"
- android:textDirection="ltr" />
-
- <View
- android:id="@+id/undo_separator"
- android:layout_width="1dip"
- android:layout_height="match_parent"
- android:background="@color/undo_dialogue_text_color"
- android:layout_marginTop="16dp"
- android:layout_marginBottom="16dp" />
-
- <LinearLayout
- android:id="@+id/favorite_remove_undo_button"
- android:orientation="vertical"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:clickable="true"
- android:paddingStart="30dp"
- android:paddingEnd="30dp"
- android:background="?android:attr/selectableItemBackground"
- android:gravity="center_vertical">
-
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:src="@drawable/ic_fav_undo_dk"/>
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:fontFamily="sans-serif-light"
- android:textSize="13sp"
- android:ellipsize="marquee"
- android:singleLine="true"
- android:text="@string/favorite_hidden_undo"
- android:textColor="@color/undo_dialogue_text_color"
- android:textAlignment="center"/>
- </LinearLayout>
- </LinearLayout>
</view>
diff --git a/res/layout/phone_favorite_tile_view.xml b/res/layout/phone_favorite_tile_view.xml
index 952bb2a2a..0779f2a74 100644
--- a/res/layout/phone_favorite_tile_view.xml
+++ b/res/layout/phone_favorite_tile_view.xml
@@ -104,60 +104,4 @@
android:contentDescription="@string/description_view_contact_detail" />
</RelativeLayout>
-
- <LinearLayout
- android:id="@+id/favorite_remove_dialogue"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true"
- android:gravity="center_horizontal"
- android:background="@color/background_dialer_light"
- android:alpha="0.0"
- android:visibility="gone">
-
- <TextView
- android:id="@+id/favorite_remove_dialogue_text"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/favorite_hidden"
- android:ellipsize="marquee"
- android:fontFamily="sans-serif"
- android:textSize="14sp"
- android:textColor="@color/undo_dialogue_text_color"
- android:lines="2"
- android:paddingTop="22dp"
- android:textDirection="ltr"
- android:textAlignment="center" />
-
- <LinearLayout
- android:id="@+id/favorite_remove_undo_button"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentLeft="true"
- android:background="?android:attr/selectableItemBackground"
- android:clickable="true"
- android:layout_weight="1"
- android:layout_gravity="bottom">
-
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:src="@drawable/ic_fav_undo_dk"/>
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:fontFamily="sans-serif"
- android:textSize="13sp"
- android:ellipsize="marquee"
- android:singleLine="true"
- android:text="@string/favorite_hidden_undo"
- android:textColor="@color/undo_dialogue_text_color"
- android:textAlignment="center"/>
- </LinearLayout>
-
- </LinearLayout>
</view>
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 354765f77..0b191416d 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -282,7 +282,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
mListView.setVerticalScrollBarEnabled(false);
mListView.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT);
mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
- mListView.setOnItemSwipeListener(mContactTileAdapter);
mListView.getDragDropController().addOnDragDropListener(mContactTileAdapter);
final ImageView dragShadowOverlay =
@@ -419,8 +418,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
@Override
public void onPause() {
- // If there are any pending contact entries that are to be removed, remove them
- mContactTileAdapter.removePendingContactEntry();
// Wipe the cache to refresh the call shortcut item. This is not that expensive because
// it only contains one item.
mCallLogAdapter.invalidateCache();
diff --git a/src/com/android/dialer/list/PhoneFavoriteListView.java b/src/com/android/dialer/list/PhoneFavoriteListView.java
index 078cf3ecf..404802360 100644
--- a/src/com/android/dialer/list/PhoneFavoriteListView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteListView.java
@@ -34,26 +34,15 @@ import android.widget.ListView;
import com.android.dialer.R;
import com.android.dialer.list.PhoneFavoritesTileAdapter.ContactTileRow;
-import com.android.dialer.list.SwipeHelper.OnItemGestureListener;
-import com.android.dialer.list.SwipeHelper.SwipeHelperCallback;
/**
- * The ListView composed of {@link ContactTileRow}.
- * This ListView handles both
- * - Swiping, which is borrowed from packages/apps/UnifiedEmail (com.android.mail.ui.Swipeable)
- * - Drag and drop
+ * The ListView used to present a combined list of shortcut cards and contact speed-dial
+ * tiles.
*/
-public class PhoneFavoriteListView extends ListView implements SwipeHelperCallback,
- OnDragDropListener {
+public class PhoneFavoriteListView extends ListView implements OnDragDropListener {
public static final String LOG_TAG = PhoneFavoriteListView.class.getSimpleName();
- private SwipeHelper mSwipeHelper;
- private boolean mEnableSwipe = true;
-
- private OnItemGestureListener mOnItemGestureListener;
-
- private float mDensityScale;
private float mTouchSlop;
private int mTopScrollBound;
@@ -126,10 +115,7 @@ public class PhoneFavoriteListView extends ListView implements SwipeHelperCallba
public PhoneFavoriteListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mAnimationDuration = context.getResources().getInteger(R.integer.fade_duration);
- mDensityScale = getResources().getDisplayMetrics().density;
mTouchSlop = ViewConfiguration.get(context).getScaledPagingTouchSlop();
- mSwipeHelper = new SwipeHelper(context, SwipeHelper.X, this,
- mDensityScale, mTouchSlop);
setItemsCanFocus(true);
mDragDropController.addOnDragDropListener(this);
}
@@ -137,25 +123,7 @@ public class PhoneFavoriteListView extends ListView implements SwipeHelperCallba
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
- mDensityScale= getResources().getDisplayMetrics().density;
mTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
- mSwipeHelper.setDensityScale(mDensityScale);
- mSwipeHelper.setPagingTouchSlop(mTouchSlop);
- }
-
- /**
- * Enable swipe gestures.
- */
- public void enableSwipe(boolean enable) {
- mEnableSwipe = enable;
- }
-
- public boolean isSwipeEnabled() {
- return mEnableSwipe && mOnItemGestureListener.isSwipeEnabled();
- }
-
- public void setOnItemSwipeListener(OnItemGestureListener listener) {
- mOnItemGestureListener = listener;
}
/**
@@ -168,77 +136,11 @@ public class PhoneFavoriteListView extends ListView implements SwipeHelperCallba
mTouchDownForDragStartX = (int) ev.getX();
mTouchDownForDragStartY = (int) ev.getY();
}
- if (isSwipeEnabled()) {
- return mSwipeHelper.onInterceptTouchEvent(ev) || super.onInterceptTouchEvent(ev);
- } else {
- return super.onInterceptTouchEvent(ev);
- }
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- if (mOnItemGestureListener != null) {
- mOnItemGestureListener.onTouch();
- }
- if (isSwipeEnabled()) {
- return mSwipeHelper.onTouchEvent(ev) || super.onTouchEvent(ev);
- } else {
- return super.onTouchEvent(ev);
- }
- }
- @Override
- public View getChildAtPosition(MotionEvent ev) {
- final View view = getViewAtPosition((int) ev.getX(), (int) ev.getY());
- if (view != null &&
- SwipeHelper.isSwipeable(view) &&
- view.getVisibility() != GONE) {
- // If this view is swipable in this listview, then return it. Otherwise
- // return a null view, which will simply be ignored by the swipe helper.
- return view;
- }
- return null;
+ return super.onInterceptTouchEvent(ev);
}
@Override
- public View getChildContentView(View view) {
- return view.findViewById(R.id.contact_favorite_card);
- }
-
- @Override
- public void onScroll() {}
-
- @Override
- public boolean canChildBeDismissed(View v) {
- return SwipeHelper.isSwipeable(v);
- }
-
- @Override
- public void onChildDismissed(final View v) {
- if (v != null) {
- if (mOnItemGestureListener != null) {
- mOnItemGestureListener.onSwipe(v);
- }
- }
- }
-
- @Override
- public void onDragCancelled(View v) {}
-
- @Override
- public void onBeginDrag(View v) {
- final View tileRow = (View) v.getParent();
-
- // We do this so the underlying ScrollView knows that it won't get
- // the chance to intercept events anymore
- requestDisallowInterceptTouchEvent(true);
- }
-
- /**
- * End of swipe-to-remove code
- */
-
- @Override
public boolean dispatchDragEvent(DragEvent event) {
final int action = event.getAction();
final int eX = (int) event.getX();
@@ -259,12 +161,6 @@ public class PhoneFavoriteListView extends ListView implements SwipeHelperCallba
final ContactTileRow tile = (ContactTileRow) child;
- // Disable drag and drop if there is a contact that has been swiped and is currently
- // in the pending remove state
- if (tile.getTileAdapter().hasPotentialRemoveEntryIndex()) {
- return false;
- }
-
if (!mDragDropController.handleDragStarted(viewX, viewY, tile)) {
return false;
}
diff --git a/src/com/android/dialer/list/PhoneFavoriteTileView.java b/src/com/android/dialer/list/PhoneFavoriteTileView.java
index e89321c48..c05ba1db5 100644
--- a/src/com/android/dialer/list/PhoneFavoriteTileView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteTileView.java
@@ -54,15 +54,6 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
private static final float DEFAULT_IMAGE_LETTER_OFFSET = -0.14f;
private static final float DEFAULT_IMAGE_LETTER_SCALE = 0.70f;
- /** Length of all animations in milliseconds. */
- private int mAnimationDuration;
-
- /** The view that holds the front layer of the favorite contact card. */
- private View mFavoriteContactCard;
- /** The view that holds the background layer of the removal dialogue. */
- private View mRemovalDialogue;
- /** Undo button for undoing favorite removal. */
- private View mUndoRemovalButton;
/** The view that holds the list view row. */
protected ContactTileRow mParentRow;
/** View that contains the transparent shadow that is overlaid on top of the contact image. */
@@ -71,16 +62,12 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
/** Users' most frequent phone number. */
private String mPhoneNumberString;
- /** Custom gesture detector.*/
- protected GestureDetector mGestureDetector;
-
// Dummy clip data object that is attached to drag shadows so that text views
// don't crash with an NPE if the drag shadow is released in their bounds
private static final ClipData EMPTY_CLIP_DATA = ClipData.newPlainText("", "");
public PhoneFavoriteTileView(Context context, AttributeSet attrs) {
super(context, attrs);
- mAnimationDuration = context.getResources().getInteger(R.integer.fade_duration);
}
public ContactTileRow getParentRow() {
@@ -91,16 +78,6 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
protected void onFinishInflate() {
super.onFinishInflate();
mShadowOverlay = findViewById(R.id.shadow_overlay);
- mFavoriteContactCard = findViewById(R.id.contact_favorite_card);
- mRemovalDialogue = findViewById(R.id.favorite_remove_dialogue);
- mUndoRemovalButton = findViewById(R.id.favorite_remove_undo_button);
-
- mUndoRemovalButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- undoRemove();
- }
- });
setOnLongClickListener(new OnLongClickListener() {
@Override
@@ -142,76 +119,6 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
}
}
- public void displayRemovalDialog() {
- mRemovalDialogue.setVisibility(VISIBLE);
- mRemovalDialogue.setAlpha(0f);
- final ObjectAnimator fadeIn = ObjectAnimator.ofFloat(mRemovalDialogue, "alpha",
- 1.f).setDuration(mAnimationDuration);
-
- fadeIn.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- mParentRow.setHasTransientState(true);
- };
-
- @Override
- public void onAnimationEnd(Animator animation) {
- mParentRow.setHasTransientState(false);
- }
- });
- fadeIn.start();
- }
-
- /**
- * Signals the user wants to undo removing the favorite contact.
- */
- public void undoRemove() {
- // Makes the removal dialogue invisible.
- mRemovalDialogue.setAlpha(0.0f);
- mRemovalDialogue.setVisibility(GONE);
-
- // Animates back the favorite contact card.
- final ObjectAnimator fadeIn = ObjectAnimator.ofFloat(mFavoriteContactCard, "alpha", 1.f).
- setDuration(mAnimationDuration);
- final ObjectAnimator moveBack = ObjectAnimator.ofFloat(mFavoriteContactCard, "translationX",
- 0.f).setDuration(mAnimationDuration);
-
- final AnimatorSet animSet = new AnimatorSet();
-
- animSet.playTogether(fadeIn, moveBack);
-
- animSet.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- mParentRow.setHasTransientState(true);
- }
- @Override
- public void onAnimationEnd(Animator animation) {
- if (mParentRow.getItemViewType() == ViewTypes.FREQUENT) {
- SwipeHelper.setSwipeable(mParentRow, true);
- } else {
- SwipeHelper.setSwipeable(PhoneFavoriteTileView.this, true);
- }
- mParentRow.setHasTransientState(false);
- }
- });
- animSet.start();
- // Signals the PhoneFavoritesTileAdapter to undo the potential delete.
- mParentRow.getTileAdapter().undoPotentialRemoveEntryIndex();
- }
-
- /**
- * Sets up the favorite contact card.
- */
- public void setupFavoriteContactCard() {
- if (mRemovalDialogue != null) {
- mRemovalDialogue.setVisibility(GONE);
- mRemovalDialogue.setAlpha(0.f);
- }
- mFavoriteContactCard.setAlpha(1.0f);
- mFavoriteContactCard.setTranslationX(0.f);
- }
-
@Override
protected void onAttachedToWindow() {
mParentRow = (ContactTileRow) getParent();
@@ -227,8 +134,9 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
return new OnClickListener() {
@Override
public void onClick(View v) {
- // When the removal dialog is present, don't allow a click to call
- if (mListener == null || mRemovalDialogue.isShown()) return;
+ if (mListener == null) {
+ return;
+ }
if (TextUtils.isEmpty(mPhoneNumberString)) {
// Copy "superclass" implementation
mListener.onContactSelected(getLookupUri(), MoreContactUtils
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index d1ac9557c..503c506c1 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -30,9 +30,7 @@ import android.provider.ContactsContract.PinnedPositions;
import android.text.TextUtils;
import android.util.Log;
import android.util.LongSparseArray;
-import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
@@ -43,8 +41,6 @@ import com.android.contacts.common.R;
import com.android.contacts.common.list.ContactEntry;
import com.android.contacts.common.list.ContactTileAdapter.DisplayType;
import com.android.contacts.common.list.ContactTileView;
-import com.android.dialer.list.SwipeHelper.OnItemGestureListener;
-import com.android.dialer.list.SwipeHelper.SwipeHelperCallback;
import java.util.ArrayList;
import java.util.Comparator;
@@ -59,7 +55,7 @@ import java.util.PriorityQueue;
*
*/
public class PhoneFavoritesTileAdapter extends BaseAdapter implements
- SwipeHelper.OnItemGestureListener, OnDragDropListener {
+ OnDragDropListener {
private static final String TAG = PhoneFavoritesTileAdapter.class.getSimpleName();
private static final boolean DEBUG = false;
@@ -83,8 +79,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
private int mDropEntryIndex = -1;
/** New position of the temporarily entered contact in the cache. */
private int mDragEnteredEntryIndex = -1;
- /** Position of the contact pending removal. */
- private int mPotentialRemoveEntryIndex = -1;
private long mIdToKeepInPlace = -1;
private boolean mAwaitingRemove = false;
@@ -650,44 +644,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
}
/**
- * Sets an item to for pending removal. If the user does not click the undo button, the item
- * will be removed at the next interaction.
- *
- * @param index Index of the item to be removed.
- */
- public void setPotentialRemoveEntryIndex(int index) {
- mPotentialRemoveEntryIndex = index;
- }
-
- /**
- * Removes a contact entry from the list.
- *
- * @return True is an item is removed. False is there is no item to be removed.
- */
- public boolean removePendingContactEntry() {
- boolean removed = false;
- if (isIndexInBound(mPotentialRemoveEntryIndex)) {
- final ContactEntry entry = mContactEntries.get(mPotentialRemoveEntryIndex);
- unstarAndUnpinContact(entry.lookupUri);
- removed = true;
- mAwaitingRemove = true;
- }
- cleanTempVariables();
- return removed;
- }
-
- /**
- * Resets the item for pending removal.
- */
- public void undoPotentialRemoveEntryIndex() {
- mPotentialRemoveEntryIndex = -1;
- }
-
- public boolean hasPotentialRemoveEntryIndex() {
- return isIndexInBound(mPotentialRemoveEntryIndex);
- }
-
- /**
* Clears all temporary variables at a new interaction.
*/
public void cleanTempVariables() {
@@ -695,14 +651,13 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
mDropEntryIndex = -1;
mDragEnteredEntryIndex = -1;
mDraggedEntry = null;
- mPotentialRemoveEntryIndex = -1;
}
/**
* Acts as a row item composed of {@link ContactTileView}
*
*/
- public class ContactTileRow extends FrameLayout implements SwipeHelperCallback {
+ public class ContactTileRow extends FrameLayout {
public static final int CONTACT_ENTRY_INDEX_TAG = R.id.contact_entry_index_tag;
private int mItemViewType;
@@ -713,8 +668,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
private final int mRowPaddingBottom;
private final float mHeightToWidthRatio;
private int mPosition;
- private SwipeHelper mSwipeHelper;
- private OnItemGestureListener mOnItemSwipeListener;
public ContactTileRow(Context context, int itemViewType, int position) {
super(context);
@@ -751,23 +704,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
// Remove row (but not children) from accessibility node tree.
setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
-
- if (mItemViewType == ViewTypes.FREQUENT) {
- // ListView handles swiping for this item
- SwipeHelper.setSwipeable(this, true);
- } else if (mItemViewType == ViewTypes.TOP) {
- // The contact tile row has its own swipe helpers, that makes each individual
- // tile swipeable.
- final float densityScale = getResources().getDisplayMetrics().density;
- final float pagingTouchSlop = ViewConfiguration.get(context)
- .getScaledPagingTouchSlop();
- mSwipeHelper = new SwipeHelper(context, SwipeHelper.X, this, densityScale,
- pagingTouchSlop);
- // Increase swipe thresholds for square tiles since they are relatively small.
- mSwipeHelper.setChildSwipedFarEnoughFactor(0.9f);
- mSwipeHelper.setChildSwipedFastEnoughFactor(0.1f);
- mOnItemSwipeListener = PhoneFavoritesTileAdapter.this;
- }
}
/**
@@ -824,22 +760,15 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
contactTile.setPaddingRelative(0, 0,
childIndex >= mColumnCount - 1 ? 0 : mPaddingInPixels, 0);
entryIndex = getFirstContactEntryIndexForPosition(mPosition) + childIndex;
- SwipeHelper.setSwipeable(contactTile, false);
break;
case ViewTypes.FREQUENT:
contactTile.setHorizontalDividerVisibility(
isLastRow ? View.GONE : View.VISIBLE);
entryIndex = getFirstContactEntryIndexForPosition(mPosition);
- SwipeHelper.setSwipeable(this, true);
break;
default:
break;
}
- // tag the tile with the index of the contact entry it is associated with
- if (entryIndex != -1) {
- contactTile.setTag(CONTACT_ENTRY_INDEX_TAG, entryIndex);
- }
- contactTile.setupFavoriteContactCard();
}
@Override
@@ -994,86 +923,9 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
return null;
}
- @Override
- public View getChildAtPosition(MotionEvent ev) {
- final View view = getViewAtPosition((int) ev.getX(), (int) ev.getY());
- if (view != null &&
- SwipeHelper.isSwipeable(view) &&
- view.getVisibility() != GONE) {
- // If this view is swipable, then return it. If not, because the removal
- // dialog is currently showing, then return a null view, which will simply
- // be ignored by the swipe helper.
- return view;
- }
- return null;
- }
-
- @Override
- public View getChildContentView(View v) {
- return v.findViewById(R.id.contact_favorite_card);
- }
-
- @Override
- public void onScroll() {}
-
- @Override
- public boolean canChildBeDismissed(View v) {
- return true;
- }
-
- @Override
- public void onBeginDrag(View v) {
- removePendingContactEntry();
- final int index = indexOfChild(v);
-
- /*
- if (index > 0) {
- detachViewFromParent(index);
- attachViewToParent(v, 0, v.getLayoutParams());
- }*/
-
- // We do this so the underlying ScrollView knows that it won't get
- // the chance to intercept events anymore
- requestDisallowInterceptTouchEvent(true);
- }
-
- @Override
- public void onChildDismissed(View v) {
- if (v != null) {
- if (mOnItemSwipeListener != null) {
- mOnItemSwipeListener.onSwipe(v);
- }
- }
- }
-
- @Override
- public void onDragCancelled(View v) {}
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (mSwipeHelper != null && isSwipeEnabled()) {
- return mSwipeHelper.onInterceptTouchEvent(ev) || super.onInterceptTouchEvent(ev);
- } else {
- return super.onInterceptTouchEvent(ev);
- }
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- if (mSwipeHelper != null && isSwipeEnabled()) {
- return mSwipeHelper.onTouchEvent(ev) || super.onTouchEvent(ev);
- } else {
- return super.onTouchEvent(ev);
- }
- }
-
public int getItemViewType() {
return mItemViewType;
}
-
- public void setOnItemSwipeListener(OnItemGestureListener listener) {
- mOnItemSwipeListener = listener;
- }
}
/**
@@ -1180,31 +1032,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
}
@Override
- public void onSwipe(View view) {
- final PhoneFavoriteTileView tileView = (PhoneFavoriteTileView) view.findViewById(
- R.id.contact_tile);
- // When the view is in the removal dialog, it should no longer be swipeable
- SwipeHelper.setSwipeable(view, false);
- tileView.displayRemovalDialog();
-
- final Integer entryIndex = (Integer) tileView.getTag(
- ContactTileRow.CONTACT_ENTRY_INDEX_TAG);
-
- setPotentialRemoveEntryIndex(entryIndex);
- }
-
- @Override
- public void onTouch() {
- removePendingContactEntry();
- return;
- }
-
- @Override
- public boolean isSwipeEnabled() {
- return !mAwaitingRemove;
- }
-
- @Override
public void onDragStarted(int itemIndex, int x, int y, PhoneFavoriteTileView view) {
setInDragging(true);
popContactEntry(itemIndex);