summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-03-13 17:28:34 -0700
committerAndrew Lee <anwlee@google.com>2015-03-16 12:53:11 -0700
commit14cfa66d6df53303c280194d661c0b32838aa417 (patch)
tree25aed55d2b815760dfbd5e5e2ca015df8eddf70d
parent616b7f2c33a4294e100cc1851a012cd04ac3500d (diff)
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
-rw-r--r--res/layout/call_log_list_item.xml6
-rw-r--r--res/layout/call_log_list_item_extra.xml68
-rw-r--r--res/values/colors.xml1
-rw-r--r--res/values/dimens.xml3
-rw-r--r--res/values/strings.xml3
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java106
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java2
-rw-r--r--src/com/android/dialer/list/ListsFragment.java56
-rw-r--r--src/com/android/dialerbind/ObjectFactory.java4
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogAdapterTest.java2
10 files changed, 17 insertions, 234 deletions
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"/>
</LinearLayout>
- <!-- Displays the extra link section -->
- <ViewStub android:id="@+id/link_stub"
- android:layout="@layout/call_log_list_item_extra"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
+
</LinearLayout>
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 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- ~ Copyright (C) 2013 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-
-<!-- Can't use merge here because this is referenced via a ViewStub -->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/badge_container"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <View android:layout_width="match_parent"
- android:layout_height="1px"
- android:background="@color/favorite_contacts_separator_color" />
-
- <LinearLayout android:id="@+id/badge_link_container"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingStart="@dimen/call_log_outer_margin"
- android:paddingEnd="@dimen/call_log_outer_margin"
- android:paddingTop="@dimen/call_log_item_extra_padding_vertical"
- android:paddingBottom="@dimen/call_log_item_extra_padding_vertical"
- android:background="?android:attr/selectableItemBackground"
- android:clickable="true">
-
- <ImageView android:id="@+id/badge_image"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:tint="@color/call_log_extras_text_color"
- android:padding="@dimen/call_log_outer_margin" />
-
- <TextView android:id="@+id/badge_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingStart="@dimen/call_log_start_margin"
- android:textColor="@color/call_log_extras_text_color"
- android:layout_gravity="center_vertical"
- android:layout_weight="1" />
-
- <ImageView android:id="@+id/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="@dimen/icon_padding"
- android:layout_gravity="center_vertical"
- android:layout_marginEnd="@dimen/call_log_icon_margin"
- android:src="@drawable/ic_close_dk"
- android:tint="@color/recent_call_log_item_phone_icon_tint"
- android:alpha="0.3"
- android:background="?android:attr/selectableItemBackground"
- android:visibility="gone"
- android:contentDescription="@string/description_dismiss" />
-
- </LinearLayout>
-
-</FrameLayout> \ 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 @@
<!-- Tint of the recent card phone icon -->
<color name="recent_call_log_item_phone_icon_tint">#000000</color>
- <color name="call_log_extras_text_color">#0277bd</color>
<!--
Colour of voicemail progress bar to the right of position indicator.
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index e4097e3eb..9de20f310 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -64,9 +64,6 @@
<dimen name="favorites_row_end_padding">0dp</dimen>
<dimen name="favorites_row_undo_text_side_padding">32dp</dimen>
- <dimen name="call_log_item_extra_padding_vertical">4dp</dimen>
-
-
<!-- Size of the star icon on the favorites tile. -->
<dimen name="favorites_star_icon_size">12dp</dimen>
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 @@
-->
<string name="contact_tooltip">Touch image to see all numbers or touch &amp; hold to reorder</string>
- <!-- Content description for dismiss button on badge. [CHAR LIMIT=NONE] -->
- <string name="description_dismiss">Dismiss</string>
-
<!-- Remove button that shows up when contact is long-pressed. [CHAR LIMIT=NONE] -->
<string name="remove_contact">Remove</string>
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) {
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