diff options
author | Andrew Lee <anwlee@google.com> | 2015-08-10 17:52:44 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-08-11 14:03:07 -0700 |
commit | a4adb2c035690a1c9600a20c2485886d9d5991d0 (patch) | |
tree | 15cbed485df037d5e6d47190a165c437e9e1f08b | |
parent | f5250369eb99d5f2b435be845b5bb19a531538bb (diff) |
Show entire call history in Dialer tab.
+ Rename some logic around identifying the scenario (tab vs activity)
for the call log.
+ Add padding at the bottom of the call log.
+ Make call log in tab show all history, not just recent history.
+ Rename promo card logic in CallLogAdapter, since it is VM specific.
- Remove extra view holder, and associated logic.
Bug: 23017190
Change-Id: I1f36f414647705a779ee14e8b43e88bf711bba56
-rw-r--r-- | res/layout/call_log_fragment.xml | 4 | ||||
-rw-r--r-- | res/layout/show_call_history_list_item.xml | 30 | ||||
-rw-r--r-- | res/values/strings.xml | 3 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogActivity.java | 7 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 36 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogFragment.java | 23 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/ShowCallHistoryViewHolder.java | 46 | ||||
-rw-r--r-- | src/com/android/dialer/list/ListsFragment.java | 7 | ||||
-rw-r--r-- | src/com/android/dialerbind/ObjectFactory.java | 4 |
9 files changed, 35 insertions, 125 deletions
diff --git a/res/layout/call_log_fragment.xml b/res/layout/call_log_fragment.xml index f69c5139f..aad7d8e77 100644 --- a/res/layout/call_log_fragment.xml +++ b/res/layout/call_log_fragment.xml @@ -24,8 +24,10 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background_dialer_call_log" + android:clipToPadding="false" android:paddingStart="@dimen/call_log_horizontal_margin" - android:paddingEnd="@dimen/call_log_horizontal_margin" /> + android:paddingEnd="@dimen/call_log_horizontal_margin" + android:paddingBottom="@dimen/floating_action_button_list_bottom_padding" /> <com.android.dialer.widget.EmptyContentView android:id="@+id/empty_list_view" diff --git a/res/layout/show_call_history_list_item.xml b/res/layout/show_call_history_list_item.xml deleted file mode 100644 index 1264894a9..000000000 --- a/res/layout/show_call_history_list_item.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2015 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. ---> - -<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/CallLogCardStyle" - android:layout_height="40dp" - android:clickable="true" - android:foreground="?android:attr/selectableItemBackground"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:text="@string/show_call_history" /> - -</android.support.v7.widget.CardView> - diff --git a/res/values/strings.xml b/res/values/strings.xml index 9dcf72bab..8eeb03c4a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -535,9 +535,6 @@ <!-- Shortcut item used to make a video call directly from search. [CHAR LIMIT=25] --> <string name="search_shortcut_make_video_call">Make video call</string> - <!-- Title for the call log list item that brings users to the full call history when clicked --> - <string name="show_call_history">View full call history</string> - <!-- Number of missed calls shown on call card [CHAR LIMIT=40] --> <string name="num_missed_calls"><xliff:g id="number">%s</xliff:g> new missed calls</string> diff --git a/src/com/android/dialer/calllog/CallLogActivity.java b/src/com/android/dialer/calllog/CallLogActivity.java index 1f6c49066..16f48adc3 100644 --- a/src/com/android/dialer/calllog/CallLogActivity.java +++ b/src/com/android/dialer/calllog/CallLogActivity.java @@ -39,8 +39,6 @@ import com.android.contacts.common.util.PermissionsUtil; import com.android.contacts.commonbind.analytics.AnalyticsUtil; import com.android.dialer.DialtactsActivity; import com.android.dialer.R; -import com.android.dialer.voicemail.VoicemailStatusHelper; -import com.android.dialer.voicemail.VoicemailStatusHelperImpl; public class CallLogActivity extends Activity implements ViewPager.OnPageChangeListener { private ViewPager mViewPager; @@ -67,9 +65,10 @@ public class CallLogActivity extends Activity implements ViewPager.OnPageChangeL public Fragment getItem(int position) { switch (position) { case TAB_INDEX_ALL: - return new CallLogFragment(CallLogQueryHandler.CALL_TYPE_ALL); + return new CallLogFragment( + CallLogQueryHandler.CALL_TYPE_ALL, true /* isCallLogActivity */); case TAB_INDEX_MISSED: - return new CallLogFragment(Calls.MISSED_TYPE); + return new CallLogFragment(Calls.MISSED_TYPE, true /* isCallLogActivity */); } throw new IllegalStateException("No fragment at position " + position); } diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 312cf7e45..0d6fcac88 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -76,14 +76,12 @@ public class CallLogAdapter extends GroupingListAdapter public void fetchCalls(); } - private static final int VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM = 10; private static final int NO_EXPANDED_LIST_ITEM = -1; private static final int VOICEMAIL_PROMO_CARD_POSITION = 0; /** * View type for voicemail promo card. Note: Numbering starts at 20 to avoid collision - * with {@link com.android.common.widget.GroupingListAdapter#ITEM_TYPE_IN_GROUP}, and - * {@link CallLogAdapter#VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM}. + * with {@link com.android.common.widget.GroupingListAdapter#ITEM_TYPE_IN_GROUP}. */ private static final int VIEW_TYPE_VOICEMAIL_PROMO_CARD = 20; @@ -96,12 +94,12 @@ public class CallLogAdapter extends GroupingListAdapter protected final Context mContext; private final ContactInfoHelper mContactInfoHelper; - private final VoicemailPlaybackPresenter mVoicemailPlaybackPresenter; + protected final VoicemailPlaybackPresenter mVoicemailPlaybackPresenter; private final CallFetcher mCallFetcher; protected ContactInfoCache mContactInfoCache; - private boolean mIsShowingRecentsTab; + private boolean mIsCallLogActivity; private static final String KEY_EXPANDED_POSITION = "expanded_position"; private static final String KEY_EXPANDED_ROW_ID = "expanded_row_id"; @@ -130,7 +128,7 @@ public class CallLogAdapter extends GroupingListAdapter private SharedPreferences mPrefs; - private boolean mShowPromoCard = false; + private boolean mShowVoicemailPromoCard = false; /** Instance of helper class for managing views. */ private final CallLogListItemHelper mCallLogListItemHelper; @@ -325,7 +323,7 @@ public class CallLogAdapter extends GroupingListAdapter CallFetcher callFetcher, ContactInfoHelper contactInfoHelper, VoicemailPlaybackPresenter voicemailPlaybackPresenter, - boolean isShowingRecentsTab) { + boolean isCallLogActivity) { super(context); mContext = context; @@ -335,7 +333,7 @@ public class CallLogAdapter extends GroupingListAdapter if (mVoicemailPlaybackPresenter != null) { mVoicemailPlaybackPresenter.setOnVoicemailDeletedListener(this); } - mIsShowingRecentsTab = isShowingRecentsTab; + mIsCallLogActivity = isCallLogActivity; mContactInfoCache = new ContactInfoCache( mContactInfoHelper, mOnContactInfoChangedListener); @@ -413,9 +411,7 @@ public class CallLogAdapter extends GroupingListAdapter @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - if (viewType == VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM) { - return ShowCallHistoryViewHolder.create(mContext, parent); - } else if (viewType == VIEW_TYPE_VOICEMAIL_PROMO_CARD) { + if (viewType == VIEW_TYPE_VOICEMAIL_PROMO_CARD) { return createVoicemailPromoCardViewHolder(parent); } return createCallLogEntryViewHolder(parent); @@ -459,8 +455,6 @@ public class CallLogAdapter extends GroupingListAdapter Trace.beginSection("onBindViewHolder: " + position); switch (getItemViewType(position)) { - case VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM: - break; case VIEW_TYPE_VOICEMAIL_PROMO_CARD: bindVoicemailPromoCardViewHolder(viewHolder); break; @@ -601,14 +595,12 @@ public class CallLogAdapter extends GroupingListAdapter @Override public int getItemCount() { - return super.getItemCount() + ((isShowingRecentsTab() || mShowPromoCard) ? 1 : 0); + return super.getItemCount() + (mShowVoicemailPromoCard ? 1 : 0); } @Override public int getItemViewType(int position) { - if (position == getItemCount() - 1 && isShowingRecentsTab()) { - return VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM; - } else if (position == VOICEMAIL_PROMO_CARD_POSITION && mShowPromoCard) { + if (position == VOICEMAIL_PROMO_CARD_POSITION && mShowVoicemailPromoCard) { return VIEW_TYPE_VOICEMAIL_PROMO_CARD; } return super.getItemViewType(position); @@ -623,11 +615,11 @@ public class CallLogAdapter extends GroupingListAdapter */ @Override public Object getItem(int position) { - return super.getItem(position - (mShowPromoCard ? 1 : 0)); + return super.getItem(position - (mShowVoicemailPromoCard ? 1 : 0)); } - protected boolean isShowingRecentsTab() { - return mIsShowingRecentsTab; + protected boolean isCallLogActivity() { + return mIsCallLogActivity; } @Override @@ -793,7 +785,7 @@ public class CallLogAdapter extends GroupingListAdapter private void maybeShowVoicemailPromoCard() { boolean showPromoCard = mPrefs.getBoolean(SHOW_VOICEMAIL_PROMO_CARD, SHOW_VOICEMAIL_PROMO_CARD_DEFAULT); - mShowPromoCard = (mVoicemailPlaybackPresenter != null) && showPromoCard; + mShowVoicemailPromoCard = (mVoicemailPlaybackPresenter != null) && showPromoCard; } /** @@ -801,7 +793,7 @@ public class CallLogAdapter extends GroupingListAdapter */ private void dismissVoicemailPromoCard() { mPrefs.edit().putBoolean(SHOW_VOICEMAIL_PROMO_CARD, false).apply(); - mShowPromoCard = false; + mShowVoicemailPromoCard = false; notifyItemRemoved(VOICEMAIL_PROMO_CARD_POSITION); } diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index e7b77646d..cf354e596 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -141,10 +141,9 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis private long mDateLimit = NO_DATE_LIMIT; /* - * True if this instance of the CallLogFragment is the Recents screen shown in - * DialtactsActivity. + * True if this instance of the CallLogFragment shown in the CallLogActivity. */ - private boolean mIsRecentsFragment; + private boolean mIsCallLogActivity = false; public interface HostInterface { public void showDialpad(); @@ -158,6 +157,11 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis this(filterType, NO_LOG_LIMIT); } + public CallLogFragment(int filterType, boolean isCallLogActivity) { + this(filterType, NO_LOG_LIMIT); + mIsCallLogActivity = isCallLogActivity; + } + public CallLogFragment(int filterType, int logLimit) { this(filterType, logLimit, NO_DATE_LIMIT); } @@ -194,8 +198,6 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis mDateLimit = state.getLong(KEY_DATE_LIMIT, mDateLimit); } - mIsRecentsFragment = mLogLimit != NO_LOG_LIMIT; - final Activity activity = getActivity(); final ContentResolver resolver = activity.getContentResolver(); String currentCountryIso = GeoUtil.getCurrentCountryIso(activity); @@ -294,13 +296,12 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis mEmptyListView.setActionClickedListener(this); String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity()); - boolean isShowingRecentsTab = mLogLimit != NO_LOG_LIMIT || mDateLimit != NO_DATE_LIMIT; mAdapter = ObjectFactory.newCallLogAdapter( getActivity(), this, new ContactInfoHelper(getActivity(), currentCountryIso), mVoicemailPlaybackPresenter, - isShowingRecentsTab); + mIsCallLogActivity); mRecyclerView.setAdapter(mAdapter); fetchCalls(); @@ -419,10 +420,10 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis + filterType); } mEmptyListView.setDescription(messageId); - if (mIsRecentsFragment) { - mEmptyListView.setActionLabel(R.string.recentCalls_empty_action); - } else { + if (mIsCallLogActivity) { mEmptyListView.setActionLabel(EmptyContentView.NO_LABEL); + } else { + mEmptyListView.setActionLabel(R.string.recentCalls_empty_action); } } @@ -495,7 +496,7 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis if (!PermissionsUtil.hasPermission(activity, READ_CALL_LOG)) { requestPermissions(new String[] {READ_CALL_LOG}, READ_CALL_LOG_PERMISSION_REQUEST_CODE); - } else if (mIsRecentsFragment) { + } else if (!mIsCallLogActivity) { // Show dialpad if we are the recents fragment. ((HostInterface) activity).showDialpad(); } diff --git a/src/com/android/dialer/calllog/ShowCallHistoryViewHolder.java b/src/com/android/dialer/calllog/ShowCallHistoryViewHolder.java deleted file mode 100644 index af36a4d33..000000000 --- a/src/com/android/dialer/calllog/ShowCallHistoryViewHolder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2015 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. - */ - -package com.android.dialer.calllog; - -import android.content.Context; -import android.content.Intent; -import android.support.v7.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.android.dialer.R; - -public final class ShowCallHistoryViewHolder extends RecyclerView.ViewHolder { - - private ShowCallHistoryViewHolder(final Context context, View view) { - super(view); - view.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - final Intent intent = new Intent(context, CallLogActivity.class); - context.startActivity(intent); - } - }); - } - - public static ShowCallHistoryViewHolder create(Context context, ViewGroup parent) { - LayoutInflater inflater = LayoutInflater.from(context); - View view = inflater.inflate(R.layout.show_call_history_list_item, parent, false); - return new ShowCallHistoryViewHolder(context, view); - } -} diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index 33c977670..1eeba58f7 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -59,10 +59,6 @@ public class ListsFragment extends Fragment public static final int TAB_COUNT_DEFAULT = 3; public static final int TAB_COUNT_WITH_VOICEMAIL = 4; - private static final int MAX_RECENTS_ENTRIES = 20; - // Oldest recents entry to display is 2 weeks old. - private static final long OLDEST_RECENTS_DATE = 1000L * 60 * 60 * 24 * 14; - private static final String PREF_KEY_HAS_ACTIVE_VOICEMAIL_PROVIDER = "has_active_voicemail_provider"; @@ -116,8 +112,7 @@ public class ListsFragment extends Fragment mSpeedDialFragment = new SpeedDialFragment(); return mSpeedDialFragment; case TAB_INDEX_RECENTS: - mRecentsFragment = new CallLogFragment(CallLogQueryHandler.CALL_TYPE_ALL, - MAX_RECENTS_ENTRIES, System.currentTimeMillis() - OLDEST_RECENTS_DATE); + mRecentsFragment = new CallLogFragment(CallLogQueryHandler.CALL_TYPE_ALL); return mRecentsFragment; case TAB_INDEX_ALL_CONTACTS: mAllContactsFragment = new AllContactsFragment(); diff --git a/src/com/android/dialerbind/ObjectFactory.java b/src/com/android/dialerbind/ObjectFactory.java index 1a36b05d6..73c1c6fb3 100644 --- a/src/com/android/dialerbind/ObjectFactory.java +++ b/src/com/android/dialerbind/ObjectFactory.java @@ -47,12 +47,12 @@ public class ObjectFactory { CallFetcher callFetcher, ContactInfoHelper contactInfoHelper, VoicemailPlaybackPresenter voicemailPlaybackPresenter, - boolean isShowingRecentsTab) { + boolean isCallLogActivity) { return new CallLogAdapter( context, callFetcher, contactInfoHelper, voicemailPlaybackPresenter, - isShowingRecentsTab); + isCallLogActivity); } } |