diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/provider/CallLog.java | 41 | ||||
-rw-r--r-- | core/java/android/provider/ContactsContract.java | 9 | ||||
-rw-r--r-- | core/java/android/view/MotionEvent.java | 14 | ||||
-rw-r--r-- | core/java/android/view/View.java | 8 | ||||
-rw-r--r-- | core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java | 5 | ||||
-rw-r--r-- | core/java/com/android/internal/widget/multiwaveview/Tweener.java | 90 |
6 files changed, 129 insertions, 38 deletions
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index 02faf49..0933193 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -24,6 +24,8 @@ import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.net.Uri; +import android.provider.ContactsContract.CommonDataKinds.Phone; +import android.provider.ContactsContract.DataUsageFeedback; import android.text.TextUtils; /** @@ -204,7 +206,44 @@ public class CallLog { } if ((ci != null) && (ci.person_id > 0)) { - ContactsContract.Contacts.markAsContacted(resolver, ci.person_id); + // Update usage information for the number associated with the contact ID. + // We need to use both the number and the ID for obtaining a data ID since other + // contacts may have the same number. + + final Cursor cursor; + + // We should prefer normalized one (probably coming from + // Phone.NORMALIZED_NUMBER column) first. If it isn't available try others. + if (ci.normalizedNumber != null) { + final String normalizedPhoneNumber = ci.normalizedNumber; + cursor = resolver.query(Phone.CONTENT_URI, + new String[] { Phone._ID }, + Phone.CONTACT_ID + " =? AND " + Phone.NORMALIZED_NUMBER + " =?", + new String[] { String.valueOf(ci.person_id), normalizedPhoneNumber}, + null); + } else { + final String phoneNumber = ci.phoneNumber != null ? ci.phoneNumber : number; + cursor = resolver.query(Phone.CONTENT_URI, + new String[] { Phone._ID }, + Phone.CONTACT_ID + " =? AND " + Phone.NUMBER + " =?", + new String[] { String.valueOf(ci.person_id), phoneNumber}, + null); + } + + if (cursor != null) { + try { + if (cursor.getCount() > 0 && cursor.moveToFirst()) { + final Uri feedbackUri = DataUsageFeedback.FEEDBACK_URI.buildUpon() + .appendPath(cursor.getString(0)) + .appendQueryParameter(DataUsageFeedback.USAGE_TYPE, + DataUsageFeedback.USAGE_TYPE_CALL) + .build(); + resolver.update(feedbackUri, new ContentValues(), null, null); + } + } finally { + cursor.close(); + } + } } Uri result = resolver.insert(CONTENT_URI, values); diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index cb96bfd..ad71061 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -174,6 +174,15 @@ public final class ContactsContract { */ public static final String PRIMARY_ACCOUNT_TYPE = "type_for_primary_account"; + /** + * A boolean parameter for {@link Contacts#CONTENT_STREQUENT_URI} and + * {@link Contacts#CONTENT_STREQUENT_FILTER_URI}, which requires the ContactsProvider to + * return only phone-related results. For example, frequently contacted person list should + * include persons contacted via phone (not email, sms, etc.) + * + * @hide + */ + public static final String STREQUENT_PHONE_ONLY = "strequent_phone_only"; /** * @hide diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index 3436cd1..f45e78b 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -1130,14 +1130,14 @@ public final class MotionEvent extends InputEvent implements Parcelable { public static final int BUTTON_PRIMARY = 1 << 0; /** - * Button constant: Secondary button (right mouse button, stylus barrel). + * Button constant: Secondary button (right mouse button, stylus first button). * * @see #getButtonState */ public static final int BUTTON_SECONDARY = 1 << 1; /** - * Button constant: Tertiary button (middle mouse button). + * Button constant: Tertiary button (middle mouse button, stylus second button). * * @see #getButtonState */ @@ -1165,13 +1165,6 @@ public final class MotionEvent extends InputEvent implements Parcelable { */ public static final int BUTTON_FORWARD = 1 << 4; - /** - * Button constant: Eraser button pressed (stylus end). - * - * @see #getButtonState - */ - public static final int BUTTON_ERASER = 1 << 5; - // NOTE: If you add a new axis here you must also add it to: // native/include/android/input.h @@ -1183,7 +1176,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { "BUTTON_TERTIARY", "BUTTON_BACK", "BUTTON_FORWARD", - "BUTTON_ERASER", + "0x00000020", "0x00000040", "0x00000080", "0x00000100", @@ -2176,7 +2169,6 @@ public final class MotionEvent extends InputEvent implements Parcelable { * @see #BUTTON_TERTIARY * @see #BUTTON_FORWARD * @see #BUTTON_BACK - * @see #BUTTON_ERASER */ public final int getButtonState() { return nativeGetButtonState(mNativePtr); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 5743134..411b714 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -3390,6 +3390,14 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit } /** + * Register a callback to be invoked when a hover event is sent to this view. + * @param l the hover listener to attach to this view + */ + public void setOnHoverListener(OnHoverListener l) { + mOnHoverListener = l; + } + + /** * Register a drag event listener callback object for this View. The parameter is * an implementation of {@link android.view.View.OnDragListener}. To send a drag event to a * View, the system calls the diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java index 3e7b976..5b35104 100644 --- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java +++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java @@ -224,8 +224,8 @@ public class MultiWaveView extends View implements AnimatorUpdateListener { /** * Animation used to attract user's attention to the target button. - * Assumes mChevronDrawables is an a list with an even number of chevrons filled with left - * followed by right chevrons. + * Assumes mChevronDrawables is an a list with an even number of chevrons filled with + * mFeedbackCount items in the order: left, right, top, bottom. */ private void startChevronAnimation() { final float r = mHandleDrawable.getWidth() / 2; @@ -442,6 +442,7 @@ public class MultiWaveView extends View implements AnimatorUpdateListener { mHandleDrawable.setX(mWaveCenterX); mHandleDrawable.setY(mWaveCenterY); mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE); + Tweener.reset(); } @Override diff --git a/core/java/com/android/internal/widget/multiwaveview/Tweener.java b/core/java/com/android/internal/widget/multiwaveview/Tweener.java index 0cff00a..bc8a62f 100644 --- a/core/java/com/android/internal/widget/multiwaveview/Tweener.java +++ b/core/java/com/android/internal/widget/multiwaveview/Tweener.java @@ -18,25 +18,42 @@ package com.android.internal.widget.multiwaveview; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; import android.animation.Animator.AnimatorListener; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.TimeInterpolator; import android.animation.ValueAnimator.AnimatorUpdateListener; +import android.util.Log; class Tweener { private static final String TAG = "Tweener"; + private static final boolean DEBUG = false; - private Object object; ObjectAnimator animator; private static HashMap<Object, Tweener> sTweens = new HashMap<Object, Tweener>(); - public Tweener(Object obj, ObjectAnimator anim) { - object = obj; + public Tweener(ObjectAnimator anim) { animator = anim; } + private static void remove(Animator animator) { + Iterator<Entry<Object, Tweener>> iter = sTweens.entrySet().iterator(); + while (iter.hasNext()) { + Entry<Object, Tweener> entry = iter.next(); + if (entry.getValue().animator == animator) { + if (DEBUG) Log.v(TAG, "Removing tweener " + sTweens.get(entry.getKey()) + + " sTweens.size() = " + sTweens.size()); + iter.remove(); + break; // an animator can only be attached to one object + } + } + } + public static Tweener to(Object object, long duration, Object... vars) { long delay = 0; AnimatorUpdateListener updateListener = null; @@ -77,32 +94,35 @@ class Tweener { // Re-use existing tween, if present Tweener tween = sTweens.get(object); + ObjectAnimator anim = null; if (tween == null) { - ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(object, + anim = ObjectAnimator.ofPropertyValuesHolder(object, props.toArray(new PropertyValuesHolder[props.size()])); - tween = new Tweener(object, anim); + tween = new Tweener(anim); sTweens.put(object, tween); + if (DEBUG) Log.v(TAG, "Added new Tweener " + tween); } else { - tween.animator.cancel(); - replace(props, object); + anim = sTweens.get(object).animator; + replace(props, object); // Cancel all animators for given object } if (interpolator != null) { - tween.animator.setInterpolator(interpolator); + anim.setInterpolator(interpolator); } // Update animation with properties discovered in loop above - tween.animator.setStartDelay(delay); - tween.animator.setDuration(duration); + anim.setStartDelay(delay); + anim.setDuration(duration); if (updateListener != null) { - tween.animator.removeAllUpdateListeners(); // There should be only one - tween.animator.addUpdateListener(updateListener); + anim.removeAllUpdateListeners(); // There should be only one + anim.addUpdateListener(updateListener); } if (listener != null) { - tween.animator.removeAllListeners(); // There should be only one. - tween.animator.addListener(listener); + anim.removeAllListeners(); // There should be only one. + anim.addListener(listener); } - tween.animator.start(); + anim.addListener(mCleanupListener); + anim.start(); return tween; } @@ -114,18 +134,40 @@ class Tweener { return Tweener.to(object, duration, vars); } - static void replace(ArrayList<PropertyValuesHolder> props, Object... args) { + // Listener to watch for completed animations and remove them. + private static AnimatorListener mCleanupListener = new AnimatorListenerAdapter() { + + @Override + public void onAnimationEnd(Animator animation) { + remove(animation); + } + + @Override + public void onAnimationCancel(Animator animation) { + remove(animation); + } + }; + + public static void reset() { + if (DEBUG) { + Log.v(TAG, "Reset()"); + if (sTweens.size() > 0) { + Log.v(TAG, "Cleaning up " + sTweens.size() + " animations"); + } + } + sTweens.clear(); + } + + private static void replace(ArrayList<PropertyValuesHolder> props, Object... args) { for (final Object killobject : args) { Tweener tween = sTweens.get(killobject); if (tween != null) { - if (killobject == tween.object) { - tween.animator.cancel(); - if (props != null) { - tween.animator.setValues( - props.toArray(new PropertyValuesHolder[props.size()])); - } else { - sTweens.remove(tween); - } + tween.animator.cancel(); + if (props != null) { + tween.animator.setValues( + props.toArray(new PropertyValuesHolder[props.size()])); + } else { + sTweens.remove(tween); } } } |