Hide presence icon when unknown.

- the "offline" icon isn't much use for a lot of our (non-gmail) users
anyways and it takes precious real estate in the header

Bug: 5147565
Change-Id: Iea3df0c1c3756ff749e50ce46a7437488dc169e7
This commit is contained in:
Ben Komalo 2011-08-11 14:50:44 -07:00
parent 7c98d35990
commit 6f96c779cf
3 changed files with 17 additions and 6 deletions

View File

@ -56,12 +56,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dip"
android:visibility="gone"
/>
<TextView
android:id="@+id/from_address"
style="@style/message_header_sender_address"
android:layout_below="@+id/from_name"
android:layout_toRightOf="@+id/presence"
android:layout_alignWithParentIfMissing="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dip"

View File

@ -16,9 +16,6 @@
package com.android.email.activity;
import com.android.emailcommon.Logging;
import com.android.emailcommon.utility.Utility;
import android.content.AsyncTaskLoader;
import android.content.ContentUris;
import android.content.Context;
@ -33,11 +30,14 @@ import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.StatusUpdates;
import android.util.Log;
import com.android.emailcommon.Logging;
import com.android.emailcommon.utility.Utility;
/**
* Loader to load presence statuses and the contact photo.
*/
public class ContactStatusLoader extends AsyncTaskLoader<ContactStatusLoader.Result> {
public static final int PRESENCE_UNKNOWN_RESOURCE_ID = android.R.drawable.presence_offline;
private static final int PRESENCE_UNKNOWN_RESOURCE_ID = android.R.drawable.presence_offline;
/** email address -> photo id, presence */
/* package */ static final String[] PROJECTION_PHOTO_ID_PRESENCE = new String[] {
@ -76,6 +76,10 @@ public class ContactStatusLoader extends AsyncTaskLoader<ContactStatusLoader.Res
mPresenceResId = presenceResId;
mLookupUri = lookupUri;
}
public boolean isUnknown() {
return PRESENCE_UNKNOWN_RESOURCE_ID == mPresenceResId;
}
}
public ContactStatusLoader(Context context, String emailAddress) {

View File

@ -530,7 +530,6 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
private void initContactStatusViews() {
mContactStatusState = CONTACT_STATUS_STATE_UNLOADED;
mQuickContactLookupUri = null;
mSenderPresenceView.setImageResource(ContactStatusLoader.PRESENCE_UNKNOWN_RESOURCE_ID);
showDefaultQuickContactBadgeImage();
}
@ -731,7 +730,13 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
(mFragment.mContactStatusState == CONTACT_STATUS_STATE_UNLOADED_TRIGGERED);
mFragment.mContactStatusState = CONTACT_STATUS_STATE_LOADED;
mFragment.mQuickContactLookupUri = result.mLookupUri;
mFragment.mSenderPresenceView.setImageResource(result.mPresenceResId);
if (result.isUnknown()) {
mFragment.mSenderPresenceView.setVisibility(View.GONE);
} else {
mFragment.mSenderPresenceView.setVisibility(View.VISIBLE);
mFragment.mSenderPresenceView.setImageResource(result.mPresenceResId);
}
if (result.mPhoto != null) { // photo will be null if unknown.
mFragment.mFromBadge.setImageBitmap(result.mPhoto);
}