summaryrefslogtreecommitdiff
path: root/src/com/android/dialer
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-08-13 21:53:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-08-13 21:53:34 +0000
commitc4079241a7ea29773cfec497281a114b7cbbbddd (patch)
tree45d806761e91adc4fdd067ed0c65a4c68a799ca7 /src/com/android/dialer
parented6a6e0dfae1adc99087361c0b6d6d27eff4eea1 (diff)
parenta4adb2c035690a1c9600a20c2485886d9d5991d0 (diff)
Merge "Show entire call history in Dialer tab."
Diffstat (limited to 'src/com/android/dialer')
-rw-r--r--src/com/android/dialer/calllog/CallLogActivity.java7
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java36
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java23
-rw-r--r--src/com/android/dialer/calllog/ShowCallHistoryViewHolder.java46
-rw-r--r--src/com/android/dialer/list/ListsFragment.java7
5 files changed, 30 insertions, 89 deletions
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();