summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-11-10 18:23:05 -0800
committerYorke Lee <yorkelee@google.com>2014-11-10 18:29:19 -0800
commit6568ffe6f41020ced1824dbc95ecdbb75dcddbac (patch)
tree4d3a800ae557202ba622e3d8893e5ac85790d58c
parent612f818e54a6652982b2d877b57e4024bb6f7b68 (diff)
Lookup badge member variables correctly during bindBadge
If a new call log view is provided, make sure to correctly find and stash the correct member variables inside bindBadge. Bug: 18016618 Change-Id: If01a68fc6c468905ab576b1c5927afa308238786
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java41
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);
}
}
}