Remove semi-transparent first name on scrolling
Bug: 5197714 Semi-transparent "first name" effect doesn't go away
Removed the text animation when scrolling. This is not a fix
but a removal of the feature as was decided.
Change-Id: I6b4b7798ec2aea493ca464cffb4907fe21788b6f
diff --git a/res/layout/contact_picker_content.xml b/res/layout/contact_picker_content.xml
index c30add7..14eaf15 100644
--- a/res/layout/contact_picker_content.xml
+++ b/res/layout/contact_picker_content.xml
@@ -22,7 +22,7 @@
android:orientation="vertical">
<view
- class="com.android.contacts.list.ContactEntryListView"
+ class="com.android.contacts.widget.PinnedHeaderListView"
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dip"
diff --git a/res/layout/contacts_list_content.xml b/res/layout/contacts_list_content.xml
index 4223f54..8e1289f 100644
--- a/res/layout/contacts_list_content.xml
+++ b/res/layout/contacts_list_content.xml
@@ -57,7 +57,7 @@
</LinearLayout>
<view
- class="com.android.contacts.list.ContactEntryListView"
+ class="com.android.contacts.widget.PinnedHeaderListView"
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dip"
diff --git a/res/layout/join_contact_picker_list_content.xml b/res/layout/join_contact_picker_list_content.xml
index 9e72c31..1535539 100644
--- a/res/layout/join_contact_picker_list_content.xml
+++ b/res/layout/join_contact_picker_list_content.xml
@@ -36,7 +36,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<view
- class="com.android.contacts.list.ContactEntryListView"
+ class="com.android.contacts.widget.PinnedHeaderListView"
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/src/com/android/contacts/list/ContactEntryListAdapter.java b/src/com/android/contacts/list/ContactEntryListAdapter.java
index ba16c17..9b968f7 100644
--- a/src/com/android/contacts/list/ContactEntryListAdapter.java
+++ b/src/com/android/contacts/list/ContactEntryListAdapter.java
@@ -242,22 +242,6 @@
mSortOrder = sortOrder;
}
- public void setNameHighlightingEnabled(boolean flag) {
- mNameHighlightingEnabled = flag;
- }
-
- public boolean isNameHighlightingEnabled() {
- return mNameHighlightingEnabled;
- }
-
- public void setTextWithHighlightingFactory(TextWithHighlightingFactory factory) {
- mTextWithHighlightingFactory = factory;
- }
-
- protected TextWithHighlightingFactory getTextWithHighlightingFactory() {
- return mTextWithHighlightingFactory;
- }
-
public void setPhotoLoader(ContactPhotoManager photoLoader) {
mPhotoLoader = photoLoader;
}
diff --git a/src/com/android/contacts/list/ContactEntryListFragment.java b/src/com/android/contacts/list/ContactEntryListFragment.java
index 4ddba75..a4163fd 100644
--- a/src/com/android/contacts/list/ContactEntryListFragment.java
+++ b/src/com/android/contacts/list/ContactEntryListFragment.java
@@ -717,11 +717,6 @@
changed = true;
}
- if (mListView instanceof ContactEntryListView) {
- ContactEntryListView listView = (ContactEntryListView)mListView;
- listView.setHighlightNamesWhenScrolling(isNameHighlightingEnabled());
- }
-
return changed;
}
@@ -756,6 +751,8 @@
"'android.R.id.list'");
}
+ mListView.setSelector(getContext().getResources().getDrawable(R.drawable.list_selector));
+
View emptyView = mView.findViewById(com.android.internal.R.id.empty);
if (emptyView != null) {
mListView.setEmptyView(emptyView);
@@ -810,30 +807,11 @@
mAdapter.setPinnedPartitionHeadersEnabled(mSearchMode);
mAdapter.setContactNameDisplayOrder(mDisplayOrder);
mAdapter.setSortOrder(mSortOrder);
- mAdapter.setNameHighlightingEnabled(isNameHighlightingEnabled());
mAdapter.setSectionHeaderDisplayEnabled(mSectionHeaderDisplayEnabled);
mAdapter.setSelectionVisible(mSelectionVisible);
mAdapter.setDirectoryResultLimit(mDirectoryResultLimit);
}
- protected boolean isNameHighlightingEnabled() {
- if (mAdapter.isNameHighlightingEnabled()) {
- return true;
- }
-
- // When sort order and display order contradict each other, we want to
- // highlight the part of the name used for sorting.
- if (mSortOrder == ContactsContract.Preferences.SORT_ORDER_PRIMARY &&
- mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_ALTERNATIVE) {
- return true;
- } else if (mSortOrder == ContactsContract.Preferences.SORT_ORDER_ALTERNATIVE &&
- mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY) {
- return true;
- } else {
- return false;
- }
- }
-
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
int totalItemCount) {
diff --git a/src/com/android/contacts/list/ContactEntryListView.java b/src/com/android/contacts/list/ContactEntryListView.java
deleted file mode 100644
index 86e33fe..0000000
--- a/src/com/android/contacts/list/ContactEntryListView.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2010 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.contacts.list;
-
-import com.android.contacts.R;
-import com.android.contacts.widget.PinnedHeaderListView;
-import com.android.contacts.widget.TextHighlightingAnimation;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.widget.AbsListView;
-import android.widget.ListAdapter;
-
-/**
- * A custom list view for a list of contacts or contact-related entries. It handles
- * animation of names on scroll.
- */
-public class ContactEntryListView extends PinnedHeaderListView {
-
- private static final int TEXT_HIGHLIGHTING_ANIMATION_DURATION = 350;
-
- private final TextHighlightingAnimation mHighlightingAnimation =
- new ContactNameHighlightingAnimation(this, TEXT_HIGHLIGHTING_ANIMATION_DURATION);
-
- private boolean mHighlightNamesWhenScrolling;
-
- public ContactEntryListView(Context context) {
- this(context, null);
- }
-
- public ContactEntryListView(Context context, AttributeSet attrs) {
- this(context, attrs, com.android.internal.R.attr.listViewStyle);
- }
-
- public ContactEntryListView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- setSelector(getContext().getResources().getDrawable(R.drawable.list_selector));
- }
-
- public TextHighlightingAnimation getTextHighlightingAnimation() {
- return mHighlightingAnimation;
- }
-
- public boolean getHighlightNamesWhenScrolling() {
- return mHighlightNamesWhenScrolling;
- }
-
- public void setHighlightNamesWhenScrolling(boolean flag) {
- mHighlightNamesWhenScrolling = flag;
- }
-
- @Override
- public void setAdapter(ListAdapter adapter) {
- super.setAdapter(adapter);
- if (adapter instanceof ContactEntryListAdapter) {
- ((ContactEntryListAdapter)adapter)
- .setTextWithHighlightingFactory(mHighlightingAnimation);
- }
- }
-
- @Override
- public void onScrollStateChanged(AbsListView view, int scrollState) {
- super.onScrollStateChanged(view, scrollState);
- if (mHighlightNamesWhenScrolling) {
- if (scrollState != OnScrollListener.SCROLL_STATE_IDLE) {
- mHighlightingAnimation.startHighlighting();
- } else {
- mHighlightingAnimation.stopHighlighting();
- }
- }
- }
-}
diff --git a/src/com/android/contacts/list/ContactListAdapter.java b/src/com/android/contacts/list/ContactListAdapter.java
index 2e511bc..c057a48 100644
--- a/src/com/android/contacts/list/ContactListAdapter.java
+++ b/src/com/android/contacts/list/ContactListAdapter.java
@@ -222,7 +222,6 @@
ViewGroup parent) {
ContactListItemView view = new ContactListItemView(context, null);
view.setUnknownNameText(mUnknownNameText);
- view.setTextWithHighlightingFactory(getTextWithHighlightingFactory());
view.setQuickContactEnabled(isQuickContactEnabled());
view.setActivatedStateSupported(isSelectionVisible());
return view;
@@ -271,7 +270,7 @@
protected void bindName(final ContactListItemView view, Cursor cursor) {
view.showDisplayName(cursor, mDisplayNameColumnIndex, mAlternativeDisplayNameColumnIndex,
- isNameHighlightingEnabled(), getContactNameDisplayOrder());
+ false, getContactNameDisplayOrder());
view.showPhoneticName(cursor, CONTACT_PHONETIC_NAME_COLUMN_INDEX);
}
diff --git a/src/com/android/contacts/list/EmailAddressListAdapter.java b/src/com/android/contacts/list/EmailAddressListAdapter.java
index e1c8ea2..5f96297 100644
--- a/src/com/android/contacts/list/EmailAddressListAdapter.java
+++ b/src/com/android/contacts/list/EmailAddressListAdapter.java
@@ -120,7 +120,6 @@
ViewGroup parent) {
final ContactListItemView view = new ContactListItemView(context, null);
view.setUnknownNameText(mUnknownNameText);
- view.setTextWithHighlightingFactory(getTextWithHighlightingFactory());
view.setQuickContactEnabled(isQuickContactEnabled());
return view;
}
@@ -167,8 +166,7 @@
protected void bindName(final ContactListItemView view, Cursor cursor) {
view.showDisplayName(cursor, mDisplayNameColumnIndex, mAlternativeDisplayNameColumnIndex,
- isNameHighlightingEnabled(), getContactNameDisplayOrder());
-// view.showPhoneticName(cursor, PHONE_PHONETIC_NAME_COLUMN_INDEX);
+ false, getContactNameDisplayOrder());
}
protected void bindPhoto(final ContactListItemView view, Cursor cursor) {
diff --git a/src/com/android/contacts/list/PhoneNumberListAdapter.java b/src/com/android/contacts/list/PhoneNumberListAdapter.java
index 87fb60f..cac89b1 100644
--- a/src/com/android/contacts/list/PhoneNumberListAdapter.java
+++ b/src/com/android/contacts/list/PhoneNumberListAdapter.java
@@ -231,7 +231,6 @@
ViewGroup parent) {
final ContactListItemView view = new ContactListItemView(context, null);
view.setUnknownNameText(mUnknownNameText);
- view.setTextWithHighlightingFactory(getTextWithHighlightingFactory());
view.setQuickContactEnabled(isQuickContactEnabled());
return view;
}
@@ -240,9 +239,6 @@
protected void bindView(View itemView, int partition, Cursor cursor, int position) {
ContactListItemView view = (ContactListItemView)itemView;
- view.setHighlightedPrefix(isNameHighlightingEnabled() && isSearchMode() ?
- getUpperCaseQueryString() : null);
-
// Look at elements before and after this position, checking if contact IDs are same.
// If they have one same contact ID, it means they can be grouped.
//
@@ -317,7 +313,7 @@
protected void bindName(final ContactListItemView view, Cursor cursor) {
view.showDisplayName(cursor, mDisplayNameColumnIndex, mAlternativeDisplayNameColumnIndex,
- isNameHighlightingEnabled(), getContactNameDisplayOrder());
+ false, getContactNameDisplayOrder());
view.showPhoneticName(cursor, PHONE_PHONETIC_NAME_COLUMN_INDEX);
}
diff --git a/src/com/android/contacts/list/PhoneNumberPickerFragment.java b/src/com/android/contacts/list/PhoneNumberPickerFragment.java
index 5986b9c..2798905 100644
--- a/src/com/android/contacts/list/PhoneNumberPickerFragment.java
+++ b/src/com/android/contacts/list/PhoneNumberPickerFragment.java
@@ -56,16 +56,6 @@
private static final String KEY_FILTER = "filter";
- /**
- * Used to remember the result of {@link #setNameHighlightingEnabled(boolean)} when it is called
- * before this Fragment is attached to its parent Activity. The value will be used after
- * an actual Adapter is ready.
- *
- * Null if the Adapter is already available and thus we don't need to remember the user's
- * decision.
- */
- private Boolean mDelayedNameHighlightingEnabled;
-
public PhoneNumberPickerFragment() {
setQuickContactEnabled(false);
setPhotoLoaderEnabled(true);
@@ -191,16 +181,10 @@
if (!isLegacyCompatibilityMode()) {
PhoneNumberListAdapter adapter = new PhoneNumberListAdapter(getActivity());
adapter.setDisplayPhotos(true);
- if (mDelayedNameHighlightingEnabled != null) {
- adapter.setNameHighlightingEnabled(mDelayedNameHighlightingEnabled);
- }
return adapter;
} else {
LegacyPhoneNumberListAdapter adapter = new LegacyPhoneNumberListAdapter(getActivity());
adapter.setDisplayPhotos(true);
- if (mDelayedNameHighlightingEnabled != null) {
- adapter.setNameHighlightingEnabled(mDelayedNameHighlightingEnabled);
- }
return adapter;
}
}
@@ -251,25 +235,6 @@
mListener.onPickPhoneNumberAction(data.getData());
}
- public void setNameHighlightingEnabled(boolean highlight) {
- final Adapter adapter = getAdapter();
- // This may happen when the Fragment is not attached to its parent Activity and thus
- // parent's onCreateView() isn't called yet (where adapter will be prepared).
- // See also ContactEntryListFragment#onCreateView()
- if (adapter == null) {
- mDelayedNameHighlightingEnabled = highlight;
- } else {
- if (!isLegacyCompatibilityMode()) {
- ((PhoneNumberListAdapter) adapter).setNameHighlightingEnabled(highlight);
- } else {
- ((LegacyPhoneNumberListAdapter) adapter).setNameHighlightingEnabled(highlight);
- }
-
- // We don't want to remember the choice if the adapter is already available.
- mDelayedNameHighlightingEnabled = null;
- }
- }
-
public ContactListFilter getFilter() {
return mFilter;
}
diff --git a/src/com/android/contacts/list/PostalAddressListAdapter.java b/src/com/android/contacts/list/PostalAddressListAdapter.java
index 5642045..c9da281 100644
--- a/src/com/android/contacts/list/PostalAddressListAdapter.java
+++ b/src/com/android/contacts/list/PostalAddressListAdapter.java
@@ -109,7 +109,6 @@
ViewGroup parent) {
final ContactListItemView view = new ContactListItemView(context, null);
view.setUnknownNameText(mUnknownNameText);
- view.setTextWithHighlightingFactory(getTextWithHighlightingFactory());
view.setQuickContactEnabled(isQuickContactEnabled());
return view;
}
@@ -156,8 +155,7 @@
protected void bindName(final ContactListItemView view, Cursor cursor) {
view.showDisplayName(cursor, mDisplayNameColumnIndex, mAlternativeDisplayNameColumnIndex,
- isNameHighlightingEnabled(), getContactNameDisplayOrder());
-// view.showPhoneticName(cursor, PHONE_PHONETIC_NAME_COLUMN_INDEX);
+ false, getContactNameDisplayOrder());
}
protected void bindPhoto(final ContactListItemView view, Cursor cursor) {