diff options
author | Yorke Lee <yorkelee@google.com> | 2014-04-21 16:27:14 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-04-22 10:45:34 -0700 |
commit | 6a1461a86ad861b0e04333452e47cb81675459d5 (patch) | |
tree | 535f0be5497b33487354b95cf6c36bdd9c9da3a3 /src/com/android/dialer/list | |
parent | cd1fa3922c10f1951f845386cc43dabf69e31ccc (diff) |
Add view call history at bottom of recents
Bug: 13936108
Change-Id: Ic688d65240dada75b014b6684d4bebed208551bd
Diffstat (limited to 'src/com/android/dialer/list')
-rw-r--r-- | src/com/android/dialer/list/ListsFragment.java | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index 3144b8698..b91f09a2e 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -22,6 +22,8 @@ import android.widget.ListView; import com.android.contacts.common.GeoUtil; import com.android.dialer.DialtactsActivity; +import android.view.View.OnClickListener; + import com.android.dialer.R; import com.android.dialer.calllog.CallLogAdapter; import com.android.dialer.calllog.CallLogFragment; @@ -47,8 +49,9 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste private static final int TAB_INDEX_COUNT = 3; - // TODO: Replace with a date limit (e.g. 2 weeks) - private static final int MAX_ENTRIES = 20; + 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 KEY_LAST_DISMISSED_CALL_SHORTCUT_DATE = "key_last_dismissed_call_shortcut_date"; @@ -56,6 +59,10 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste // Used with LoaderManager private static int MISSED_CALL_LOADER = 1; + public interface HostInterface { + public void showCallHistory(); + } + private ViewPager mViewPager; private ViewPagerAdapter mViewPagerAdapter; private PhoneFavoriteFragment mSpeedDialFragment; @@ -113,7 +120,25 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste return mSpeedDialFragment; case TAB_INDEX_RECENTS: mRecentsFragment = new CallLogFragment(CallLogQueryHandler.CALL_TYPE_ALL, - MAX_ENTRIES); + MAX_RECENTS_ENTRIES, System.currentTimeMillis() - OLDEST_RECENTS_DATE); + + /* + * Provide mViewPager as a parent viewgroup for the inflation of the footer, + * to ensure that the footer view is inflated with the correct LayoutParams. + * If root is null in + * inflate(XmlPullParser parser, ViewGroup root, boolean attachToRoot), + * the layout parameters specified in R.layout.recents_list_footer are not + * correctly applied. The footer view is ultimately not attached to mViewPager. + */ + final View viewFullHistoryFooter = getActivity().getLayoutInflater().inflate( + R.layout.recents_list_footer, mViewPager, false); + viewFullHistoryFooter.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + ((HostInterface) getActivity()).showCallHistory(); + } + }); + mRecentsFragment.setFooterView(viewFullHistoryFooter); return mRecentsFragment; case TAB_INDEX_ALL_CONTACTS: mAllContactsFragment = new AllContactsFragment(); |