summaryrefslogtreecommitdiffstats
path: root/chips/src/com/android/ex/chips/BaseRecipientAdapter.java
diff options
context:
space:
mode:
authorMindy Pereira <mindyp@google.com>2012-05-25 10:04:51 -0700
committerMindy Pereira <mindyp@google.com>2012-05-25 10:09:24 -0700
commit1e9e640680692868c1323422f248261c4ff4d259 (patch)
treef00650ef85f618b44a63fe8be5298dea26001efc /chips/src/com/android/ex/chips/BaseRecipientAdapter.java
parent5c9051141d7dc1a21ea619c10afcd18e37b615a2 (diff)
downloadandroid_frameworks_ex-1e9e640680692868c1323422f248261c4ff4d259.tar.gz
android_frameworks_ex-1e9e640680692868c1323422f248261c4ff4d259.tar.bz2
android_frameworks_ex-1e9e640680692868c1323422f248261c4ff4d259.zip
Rather than change the text, just remove the waiting for entries row.
Fixes b/6546713 Blank suggestion is sometimes shown even if nothing was typed per ux Change-Id: I5c6d1f6620426bd96abca1bad650663ab6c5c426
Diffstat (limited to 'chips/src/com/android/ex/chips/BaseRecipientAdapter.java')
-rw-r--r--chips/src/com/android/ex/chips/BaseRecipientAdapter.java111
1 files changed, 44 insertions, 67 deletions
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.
*/