diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 106 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogFragment.java | 2 | ||||
-rw-r--r-- | src/com/android/dialer/list/ListsFragment.java | 56 | ||||
-rw-r--r-- | src/com/android/dialerbind/ObjectFactory.java | 4 |
4 files changed, 15 insertions, 153 deletions
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,8 +166,6 @@ 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()); } @@ -188,20 +173,6 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste } @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) { Trace.beginSection(TAG + " onCreateView"); @@ -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) { |