Loading res/menu/call_log_options.xml +5 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,11 @@ android:title="@string/menu_show_voicemails_only" android:showAsAction="withText" /> <item android:id="@+id/show_all_calls" android:title="@string/menu_show_all_calls" android:showAsAction="withText" /> <item android:id="@+id/menu_call_settings_call_log" android:title="@string/call_settings" Loading res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1686,6 +1686,9 @@ <!-- Menu item used to show only voicemails in the call log. [CHAR LIMIT=30] --> <string name="menu_show_voicemails_only">Show voicemails only</string> <!-- Menu item used to show all calls in the call log. [CHAR LIMIT=30] --> <string name="menu_show_all_calls">Show all calls</string> <!-- Used to display as default status when the contact is available for chat [CHAR LIMIT=19] --> <string name="status_available">Available</string> Loading src/com/android/contacts/calllog/CallLogFragment.java +37 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.contacts.PhoneCallDetailsHelper; import com.android.contacts.R; import com.android.contacts.activities.DialtactsActivity; import com.android.contacts.activities.DialtactsActivity.ViewPagerVisibilityListener; import com.android.contacts.test.NeededForTesting; import com.android.contacts.util.ExpirableCache; import com.android.contacts.voicemail.VoicemailStatusHelper; import com.android.contacts.voicemail.VoicemailStatusHelper.StatusMessage; Loading Loading @@ -167,6 +168,8 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility private boolean mScrollToTop; private boolean mShowOptionsMenu; /** Whether we are currently filtering over voicemail. */ private boolean mShowingVoicemailOnly = false; private VoicemailStatusHelper mVoicemailStatusHelper; private View mStatusMessageView; Loading Loading @@ -228,6 +231,10 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility public void addGroup(int cursorPosition, int size, boolean expanded); } public interface CallFetcher { public void fetchAllCalls(); } /** Adapter class to fill in data for the Call Log */ public static final class CallLogAdapter extends GroupingListAdapter implements Runnable, ViewTreeObserver.OnPreDrawListener, GroupCreator { Loading @@ -236,7 +243,7 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility private final Context mContext; private final String mCurrentCountryIso; private final CallLogQueryHandler mCallLogQueryHandler; private final CallFetcher mCallFetcher; /** * A cache of the contact details for the phone numbers in the call log. Loading Loading @@ -320,13 +327,13 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility } }; public CallLogAdapter(Context context, CallLogQueryHandler callLogQueryHandler, public CallLogAdapter(Context context, CallFetcher callFetcher, String currentCountryIso, String voicemailNumber) { super(context); mContext = context; mCurrentCountryIso = currentCountryIso; mCallLogQueryHandler = callLogQueryHandler; mCallFetcher = callFetcher; mContactInfoCache = ExpirableCache.create(CONTACT_INFO_CACHE_SIZE); mRequests = new LinkedList<String>(); Loading @@ -350,9 +357,9 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility */ @Override protected void onContentChanged() { // Start async requery setLoading(true); mCallLogQueryHandler.fetchAllCalls(); // When the content changes, always fetch all the calls, in case a new missed call came // in and we were filtering over voicemail only, so that we see the missed call. mCallFetcher.fetchAllCalls(); } void setLoading(boolean loading) { Loading Loading @@ -921,8 +928,13 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); String currentCountryIso = ContactsUtils.getCurrentCountryIso(getActivity()); mAdapter = new CallLogAdapter(getActivity(), mCallLogQueryHandler, currentCountryIso, getVoiceMailNumber()); mAdapter = new CallLogAdapter(getActivity(), new CallFetcher() { @Override public void fetchAllCalls() { startCallsQuery(); } }, currentCountryIso, mVoiceMailNumber); setListAdapter(mAdapter); getListView().setItemsCanFocus(true); } Loading Loading @@ -995,6 +1007,10 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility private void startCallsQuery() { mAdapter.setLoading(true); mCallLogQueryHandler.fetchAllCalls(); if (mShowingVoicemailOnly) { mShowingVoicemailOnly = false; getActivity().invalidateOptionsMenu(); } } private void startVoicemailStatusQuery() { Loading @@ -1014,21 +1030,28 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility if (mShowOptionsMenu) { menu.findItem(R.id.menu_call_settings_call_log) .setIntent(DialtactsActivity.getCallSettingsIntent()); menu.findItem(R.id.show_voicemails_only).setVisible(!mShowingVoicemailOnly); menu.findItem(R.id.show_all_calls).setVisible(mShowingVoicemailOnly); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.delete_all: { case R.id.delete_all: ClearCallLogDialog.show(getFragmentManager()); return true; } case R.id.show_voicemails_only: { case R.id.show_voicemails_only: mCallLogQueryHandler.fetchVoicemailOnly(); mShowingVoicemailOnly = true; return true; } case R.id.show_all_calls: mCallLogQueryHandler.fetchAllCalls(); mShowingVoicemailOnly = false; return true; default: return false; } Loading Loading @@ -1114,12 +1137,12 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility } } @VisibleForTesting @NeededForTesting public CallLogAdapter getAdapter() { return mAdapter; } @VisibleForTesting @NeededForTesting public String getVoiceMailNumber() { return mVoiceMailNumber; } Loading Loading
res/menu/call_log_options.xml +5 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,11 @@ android:title="@string/menu_show_voicemails_only" android:showAsAction="withText" /> <item android:id="@+id/show_all_calls" android:title="@string/menu_show_all_calls" android:showAsAction="withText" /> <item android:id="@+id/menu_call_settings_call_log" android:title="@string/call_settings" Loading
res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1686,6 +1686,9 @@ <!-- Menu item used to show only voicemails in the call log. [CHAR LIMIT=30] --> <string name="menu_show_voicemails_only">Show voicemails only</string> <!-- Menu item used to show all calls in the call log. [CHAR LIMIT=30] --> <string name="menu_show_all_calls">Show all calls</string> <!-- Used to display as default status when the contact is available for chat [CHAR LIMIT=19] --> <string name="status_available">Available</string> Loading
src/com/android/contacts/calllog/CallLogFragment.java +37 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.contacts.PhoneCallDetailsHelper; import com.android.contacts.R; import com.android.contacts.activities.DialtactsActivity; import com.android.contacts.activities.DialtactsActivity.ViewPagerVisibilityListener; import com.android.contacts.test.NeededForTesting; import com.android.contacts.util.ExpirableCache; import com.android.contacts.voicemail.VoicemailStatusHelper; import com.android.contacts.voicemail.VoicemailStatusHelper.StatusMessage; Loading Loading @@ -167,6 +168,8 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility private boolean mScrollToTop; private boolean mShowOptionsMenu; /** Whether we are currently filtering over voicemail. */ private boolean mShowingVoicemailOnly = false; private VoicemailStatusHelper mVoicemailStatusHelper; private View mStatusMessageView; Loading Loading @@ -228,6 +231,10 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility public void addGroup(int cursorPosition, int size, boolean expanded); } public interface CallFetcher { public void fetchAllCalls(); } /** Adapter class to fill in data for the Call Log */ public static final class CallLogAdapter extends GroupingListAdapter implements Runnable, ViewTreeObserver.OnPreDrawListener, GroupCreator { Loading @@ -236,7 +243,7 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility private final Context mContext; private final String mCurrentCountryIso; private final CallLogQueryHandler mCallLogQueryHandler; private final CallFetcher mCallFetcher; /** * A cache of the contact details for the phone numbers in the call log. Loading Loading @@ -320,13 +327,13 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility } }; public CallLogAdapter(Context context, CallLogQueryHandler callLogQueryHandler, public CallLogAdapter(Context context, CallFetcher callFetcher, String currentCountryIso, String voicemailNumber) { super(context); mContext = context; mCurrentCountryIso = currentCountryIso; mCallLogQueryHandler = callLogQueryHandler; mCallFetcher = callFetcher; mContactInfoCache = ExpirableCache.create(CONTACT_INFO_CACHE_SIZE); mRequests = new LinkedList<String>(); Loading @@ -350,9 +357,9 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility */ @Override protected void onContentChanged() { // Start async requery setLoading(true); mCallLogQueryHandler.fetchAllCalls(); // When the content changes, always fetch all the calls, in case a new missed call came // in and we were filtering over voicemail only, so that we see the missed call. mCallFetcher.fetchAllCalls(); } void setLoading(boolean loading) { Loading Loading @@ -921,8 +928,13 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); String currentCountryIso = ContactsUtils.getCurrentCountryIso(getActivity()); mAdapter = new CallLogAdapter(getActivity(), mCallLogQueryHandler, currentCountryIso, getVoiceMailNumber()); mAdapter = new CallLogAdapter(getActivity(), new CallFetcher() { @Override public void fetchAllCalls() { startCallsQuery(); } }, currentCountryIso, mVoiceMailNumber); setListAdapter(mAdapter); getListView().setItemsCanFocus(true); } Loading Loading @@ -995,6 +1007,10 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility private void startCallsQuery() { mAdapter.setLoading(true); mCallLogQueryHandler.fetchAllCalls(); if (mShowingVoicemailOnly) { mShowingVoicemailOnly = false; getActivity().invalidateOptionsMenu(); } } private void startVoicemailStatusQuery() { Loading @@ -1014,21 +1030,28 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility if (mShowOptionsMenu) { menu.findItem(R.id.menu_call_settings_call_log) .setIntent(DialtactsActivity.getCallSettingsIntent()); menu.findItem(R.id.show_voicemails_only).setVisible(!mShowingVoicemailOnly); menu.findItem(R.id.show_all_calls).setVisible(mShowingVoicemailOnly); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.delete_all: { case R.id.delete_all: ClearCallLogDialog.show(getFragmentManager()); return true; } case R.id.show_voicemails_only: { case R.id.show_voicemails_only: mCallLogQueryHandler.fetchVoicemailOnly(); mShowingVoicemailOnly = true; return true; } case R.id.show_all_calls: mCallLogQueryHandler.fetchAllCalls(); mShowingVoicemailOnly = false; return true; default: return false; } Loading Loading @@ -1114,12 +1137,12 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility } } @VisibleForTesting @NeededForTesting public CallLogAdapter getAdapter() { return mAdapter; } @VisibleForTesting @NeededForTesting public String getVoiceMailNumber() { return mVoiceMailNumber; } Loading