summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-04-21 16:27:14 -0700
committerYorke Lee <yorkelee@google.com>2014-04-22 10:45:34 -0700
commit6a1461a86ad861b0e04333452e47cb81675459d5 (patch)
tree535f0be5497b33487354b95cf6c36bdd9c9da3a3 /src
parentcd1fa3922c10f1951f845386cc43dabf69e31ccc (diff)
Add view call history at bottom of recents
Bug: 13936108 Change-Id: Ic688d65240dada75b014b6684d4bebed208551bd
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/DialtactsActivity.java19
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java27
-rw-r--r--src/com/android/dialer/list/ListsFragment.java31
3 files changed, 65 insertions, 12 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 2d5df2b11..c449e09bf 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -94,6 +94,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
DialpadFragment.OnDialpadQueryChangedListener,
OnListFragmentScrolledListener,
DialpadFragment.HostInterface,
+ ListsFragment.HostInterface,
PhoneFavoriteFragment.HostInterface,
OnDragDropListener, View.OnLongClickListener,
OnPhoneNumberPickerActionListener {
@@ -427,10 +428,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
showDialpadFragment(true);
break;
case R.id.call_history_button:
- // Use explicit CallLogActivity intent instead of ACTION_VIEW +
- // CONTENT_TYPE, so that we always open our call log from our dialer
- final Intent intent = new Intent(this, CallLogActivity.class);
- startActivity(intent);
+ showCallHistory();
break;
case R.id.dial_button:
// Dial button was pressed; tell the Dialpad fragment
@@ -463,10 +461,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_history:
- // Use explicit CallLogActivity intent instead of ACTION_VIEW +
- // CONTENT_TYPE, so that we always open our call log from our dialer
- final Intent intent = new Intent(this, CallLogActivity.class);
- startActivity(intent);
+ showCallHistory();
break;
case R.id.menu_add_contact:
try {
@@ -912,6 +907,14 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
return resolveInfo != null && resolveInfo.size() > 0;
}
+ @Override
+ public void showCallHistory() {
+ // Use explicit CallLogActivity intent instead of ACTION_VIEW +
+ // CONTENT_TYPE, so that we always open our call log from our dialer
+ final Intent intent = new Intent(this, CallLogActivity.class);
+ startActivity(intent);
+ }
+
/**
* Called when the user has long-pressed a contact tile to start a drag operation.
*/
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 84d55d1d6..2ab613646 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -30,7 +30,6 @@ import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract;
import android.provider.VoicemailContract.Status;
-import android.telephony.TelephonyManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -75,6 +74,7 @@ public class CallLogFragment extends ListFragment
private TextView mStatusMessageText;
private TextView mStatusMessageAction;
private KeyguardManager mKeyguardManager;
+ private View mFooterView;
private boolean mEmptyLoaderRunning;
private boolean mCallLogFetched;
@@ -252,6 +252,7 @@ public class CallLogFragment extends ListFragment
mStatusMessageView = view.findViewById(R.id.voicemail_status);
mStatusMessageText = (TextView) view.findViewById(R.id.voicemail_status_message);
mStatusMessageAction = (TextView) view.findViewById(R.id.voicemail_status_action);
+
return view;
}
@@ -260,6 +261,7 @@ public class CallLogFragment extends ListFragment
super.onViewCreated(view, savedInstanceState);
updateEmptyMessage(mCallTypeFilter);
getListView().setItemsCanFocus(true);
+ assignFooterViewToListView();
}
/**
@@ -479,4 +481,27 @@ public class CallLogFragment extends ListFragment
CallLogNotificationsHelper.updateVoicemailNotifications(getActivity());
}
}
+
+ /**
+ * Assigns a view to be used as a footer view in the call log.
+ *
+ * @param view View to be used as the footer view.
+ */
+ public void setFooterView(View view) {
+ mFooterView = view;
+ // Content view not created yet, defer addition of the footerview to onCreate
+ if (getView() == null) {
+ return;
+ }
+ assignFooterViewToListView();
+ }
+
+ private void assignFooterViewToListView() {
+ if (mFooterView == null) {
+ return;
+ }
+ final ListView listView = getListView();
+ listView.removeFooterView(mFooterView);
+ listView.addFooterView(mFooterView);
+ }
}
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();