diff options
author | Mindy Pereira <mindyp@google.com> | 2012-05-25 10:13:42 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-25 10:13:42 -0700 |
commit | d5c5e621362f5f6c6592ef69c0cb8a79441e3e6b (patch) | |
tree | 633306873d1de675f3c1b06e3a05d2684bdcba66 /chips | |
parent | 9c8e43d28551cb00a1bc1e501b8e2a4237838c5d (diff) | |
parent | 1e9e640680692868c1323422f248261c4ff4d259 (diff) | |
download | android_frameworks_ex-d5c5e621362f5f6c6592ef69c0cb8a79441e3e6b.tar.gz android_frameworks_ex-d5c5e621362f5f6c6592ef69c0cb8a79441e3e6b.tar.bz2 android_frameworks_ex-d5c5e621362f5f6c6592ef69c0cb8a79441e3e6b.zip |
Merge "Rather than change the text, just remove the waiting for entries row." into jb-dev
Diffstat (limited to 'chips')
-rw-r--r-- | chips/res/layout/chips_waiting_for_directory_search.xml | 46 | ||||
-rw-r--r-- | chips/res/values/strings.xml | 3 | ||||
-rw-r--r-- | chips/src/com/android/ex/chips/BaseRecipientAdapter.java | 111 | ||||
-rw-r--r-- | chips/src/com/android/ex/chips/RecipientEntry.java | 6 |
4 files changed, 45 insertions, 121 deletions
diff --git a/chips/res/layout/chips_waiting_for_directory_search.xml b/chips/res/layout/chips_waiting_for_directory_search.xml deleted file mode 100644 index 5ed1ec2..0000000 --- a/chips/res/layout/chips_waiting_for_directory_search.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2011 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. ---> - -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dip" - android:orientation="horizontal" - android:layout_centerVertical="true" - android:layout_gravity="center_vertical"> - <ProgressBar android:id="@+id/progress_circular" - style="?android:attr/progressBarStyle" - android:indeterminate="true" - android:layout_centerVertical="true" - android:layout_alignParentLeft="true" - android:layout_marginLeft="8dip" - android:layout_marginRight="8dip" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - <TextView android:id="@+id/text1" - android:textColor="?android:attr/textColorSecondary" - android:textAppearance="?android:attr/textAppearanceMedium" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_toRightOf="@id/progress_circular" - android:layout_centerVertical="true" - android:gravity="center_vertical" - android:paddingLeft="6dip" - android:singleLine="true" - android:ellipsize="end" - android:text="@string/chips_waiting_for_directory_result" - /> -</RelativeLayout> diff --git a/chips/res/values/strings.xml b/chips/res/values/strings.xml index f67d440..f743ae3 100644 --- a/chips/res/values/strings.xml +++ b/chips/res/values/strings.xml @@ -17,9 +17,6 @@ <!-- Text displayed when the recipientedittextview is not focused. Displays the total number of recipients since the field is shrunk to just display a portion --> <string name="more_string"><xliff:g id="count">%1$s</xliff:g> more...</string> - <!-- Text displayed when there are remote directories not returning results. - [CHAR LIMIT=50] --> - <string name="chips_waiting_for_directory_result">Waiting for more contacts</string> <!-- Text displayed when the user long presses on a chip to copy the recipients email address. [CHAR LIMIT=200] --> <string name="copy_email">Copy email address</string> diff --git a/chips/src/com/android/ex/chips/BaseRecipientAdapter.java b/chips/src/com/android/ex/chips/BaseRecipientAdapter.java index a0ebd7f..2e1491a 100644 --- a/chips/src/com/android/ex/chips/BaseRecipientAdapter.java +++ b/chips/src/com/android/ex/chips/BaseRecipientAdapter.java @@ -685,10 +685,6 @@ public abstract class BaseRecipientAdapter extends BaseAdapter implements Filter } } - if (showMessageIfDirectoryLoadRemaining && mRemainingDirectoryCount > 0) { - entries.add(RecipientEntry.WAITING_FOR_DIRECTORY_SEARCH); - } - return entries; } @@ -834,71 +830,59 @@ public abstract class BaseRecipientAdapter extends BaseAdapter implements Filter @Override public View getView(int position, View convertView, ViewGroup parent) { final RecipientEntry entry = mEntries.get(position); - switch (entry.getEntryType()) { - case RecipientEntry.ENTRY_TYPE_WAITING_FOR_DIRECTORY_SEARCH: { - return convertView != null ? convertView - : mInflater.inflate(getWaitingForDirectorySearchLayout(), parent, false); + String displayName = entry.getDisplayName(); + String destination = entry.getDestination(); + if (TextUtils.isEmpty(displayName) || TextUtils.equals(displayName, destination)) { + displayName = destination; + + // We only show the destination for secondary entries, so clear it + // only for the first level. + if (entry.isFirstLevel()) { + destination = null; } - default: { - String displayName = entry.getDisplayName(); - String destination = entry.getDestination(); - if (TextUtils.isEmpty(displayName) - || TextUtils.equals(displayName, destination)) { - displayName = destination; - - // We only show the destination for secondary entries, so clear it only for - // the first level. - if (entry.isFirstLevel()) { - destination = null; - } - } + } - final View itemView = convertView != null ? convertView - : mInflater.inflate(getItemLayout(), parent, false); - final TextView displayNameView = - (TextView) itemView.findViewById(getDisplayNameId()); - final TextView destinationView = - (TextView) itemView.findViewById(getDestinationId()); - final TextView destinationTypeView = - (TextView) itemView.findViewById(getDestinationTypeId()); - final ImageView imageView = (ImageView)itemView.findViewById(getPhotoId()); - displayNameView.setText(displayName); - if (!TextUtils.isEmpty(destination)) { - destinationView.setText(destination); - } else { - destinationView.setText(null); - } - if (destinationTypeView != null) { - final CharSequence destinationType = mQuery.getTypeLabel( - mContext.getResources(), - entry.getDestinationType(), + final View itemView = convertView != null ? convertView : mInflater.inflate( + getItemLayout(), parent, false); + final TextView displayNameView = (TextView) itemView.findViewById(getDisplayNameId()); + final TextView destinationView = (TextView) itemView.findViewById(getDestinationId()); + final TextView destinationTypeView = (TextView) itemView + .findViewById(getDestinationTypeId()); + final ImageView imageView = (ImageView) itemView.findViewById(getPhotoId()); + displayNameView.setText(displayName); + if (!TextUtils.isEmpty(destination)) { + destinationView.setText(destination); + } else { + destinationView.setText(null); + } + if (destinationTypeView != null) { + final CharSequence destinationType = mQuery + .getTypeLabel(mContext.getResources(), entry.getDestinationType(), entry.getDestinationLabel()).toString().toUpperCase(); - destinationTypeView.setText(destinationType); - } + destinationTypeView.setText(destinationType); + } - if (entry.isFirstLevel()) { - displayNameView.setVisibility(View.VISIBLE); - if (imageView != null) { - imageView.setVisibility(View.VISIBLE); - final byte[] photoBytes = entry.getPhotoBytes(); - if (photoBytes != null && imageView != null) { - final Bitmap photo = BitmapFactory.decodeByteArray( - photoBytes, 0, photoBytes.length); - imageView.setImageBitmap(photo); - } else { - imageView.setImageResource(getDefaultPhotoResource()); - } - } + if (entry.isFirstLevel()) { + displayNameView.setVisibility(View.VISIBLE); + if (imageView != null) { + imageView.setVisibility(View.VISIBLE); + final byte[] photoBytes = entry.getPhotoBytes(); + if (photoBytes != null && imageView != null) { + final Bitmap photo = BitmapFactory.decodeByteArray(photoBytes, 0, + photoBytes.length); + imageView.setImageBitmap(photo); } else { - displayNameView.setVisibility(View.GONE); - if (imageView != null) { - imageView.setVisibility(View.INVISIBLE); - } + imageView.setImageResource(getDefaultPhotoResource()); } - return itemView; + } + } else { + displayNameView.setVisibility(View.GONE); + if (imageView != null) { + imageView.setVisibility(View.INVISIBLE); } } + return itemView; } /** @@ -913,13 +897,6 @@ public abstract class BaseRecipientAdapter extends BaseAdapter implements Filter } /** - * Returns a layout id for a view showing "waiting for more contacts". - */ - protected int getWaitingForDirectorySearchLayout() { - return R.layout.chips_waiting_for_directory_search; - } - - /** * Returns a resource ID representing an image which should be shown when ther's no relevant * photo is available. */ diff --git a/chips/src/com/android/ex/chips/RecipientEntry.java b/chips/src/com/android/ex/chips/RecipientEntry.java index 4f22142..0448229 100644 --- a/chips/src/com/android/ex/chips/RecipientEntry.java +++ b/chips/src/com/android/ex/chips/RecipientEntry.java @@ -36,12 +36,8 @@ public class RecipientEntry { /* package */ static final int INVALID_DESTINATION_TYPE = -1; public static final int ENTRY_TYPE_PERSON = 0; - public static final int ENTRY_TYPE_WAITING_FOR_DIRECTORY_SEARCH = 1; - public static final int ENTRY_TYPE_SIZE = 2; - - public static final RecipientEntry WAITING_FOR_DIRECTORY_SEARCH = - new RecipientEntry(ENTRY_TYPE_WAITING_FOR_DIRECTORY_SEARCH); + public static final int ENTRY_TYPE_SIZE = 1; private final int mEntryType; |