From 14cfa66d6df53303c280194d661c0b32838aa417 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Fri, 13 Mar 2015 17:28:34 -0700 Subject: Delete call log list item extras. - Remove isCallLog specific code from adapter; now everything will always be in the call log. - Remove unneeded adapter bits from ListsFragment; there is now no shortcut card shown in the lists fragment. - Remove call log list item extra. We won't bind badges using this any more. This will be superseded by the actions. Remove badge-related code in CallLogAdapter. + Leaving the add-person icon, since it will be used in the future. Bug: 19372817 Bug: 19627987 Change-Id: I4db8149761b017e02e89c081930a05f3aafe9606 --- res/layout/call_log_list_item.xml | 6 +- res/layout/call_log_list_item_extra.xml | 68 ------------- res/values/colors.xml | 1 - res/values/dimens.xml | 3 - res/values/strings.xml | 3 - src/com/android/dialer/calllog/CallLogAdapter.java | 106 +++------------------ .../android/dialer/calllog/CallLogFragment.java | 2 +- src/com/android/dialer/list/ListsFragment.java | 56 +---------- src/com/android/dialerbind/ObjectFactory.java | 4 +- .../android/dialer/calllog/CallLogAdapterTest.java | 2 +- 10 files changed, 17 insertions(+), 234 deletions(-) delete mode 100644 res/layout/call_log_list_item_extra.xml diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml index db59b74d3..910e78f5e 100644 --- a/res/layout/call_log_list_item.xml +++ b/res/layout/call_log_list_item.xml @@ -155,9 +155,5 @@ android:layout_width="match_parent" android:layout_height="wrap_content"/> - - + diff --git a/res/layout/call_log_list_item_extra.xml b/res/layout/call_log_list_item_extra.xml deleted file mode 100644 index 87b932bc6..000000000 --- a/res/layout/call_log_list_item_extra.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/values/colors.xml b/res/values/colors.xml index cd3a804f0..f697cc8cc 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -38,7 +38,6 @@ #000000 - #0277bd 12dp diff --git a/res/values/strings.xml b/res/values/strings.xml index 78b74e656..13bf845c3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -526,9 +526,6 @@ --> Touch image to see all numbers or touch & hold to reorder - - Dismiss - Remove diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 914520e84..c4f6e89e1 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -266,12 +266,6 @@ public class CallLogAdapter extends GroupingListAdapter /** Can be set to true by tests to disable processing of requests. */ private volatile boolean mRequestProcessingDisabled = false; - private boolean mIsCallLog = true; - - private View mBadgeContainer; - private ImageView mBadgeImageView; - private TextView mBadgeText; - private int mCallLogBackgroundColor; private int mExpandedBackgroundColor; private float mExpandedTranslationZ; @@ -353,13 +347,12 @@ public class CallLogAdapter extends GroupingListAdapter public CallLogAdapter(Context context, CallFetcher callFetcher, ContactInfoHelper contactInfoHelper, CallItemExpandedListener callItemExpandedListener, - OnReportButtonClickListener onReportButtonClickListener, boolean isCallLog) { + OnReportButtonClickListener onReportButtonClickListener) { super(context); mContext = context; mCallFetcher = callFetcher; mContactInfoHelper = contactInfoHelper; - mIsCallLog = isCallLog; mCallItemExpandedListener = callItemExpandedListener; mOnReportButtonClickListener = onReportButtonClickListener; @@ -659,17 +652,12 @@ public class CallLogAdapter extends GroupingListAdapter final long rowId = c.getLong(CallLogQuery.ID); views.rowId = rowId; - // For entries in the call log, check if the day group has changed and display a header - // if necessary. - if (mIsCallLog) { - int currentGroup = getDayGroupForCall(rowId); - int previousGroup = getPreviousDayGroup(c); - if (currentGroup != previousGroup) { - views.dayGroupHeader.setVisibility(View.VISIBLE); - views.dayGroupHeader.setText(getGroupDescription(currentGroup)); - } else { - views.dayGroupHeader.setVisibility(View.GONE); - } + // Check if the day group has changed and display a header if necessary. + int currentGroup = getDayGroupForCall(rowId); + int previousGroup = getPreviousDayGroup(c); + if (currentGroup != previousGroup) { + views.dayGroupHeader.setVisibility(View.VISIBLE); + views.dayGroupHeader.setText(getGroupDescription(currentGroup)); } else { views.dayGroupHeader.setVisibility(View.GONE); } @@ -689,33 +677,11 @@ public class CallLogAdapter extends GroupingListAdapter final boolean isVoicemailNumber = mPhoneNumberUtilsWrapper.isVoicemailNumber(accountHandle, number); - // Where binding and not in the call log, use default behaviour of invoking a call when - // tapping the primary view. - if (!mIsCallLog) { - views.primaryActionView.setOnClickListener(this.mActionListener); - - // Set return call intent, otherwise null. - if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)) { - // Sets the primary action to call the number. - if (isVoicemailNumber) { - views.primaryActionView.setTag( - IntentProvider.getReturnVoicemailCallIntentProvider()); - } else { - views.primaryActionView.setTag( - IntentProvider.getReturnCallIntentProvider(number)); - } - } else { - // Number is not callable, so hide button. - views.primaryActionView.setTag(null); - } - } else { - // In the call log, expand/collapse an actions section for the call log entry when - // the primary view is tapped. - views.primaryActionView.setOnClickListener(this.mExpandCollapseListener); + // Expand/collapse an actions section for the call log entry when the primary view is tapped. + views.primaryActionView.setOnClickListener(this.mExpandCollapseListener); - // Note: Binding of the action buttons is done as required in configureActionViews - // when the user expands the actions ViewStub. - } + // Note: Binding of the action buttons is done as required in configureActionViews when the + // user expands the actions ViewStub. // Lookup contacts with this number NumberWithCountryIso numberCountryIso = new NumberWithCountryIso(number, countryIso); @@ -828,8 +794,6 @@ public class CallLogAdapter extends GroupingListAdapter mViewTreeObserver = callLogItemView.getViewTreeObserver(); mViewTreeObserver.addOnPreDrawListener(this); } - - bindBadge(callLogItemView, info, details, callType); } /** @@ -1073,54 +1037,6 @@ public class CallLogAdapter extends GroupingListAdapter mCallLogViewsHelper.setActionContentDescriptions(views); } - protected void bindBadge( - View view, final ContactInfo info, final PhoneCallDetails details, int callType) { - // Do not show badge in call log. - if (!mIsCallLog) { - final ViewStub stub = (ViewStub) view.findViewById(R.id.link_stub); - if (UriUtils.isEncodedContactUri(info.lookupUri)) { - if (stub != null) { - mBadgeContainer = stub.inflate(); - } else { - mBadgeContainer = view.findViewById(R.id.badge_container); - } - - 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) { - // If no lookup uri is provided, we need to rely on what information - // we have available; namely the phone number and name. - if (info.lookupUri == null) { - final Intent intent = - DialtactsActivity.getAddToContactIntent(details.name, - details.number, - details.numberType); - DialerUtils.startActivityWithErrorToast(mContext, intent, - R.string.add_contact_not_available); - } else { - addContactFromLookupUri(info.lookupUri); - } - } - }); - } - mBadgeImageView.setImageResource(R.drawable.ic_person_add_24dp); - mBadgeText.setText(R.string.recentCalls_addToContact); - } else { - // Hide badge if it was previously shown. - mBadgeContainer = view.findViewById(R.id.badge_container); - if (mBadgeContainer != null) { - mBadgeContainer.setVisibility(View.GONE); - } - } - } - } - /** Checks whether the contact info from the call log matches the one from the contacts db. */ private boolean callLogInfoMatches(ContactInfo callLogInfo, ContactInfo info) { // The call log only contains a subset of the fields in the contacts db. diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index 9c95d3ec8..34dd137fb 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -192,7 +192,7 @@ public class CallLogFragment extends ListFragment String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity()); mAdapter = ObjectFactory.newCallLogAdapter(getActivity(), this, - new ContactInfoHelper(getActivity(), currentCountryIso), this, this, true); + new ContactInfoHelper(getActivity(), currentCountryIso), this, this); setListAdapter(mAdapter); mCallLogQueryHandler = new CallLogQueryHandler(getActivity().getContentResolver(), this, mLogLimit); diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index 0410814b8..0e558bfa4 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -24,9 +24,7 @@ import com.android.contacts.common.list.ViewPagerTabs; import com.android.contacts.commonbind.analytics.AnalyticsUtil; import com.android.dialer.DialtactsActivity; import com.android.dialer.R; -import com.android.dialer.calllog.CallLogAdapter; import com.android.dialer.calllog.CallLogFragment; -import com.android.dialer.calllog.CallLogQuery; import com.android.dialer.calllog.CallLogQueryHandler; import com.android.dialer.calllog.ContactInfoHelper; import com.android.dialer.util.DialerUtils; @@ -43,8 +41,7 @@ import java.util.ArrayList; * ViewPager containing the lists up above the search bar and pin it against the top of the * screen. */ -public class ListsFragment extends Fragment implements CallLogQueryHandler.Listener, - CallLogAdapter.CallFetcher, ViewPager.OnPageChangeListener { +public class ListsFragment extends Fragment implements ViewPager.OnPageChangeListener { private static final boolean DEBUG = DialtactsActivity.DEBUG; private static final String TAG = "ListsFragment"; @@ -82,9 +79,6 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste private String[] mTabTitles; private int[] mTabIcons; - private CallLogAdapter mCallLogAdapter; - private CallLogQueryHandler mCallLogQueryHandler; - /** * Call shortcuts older than this date (persisted in shared preferences) will not show up in * at the top of the screen @@ -157,17 +151,10 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste Trace.beginSection(TAG + " onCreate"); super.onCreate(savedInstanceState); - mCallLogQueryHandler = new CallLogQueryHandler(getActivity().getContentResolver(), - this, 1); Trace.beginSection(TAG + " getCurrentCountryIso"); final String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity()); Trace.endSection(); - Trace.beginSection(TAG + " create adapters"); - mCallLogAdapter = ObjectFactory.newCallLogAdapter(getActivity(), this, - new ContactInfoHelper(getActivity(), currentCountryIso), null, null, false); - - Trace.endSection(); Trace.endSection(); } @@ -179,28 +166,12 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste DialtactsActivity.SHARED_PREFS_NAME, Context.MODE_PRIVATE); mLastCallShortcutDate = prefs.getLong(KEY_LAST_DISMISSED_CALL_SHORTCUT_DATE, 0); mActionBar = getActivity().getActionBar(); - fetchCalls(); - mCallLogAdapter.setLoading(true); if (getUserVisibleHint()) { sendScreenViewForPosition(mViewPager.getCurrentItem()); } Trace.endSection(); } - @Override - public void onPause() { - // Wipe the cache to refresh the call shortcut item. This is not that expensive because - // it only contains one item. - mCallLogAdapter.invalidateCache(); - super.onPause(); - } - - @Override - public void onDestroy() { - mCallLogAdapter.stopRequestProcessing(); - super.onDestroy(); - } - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -239,31 +210,6 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste return parentView; } - @Override - public void onVoicemailStatusFetched(Cursor statusCursor) { - // no-op - } - - @Override - public boolean onCallsFetched(Cursor cursor) { - mCallLogAdapter.setLoading(false); - - // Save the date of the most recent call log item - if (cursor != null && cursor.moveToFirst()) { - mCurrentCallShortcutDate = cursor.getLong(CallLogQuery.DATE); - } - - mCallLogAdapter.changeCursor(cursor); - - // Return true; took ownership of cursor - return true; - } - - @Override - public void fetchCalls() { - mCallLogQueryHandler.fetchCalls(CallLogQueryHandler.CALL_TYPE_ALL, mLastCallShortcutDate); - } - public void addOnPageChangeListener(OnPageChangeListener onPageChangeListener) { if (!mOnPageChangeListeners.contains(onPageChangeListener)) { mOnPageChangeListeners.add(onPageChangeListener); diff --git a/src/com/android/dialerbind/ObjectFactory.java b/src/com/android/dialerbind/ObjectFactory.java index 54a5821df..e5c39d078 100644 --- a/src/com/android/dialerbind/ObjectFactory.java +++ b/src/com/android/dialerbind/ObjectFactory.java @@ -48,9 +48,9 @@ public class ObjectFactory { public static CallLogAdapter newCallLogAdapter(Context context, CallFetcher callFetcher, ContactInfoHelper contactInfoHelper, CallItemExpandedListener callItemExpandedListener, - OnReportButtonClickListener onReportButtonClickListener, boolean isCallLog) { + OnReportButtonClickListener onReportButtonClickListener) { return new CallLogAdapter(context, callFetcher, contactInfoHelper, - callItemExpandedListener, onReportButtonClickListener, isCallLog); + callItemExpandedListener, onReportButtonClickListener); } public static DialogFragment getReportDialogFragment(String number) { diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index 9b3e6bcc4..0f175117d 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -213,7 +213,7 @@ public class CallLogAdapterTest extends AndroidTestCase { public TestCallLogAdapter(Context context, CallFetcher callFetcher, ContactInfoHelper contactInfoHelper) { - super(context, callFetcher, contactInfoHelper, null, null, false); + super(context, callFetcher, contactInfoHelper, null, null); } @Override -- cgit v1.2.3