Merge "Changing last call card to match_parent." into klp-dev
diff --git a/res/layout/phone_favorites_fragment.xml b/res/layout/phone_favorites_fragment.xml
index 3b9e589..6023fc8 100644
--- a/res/layout/phone_favorites_fragment.xml
+++ b/res/layout/phone_favorites_fragment.xml
@@ -28,7 +28,7 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
- <com.android.dialer.list.SwipeableListView
+ <com.android.dialer.list.PhoneFavoriteListView
android:id="@+id/contact_tile_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/res/layout/phone_loading_contacts.xml b/res/layout/phone_loading_contacts.xml
deleted file mode 100644
index afc3322..0000000
--- a/res/layout/phone_loading_contacts.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- "Loading" text with a spinner, which is used in PhoneFavorite screen -->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:orientation="horizontal"
- android:gravity="start|center_vertical">
-
- <ProgressBar
- android:indeterminate="true"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:id="@+id/progress_spinner"/>
-
- <TextView
- android:id="@+id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/contact_list_loading"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_marginStart="4dip" />
-
-</LinearLayout>
diff --git a/res/layout/phone_no_favorites.xml b/res/layout/phone_no_favorites.xml
new file mode 100644
index 0000000..9fa5d47
--- /dev/null
+++ b/res/layout/phone_no_favorites.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:minHeight="?android:attr/listPreferredItemHeight">
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:text="@string/listTotalAllContactsZeroStarred"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="?android:attr/textColorSecondary"
+ android:layout_marginTop="8dp"
+ android:layout_marginBottom="8dp"/>
+
+</FrameLayout>
diff --git a/res/layout/show_all_contacts_fragment.xml b/res/layout/show_all_contacts_fragment.xml
index 14fe340..ddc99e8 100644
--- a/res/layout/show_all_contacts_fragment.xml
+++ b/res/layout/show_all_contacts_fragment.xml
@@ -23,7 +23,7 @@
<!-- Shown only when an Account filter is set.
- paddingTop should be here to show "shade" effect correctly. -->
- <!-- TODO {klp} Remove the filter header. -->
+ <!-- TODO: Remove the filter header. -->
<include
android:id="@+id/account_filter_header_container"
layout="@layout/account_filter_header" />
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 0aae8aa..c2a1b03 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -144,18 +144,17 @@
private CallLogAdapter mCallLogAdapter;
private CallLogQueryHandler mCallLogQueryHandler;
- private TextView mEmptyView;
- private SwipeableListView mListView;
+ private PhoneFavoriteListView mListView;
+
private View mShowAllContactsButton;
private final HashMap<Long, Integer> mItemIdTopMap = new HashMap<Long, Integer>();
private final HashMap<Long, Integer> mItemIdLeftMap = new HashMap<Long, Integer>();
/**
- * Layout used when contacts load is slower than expected and thus "loading" view should be
- * shown.
+ * Layout used when there are no favorites.
*/
- private View mLoadingView;
+ private View mEmptyView;
private final ContactTileView.Listener mContactTileAdapterListener =
new ContactTileAdapterListener();
@@ -171,7 +170,6 @@
// Construct two base adapters which will become part of PhoneFavoriteMergedAdapter.
// We don't construct the resultant adapter at this moment since it requires LayoutInflater
// that will be available on onCreateView().
-
mContactTileAdapter = new PhoneFavoritesTileAdapter(activity, mContactTileAdapterListener,
this,
getResources().getInteger(R.integer.contact_tile_column_count_in_favorites_new),
@@ -206,7 +204,7 @@
final View listLayout = inflater.inflate(
R.layout.phone_favorites_fragment, container, false);
- mListView = (SwipeableListView) listLayout.findViewById(R.id.contact_tile_list);
+ mListView = (PhoneFavoriteListView) listLayout.findViewById(R.id.contact_tile_list);
mListView.setItemsCanFocus(true);
mListView.setOnItemClickListener(this);
mListView.setVerticalScrollBarEnabled(false);
@@ -214,7 +212,8 @@
mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
mListView.setOnItemSwipeListener(mContactTileAdapter);
- mLoadingView = inflater.inflate(R.layout.phone_loading_contacts, mListView, false);
+ mEmptyView = inflater.inflate(R.layout.phone_no_favorites, mListView, false);
+
mShowAllContactsButton = inflater.inflate(R.layout.show_all_contact_button, mListView,
false);
mShowAllContactsButton.setOnClickListener(new OnClickListener() {
@@ -224,8 +223,9 @@
}
});
+ mContactTileAdapter.setEmptyView(mEmptyView);
mAdapter = new PhoneFavoriteMergedAdapter(getActivity(), mContactTileAdapter,
- mCallLogAdapter, mLoadingView, mShowAllContactsButton);
+ mCallLogAdapter, mShowAllContactsButton);
mListView.setAdapter(mAdapter);
@@ -233,10 +233,6 @@
mListView.setFastScrollEnabled(false);
mListView.setFastScrollAlwaysVisible(false);
- mEmptyView = (TextView) listLayout.findViewById(R.id.contact_tile_list_empty);
- mEmptyView.setText(getString(R.string.listTotalAllContactsZero));
- mListView.setEmptyView(mEmptyView);
-
return listLayout;
}
diff --git a/src/com/android/dialer/list/PhoneFavoriteListView.java b/src/com/android/dialer/list/PhoneFavoriteListView.java
new file mode 100644
index 0000000..b5da054
--- /dev/null
+++ b/src/com/android/dialer/list/PhoneFavoriteListView.java
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2012 Google Inc.
+ * Licensed to The Android Open Source Project.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dialer.list;
+
+import android.content.Context;
+import android.content.res.Configuration;
+import android.os.Handler;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.DragEvent;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnDragListener;
+import android.view.ViewConfiguration;
+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
+ */
+public class PhoneFavoriteListView extends ListView implements
+ SwipeHelperCallback, OnDragListener {
+
+ 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;
+ private int mBottomScrollBound;
+ private int mLastDragY;
+
+ private Handler mScrollHandler;
+ private final long SCROLL_HANDLER_DELAY_MILLIS = 5;
+ private final int DRAG_SCROLL_PX_UNIT = 10;
+
+ /**
+ * {@link #mTopScrollBound} and {@link mBottomScrollBound} will be
+ * offseted to the top / bottom by {@link #getHeight} * {@link #BOUND_GAP_RATIO} pixels.
+ */
+ private final float BOUND_GAP_RATIO = 0.2f;
+
+ private final Runnable mDragScroller = new Runnable() {
+ @Override
+ public void run() {
+ if (mLastDragY <= mTopScrollBound) {
+ smoothScrollBy(-DRAG_SCROLL_PX_UNIT, (int) SCROLL_HANDLER_DELAY_MILLIS);
+ } else if (mLastDragY >= mBottomScrollBound) {
+ smoothScrollBy(DRAG_SCROLL_PX_UNIT, (int) SCROLL_HANDLER_DELAY_MILLIS);
+ }
+ mScrollHandler.postDelayed(this, SCROLL_HANDLER_DELAY_MILLIS);
+ }
+ };
+
+ public PhoneFavoriteListView(Context context) {
+ this(context, null);
+ }
+
+ public PhoneFavoriteListView(Context context, AttributeSet attrs) {
+ this(context, attrs, -1);
+ }
+
+ public PhoneFavoriteListView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ mDensityScale = getResources().getDisplayMetrics().density;
+ mTouchSlop = ViewConfiguration.get(context).getScaledPagingTouchSlop();
+ mSwipeHelper = new SwipeHelper(context, SwipeHelper.X, this,
+ mDensityScale, mTouchSlop);
+ setItemsCanFocus(true);
+ setOnDragListener(this);
+ }
+
+ @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;
+ }
+
+ @Override
+ public boolean onInterceptTouchEvent(MotionEvent ev) {
+ 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) {
+ // find the view under the pointer, accounting for GONE views
+ final int count = getChildCount();
+ final int touchY = (int) ev.getY();
+ View slidingChild;
+ for (int childIdx = 0; childIdx < count; childIdx++) {
+ slidingChild = getChildAt(childIdx);
+ if (slidingChild.getVisibility() == GONE) {
+ continue;
+ }
+ if (touchY >= slidingChild.getTop() && touchY <= slidingChild.getBottom()) {
+ if (SwipeHelper.isSwipeable(slidingChild)) {
+ // 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 slidingChild;
+ } else {
+ return null;
+ }
+ }
+ }
+ return null;
+ }
+
+ @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);
+ }
+
+ @Override
+ public boolean dispatchDragEvent(DragEvent event) {
+ switch (event.getAction()) {
+ case DragEvent.ACTION_DRAG_LOCATION:
+ if (mScrollHandler == null) {
+ mScrollHandler = getHandler();
+ }
+ mLastDragY = (int) event.getY();
+ mScrollHandler.postDelayed(mDragScroller, SCROLL_HANDLER_DELAY_MILLIS);
+ break;
+ case DragEvent.ACTION_DRAG_ENTERED:
+ final int boundGap = (int) (getHeight() * BOUND_GAP_RATIO);
+ mTopScrollBound = (getTop() + boundGap);
+ mBottomScrollBound = (getBottom() - boundGap);
+ break;
+ case DragEvent.ACTION_DRAG_EXITED:
+ case DragEvent.ACTION_DRAG_ENDED:
+ mScrollHandler.removeCallbacks(mDragScroller);
+ break;
+ case DragEvent.ACTION_DRAG_STARTED:
+ // Not a receiver
+ case DragEvent.ACTION_DROP:
+ // Not a receiver
+ default:
+ break;
+ }
+ return super.dispatchDragEvent(event);
+ }
+
+ @Override
+ public boolean onDrag(View v, DragEvent event) {
+ return true;
+ }
+}
diff --git a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
index 11b615a..c7554e2 100644
--- a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
@@ -52,7 +52,6 @@
private static final int ALL_CONTACTS_BUTTON_ITEM_ID = -1;
private final PhoneFavoritesTileAdapter mContactTileAdapter;
private final CallLogAdapter mCallLogAdapter;
- private final View mLoadingView;
private final View mShowAllContactsButton;
private final int mCallLogPadding;
@@ -99,7 +98,6 @@
public PhoneFavoriteMergedAdapter(Context context,
PhoneFavoritesTileAdapter contactTileAdapter,
CallLogAdapter callLogAdapter,
- View loadingView,
View showAllContactsButton) {
final Resources resources = context.getResources();
mContext = context;
@@ -109,7 +107,6 @@
mObserver = new CustomDataSetObserver();
mCallLogAdapter.registerDataSetObserver(mObserver);
mContactTileAdapter.registerDataSetObserver(mObserver);
- mLoadingView = loadingView;
mShowAllContactsButton = showAllContactsButton;
mCallLogQueryHandler = new CallLogQueryHandler(mContext.getContentResolver(),
mCallLogQueryHandlerListener);
@@ -242,9 +239,6 @@
@Override
public boolean areAllItemsEnabled() {
- // If "all" section is being loaded we'll show mLoadingView, which is not enabled.
- // Otherwise check the all the other components in the ListView and return appropriate
- // result.
return mCallLogAdapter.areAllItemsEnabled() && mContactTileAdapter.areAllItemsEnabled();
}
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 91acc6f..9662338 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -74,6 +74,8 @@
private Context mContext;
private Resources mResources;
+ private View mEmptyView;
+
/** Contact data stored in cache. This is used to populate the associated view. */
protected ArrayList<ContactEntry> mContactEntries = null;
/** Back up of the temporarily removed Contact during dragging. */
@@ -367,10 +369,15 @@
return mNumFrequents;
}
+ private boolean isEmptyView(int position) {
+ return position == 0 && (mContactEntries == null || mContactEntries.isEmpty());
+ }
+
@Override
public int getCount() {
if (mContactEntries == null || mContactEntries.isEmpty()) {
- return 0;
+ // empty view
+ return 1;
}
int total = mContactEntries.size();
@@ -493,7 +500,7 @@
@Override
public boolean isEnabled(int position) {
- return true;
+ return !isEmptyView(position);
}
@Override
@@ -509,8 +516,13 @@
if (DEBUG) {
Log.v(TAG, "get view for " + String.valueOf(position));
}
+
int itemViewType = getItemViewType(position);
+ if (itemViewType == ViewTypes.EMPTY) {
+ return mEmptyView;
+ }
+
ContactTileRow contactTileRowView = (ContactTileRow) convertView;
ArrayList<ContactEntry> contactList = getItem(position);
@@ -542,6 +554,7 @@
@Override
public int getItemViewType(int position) {
+ if (isEmptyView(position)) return ViewTypes.EMPTY;
if (position < getRowCount(getMaxContactsInTiles())) {
return ViewTypes.TOP;
} else {
@@ -1129,9 +1142,10 @@
}
protected static class ViewTypes {
- public static final int COUNT = 2;
+ public static final int COUNT = 3;
public static final int FREQUENT = 0;
public static final int TOP = 1;
+ public static final int EMPTY = 2;
}
@Override
@@ -1158,4 +1172,8 @@
public boolean isSwipeEnabled() {
return !mAwaitingRemove;
}
+
+ public void setEmptyView(View emptyView) {
+ mEmptyView = emptyView;
+ }
}
diff --git a/src/com/android/dialer/list/SwipeableListView.java b/src/com/android/dialer/list/SwipeableListView.java
deleted file mode 100644
index 449628d..0000000
--- a/src/com/android/dialer/list/SwipeableListView.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc.
- * Licensed to The Android Open Source Project.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dialer.list;
-
-import android.content.Context;
-import android.content.res.Configuration;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewConfiguration;
-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;
-
-/**
- * Copy of packages/apps/UnifiedEmail - com.android.mail.ui.Swipeable with changes.
- */
-public class SwipeableListView extends ListView implements SwipeHelperCallback {
- private SwipeHelper mSwipeHelper;
- private boolean mEnableSwipe = true;
-
- public static final String LOG_TAG = SwipeableListView.class.getSimpleName();
-
- private OnItemGestureListener mOnItemGestureListener;
-
- public SwipeableListView(Context context) {
- this(context, null);
- }
-
- public SwipeableListView(Context context, AttributeSet attrs) {
- this(context, attrs, -1);
- }
-
- public SwipeableListView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- float densityScale = getResources().getDisplayMetrics().density;
- float pagingTouchSlop = ViewConfiguration.get(context).getScaledPagingTouchSlop();
- mSwipeHelper = new SwipeHelper(context, SwipeHelper.X, this, densityScale,
- pagingTouchSlop);
- setItemsCanFocus(true);
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- float densityScale = getResources().getDisplayMetrics().density;
- mSwipeHelper.setDensityScale(densityScale);
- float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
- mSwipeHelper.setPagingTouchSlop(pagingTouchSlop);
- }
-
- /**
- * Enable swipe gestures.
- */
- public void enableSwipe(boolean enable) {
- mEnableSwipe = enable;
- }
-
- public boolean isSwipeEnabled() {
- return mEnableSwipe && mOnItemGestureListener.isSwipeEnabled();
- }
-
- public void setOnItemSwipeListener(OnItemGestureListener listener) {
- mOnItemGestureListener = listener;
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- 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) {
- // find the view under the pointer, accounting for GONE views
- final int count = getChildCount();
- final int touchY = (int) ev.getY();
- View slidingChild;
- for (int childIdx = 0; childIdx < count; childIdx++) {
- slidingChild = getChildAt(childIdx);
- if (slidingChild.getVisibility() == GONE) {
- continue;
- }
- if (touchY >= slidingChild.getTop() && touchY <= slidingChild.getBottom()) {
- if (SwipeHelper.isSwipeable(slidingChild)) {
- // 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 slidingChild;
- } else {
- return null;
- }
- }
- }
- return null;
- }
-
- @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);
- }
-}
\ No newline at end of file
diff --git a/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java b/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java
index 3e3cacd..611b3f1 100644
--- a/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java
+++ b/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java
@@ -12,7 +12,7 @@
}
/**
- * TODO Krelease: Add tests
+ * TODO: Add tests
*
* Test cases (various combinations of):
* No pinned contacts
@@ -26,7 +26,7 @@
}
/**
- * TODO Krelease: Add tests
+ * TODO: Add tests
*
* This method assumes that contacts have already been reordered by
* arrangeContactsByPinnedPosition, so we can test it with a less expansive set of test data.