From b77bf5df2b866dd40e330b7c2dedee4a1d51fc78 Mon Sep 17 00:00:00 2001 From: Sai Cheemalapati Date: Thu, 10 Jul 2014 11:42:34 -0700 Subject: DO NOT MERGE Added report button to UI and database. It toasts when clicked for now. The database is not updated when it is clicked yet. Bug: 11150383 Change-Id: Ifd588bdfb36dd8a96977a870071a064726f6e669 (cherry picked from commit 3eae4825ee9a29bd43c9b01d3cbf92de6ad3eb11) --- src/com/android/dialer/calllog/CallLogAdapter.java | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/com/android/dialer/calllog/CallLogAdapter.java') diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 2987c9e4e..8aa484604 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -36,6 +36,7 @@ import android.view.ViewStub; import android.view.ViewTreeObserver; import android.widget.ImageView; import android.widget.TextView; +import android.widget.Toast; import com.android.common.widget.GroupingListAdapter; import com.android.contacts.common.ContactPhotoManager; @@ -130,6 +131,7 @@ public class CallLogAdapter extends GroupingListAdapter protected final Context mContext; private final ContactInfoHelper mContactInfoHelper; private final CallFetcher mCallFetcher; + private final Toast mReportedToast; private ViewTreeObserver mViewTreeObserver = null; /** @@ -350,6 +352,9 @@ public class CallLogAdapter extends GroupingListAdapter mIsCallLog = isCallLog; mCallItemExpandedListener = callItemExpandedListener; + mReportedToast = Toast.makeText(mContext, R.string.toast_caller_id_reported, + Toast.LENGTH_SHORT); + mContactInfoCache = ExpirableCache.create(CONTACT_INFO_CACHE_SIZE); mRequests = new LinkedList(); @@ -750,6 +755,9 @@ public class CallLogAdapter extends GroupingListAdapter final PhoneCallDetails details; + views.reported = info.isBadData; + views.isExternal = mContactInfoHelper.isExternal(info.sourceType); + if (TextUtils.isEmpty(name)) { details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, @@ -907,7 +915,7 @@ public class CallLogAdapter extends GroupingListAdapter * * @param callLogItem The call log list item view. */ - private void inflateActionViewStub(View callLogItem) { + private void inflateActionViewStub(final View callLogItem) { final CallLogListItemViews views = (CallLogListItemViews)callLogItem.getTag(); ViewStub stub = (ViewStub)callLogItem.findViewById(R.id.call_log_entry_actions_stub); @@ -929,6 +937,19 @@ public class CallLogAdapter extends GroupingListAdapter views.detailsButtonView = (TextView)views.actionsView.findViewById(R.id.details_action); } + if (views.reportButtonView == null) { + views.reportButtonView = (TextView)views.actionsView.findViewById(R.id.report_action); + views.reportButtonView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mReportedToast.show(); + ((CallLogListItemViews) callLogItem.getTag()).reported = true; + v.setVisibility(View.GONE); + // TODO: Set the entry as reported in the database. + } + }); + } + bindActionButtons(views); } @@ -969,7 +990,9 @@ public class CallLogAdapter extends GroupingListAdapter IntentProvider.getCallDetailIntentProvider( views.rowId, views.callIds, null) ); - + if (views.isExternal && !views.reported) { + views.reportButtonView.setVisibility(View.VISIBLE); + } } mCallLogViewsHelper.setActionContentDescriptions(views); -- cgit v1.2.3