diff options
author | Yorke Lee <yorkelee@google.com> | 2014-11-13 02:12:41 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-13 02:12:41 +0000 |
commit | 4435d37eb2c0ee16900aba38edf694e5f3f5400b (patch) | |
tree | ad62bed85b77533431c321a2807aef4340c23519 | |
parent | 7227ca7f1b7f4167cb6aa7f1d02748dbd7dc1bcc (diff) | |
parent | 3a13c56eca834717f1a5888551febc1d5e94390d (diff) |
am 3a13c56e: am c599b6f4: am afb64682: Merge "Lookup badge member variables correctly during bindBadge" into lmp-mr1-dev
* commit '3a13c56eca834717f1a5888551febc1d5e94390d':
Lookup badge member variables correctly during bindBadge
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 5e762c721..99bf38615 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -1059,31 +1059,34 @@ public class CallLogAdapter extends GroupingListAdapter final ViewStub stub = (ViewStub) view.findViewById(R.id.link_stub); if (UriUtils.isEncodedContactUri(info.lookupUri)) { if (stub != null) { - final View inflated = stub.inflate(); - inflated.setVisibility(View.VISIBLE); - mBadgeContainer = inflated.findViewById(R.id.badge_link_container); - mBadgeImageView = (ImageView) inflated.findViewById(R.id.badge_image); - mBadgeText = (TextView) inflated.findViewById(R.id.badge_text); + mBadgeContainer = stub.inflate(); + } else { + mBadgeContainer = view.findViewById(R.id.badge_container); } - mBadgeContainer.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - final Intent intent = - DialtactsActivity.getAddNumberToContactIntent(details.number); - DialerUtils.startActivityWithErrorToast(mContext, intent, - R.string.add_contact_not_available); - } - }); + mBadgeContainer.setVisibility(View.VISIBLE); + mBadgeImageView = (ImageView) mBadgeContainer.findViewById(R.id.badge_image); + mBadgeText = (TextView) mBadgeContainer.findViewById(R.id.badge_text); + + final View clickableArea = mBadgeContainer.findViewById(R.id.badge_link_container); + if (clickableArea != null) { + clickableArea.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Intent intent = + DialtactsActivity.getAddNumberToContactIntent(details.number); + DialerUtils.startActivityWithErrorToast(mContext, intent, + R.string.add_contact_not_available); + } + }); + } mBadgeImageView.setImageResource(R.drawable.ic_person_add_24dp); mBadgeText.setText(R.string.recentCalls_addToContact); } else { // Hide badge if it was previously shown. - if (stub == null) { - final View container = view.findViewById(R.id.badge_container); - if (container != null) { - container.setVisibility(View.GONE); - } + mBadgeContainer = view.findViewById(R.id.badge_container); + if (mBadgeContainer != null) { + mBadgeContainer.setVisibility(View.GONE); } } } |