diff options
author | Ta-wei Yen <twyen@google.com> | 2015-11-04 03:01:16 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-11-04 03:01:16 +0000 |
commit | 8ba3caecc527b6a2a4e3c93bcd649c3274694d6c (patch) | |
tree | 56b8a7896295f452730774fe1c82b4e11d0c0a53 | |
parent | 707863aa4d5f49c85f46ac4073413ee2fbf48d69 (diff) | |
parent | 6a8de737e8ccb21647adb56d3e5248595f85436d (diff) |
Merge "DiatactsActivity title indicate dialpad status, removed excessive "showing item" messages." into ub-contactsdialer-a-dev
am: 6a8de737e8
* commit '6a8de737e8ccb21647adb56d3e5248595f85436d':
DiatactsActivity title indicate dialpad status, removed excessive "showing item" messages.
-rw-r--r-- | res/values/strings.xml | 3 | ||||
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 12 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 6 | ||||
-rw-r--r-- | src/com/android/dialer/list/ContentChangedFilter.java | 40 | ||||
-rw-r--r-- | src/com/android/dialer/list/SearchFragment.java | 7 | ||||
-rw-r--r-- | src/com/android/dialer/list/SpeedDialFragment.java | 5 |
6 files changed, 64 insertions, 9 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 4d4fb1e84..fe5f41baa 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -26,6 +26,9 @@ used in the Launcher icon. --> <string name="launcherActivityLabel">Phone</string> + + <!-- Title for the activity that dials the phone, when launched directly into the dialpad --> + <string name="launcherDialpadActivityLabel">Phone Dialpad</string> <!-- The description text for the dialer tab. Note: AccessibilityServices use this attribute to announce what the view represents. diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 9105e6f5a..dabe590ad 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -48,7 +48,6 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.View.OnDragListener; -import android.view.View.OnTouchListener; import android.view.ViewTreeObserver; import android.view.animation.Animation; import android.view.animation.AnimationUtils; @@ -83,16 +82,14 @@ import com.android.dialer.list.SearchFragment; import com.android.dialer.list.SmartDialSearchFragment; import com.android.dialer.list.SpeedDialFragment; import com.android.dialer.settings.DialerSettingsActivity; +import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; -import com.android.dialer.util.TelecomUtil; import com.android.dialer.util.IntentUtil.CallIntentBuilder; -import com.android.dialer.util.DialerUtils; +import com.android.dialer.util.TelecomUtil; import com.android.dialer.widget.ActionBarController; import com.android.dialer.widget.SearchEditTextLayout; -import com.android.dialer.widget.SearchEditTextLayout.Callback; import com.android.dialerbind.DatabaseHelperManager; import com.android.dialerbind.ObjectFactory; -import com.android.incallui.Call.LogState; import com.android.phone.common.animation.AnimUtils; import com.android.phone.common.animation.AnimationListenerAdapter; @@ -756,6 +753,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mActionBarController.onDialpadUp(); mListsFragment.getView().animate().alpha(0).withLayer(); + + //adjust the title, so the user will know where we're at when the activity start/resumes. + setTitle(R.string.launcherDialpadActivityLabel); } /** @@ -808,6 +808,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O exitSearchUi(); } } + //reset the title to normal. + setTitle(R.string.launcherActivityLabel); } /** diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 517711016..760b02032 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -16,6 +16,8 @@ package com.android.dialer.dialpad; +import com.google.common.annotations.VisibleForTesting; + import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; @@ -27,7 +29,6 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; -import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -80,14 +81,13 @@ import com.android.dialer.R; import com.android.dialer.SpecialCharSequenceMgr; import com.android.dialer.calllog.PhoneAccountUtils; import com.android.dialer.util.DialerUtils; -import com.android.dialer.util.TelecomUtil; import com.android.dialer.util.IntentUtil.CallIntentBuilder; +import com.android.dialer.util.TelecomUtil; import com.android.incallui.Call.LogState; import com.android.phone.common.CallLogAsync; import com.android.phone.common.animation.AnimUtils; import com.android.phone.common.dialpad.DialpadKeyButton; import com.android.phone.common.dialpad.DialpadView; -import com.google.common.annotations.VisibleForTesting; import java.util.HashSet; import java.util.List; diff --git a/src/com/android/dialer/list/ContentChangedFilter.java b/src/com/android/dialer/list/ContentChangedFilter.java new file mode 100644 index 000000000..e552aa3f0 --- /dev/null +++ b/src/com/android/dialer/list/ContentChangedFilter.java @@ -0,0 +1,40 @@ +package com.android.dialer.list; + +import android.view.View; +import android.view.View.AccessibilityDelegate; +import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; + +/** + * AccessibilityDelegate that will filter out TYPE_WINDOW_CONTENT_CHANGED + * Used to suppress "Showing items x of y" from firing of ListView whenever it's content changes. + * AccessibilityEvent can only be rejected at a view's parent once it is generated, + * use addToParent() to add this delegate to the parent. + */ +public class ContentChangedFilter extends AccessibilityDelegate { + //the view we don't want TYPE_WINDOW_CONTENT_CHANGED to fire. + private View mView; + + /** + * Add this delegate to the parent of @param view to filter out TYPE_WINDOW_CONTENT_CHANGED + */ + public static void addToParent(View view){ + View parent = (View) view.getParent(); + parent.setAccessibilityDelegate(new ContentChangedFilter(view)); + } + + private ContentChangedFilter(View view){ + super(); + mView = view; + } + @Override + public boolean onRequestSendAccessibilityEvent (ViewGroup host, View child, AccessibilityEvent event){ + if(child == mView){ + if(event.getEventType() == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED){ + return false; + } + } + return super.onRequestSendAccessibilityEvent(host,child,event); + } + +} diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java index c8711e769..9b0f53621 100644 --- a/src/com/android/dialer/list/SearchFragment.java +++ b/src/com/android/dialer/list/SearchFragment.java @@ -44,8 +44,8 @@ import com.android.contacts.common.list.OnPhoneNumberPickerActionListener; import com.android.contacts.common.list.PhoneNumberPickerFragment; import com.android.contacts.common.util.PermissionsUtil; import com.android.contacts.common.util.ViewUtil; -import com.android.dialer.dialpad.DialpadFragment.ErrorDialogFragment; import com.android.dialer.R; +import com.android.dialer.dialpad.DialpadFragment.ErrorDialogFragment; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; import com.android.dialer.widget.EmptyContentView; @@ -136,6 +136,11 @@ public class SearchFragment extends PhoneNumberPickerFragment { listView.setBackgroundColor(res.getColor(R.color.background_dialer_results)); listView.setClipToPadding(false); setVisibleScrollbarEnabled(false); + + //Turn of accessibility live region as the list constantly update itself and spam messages. + listView.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE); + ContentChangedFilter.addToParent(listView); + listView.setOnScrollListener(new OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { diff --git a/src/com/android/dialer/list/SpeedDialFragment.java b/src/com/android/dialer/list/SpeedDialFragment.java index e30f40633..19180f81e 100644 --- a/src/com/android/dialer/list/SpeedDialFragment.java +++ b/src/com/android/dialer/list/SpeedDialFragment.java @@ -255,6 +255,11 @@ public class SpeedDialFragment extends Fragment implements OnItemClickListener, mListView.setOnScrollListener(mScrollListener); mListView.setFastScrollEnabled(false); mListView.setFastScrollAlwaysVisible(false); + + //prevent content changes of the list from firing accessibility events. + mListView.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE); + ContentChangedFilter.addToParent(mListView); + Trace.endSection(); return mParentView; } |