Loading src/com/android/contacts/calllog/CallLogAdapter.java +22 −0 Original line number Diff line number Diff line Loading @@ -541,6 +541,8 @@ public final class CallLogAdapter extends GroupingListAdapter final String formattedNumber; final String countryIso = c.getString(CallLogQuery.COUNTRY_ISO); final ContactInfo cachedContactInfo = getContactInfoFromCallLog(c); views.primaryActionView.setTag( IntentProvider.getCallDetailIntentProvider( this, c.getPosition(), c.getLong(CallLogQuery.ID), count)); Loading Loading @@ -592,6 +594,10 @@ public final class CallLogAdapter extends GroupingListAdapter } } if (info == null || info == ContactInfo.EMPTY) { info = cachedContactInfo; } final long personId = info.personId; final String name = info.name; final int ntype = info.type; Loading Loading @@ -623,6 +629,22 @@ public final class CallLogAdapter extends GroupingListAdapter } } /** Returns the contact information as stored in the call log. */ private ContactInfo getContactInfoFromCallLog(Cursor c) { ContactInfo info = new ContactInfo(); info.personId = -1; info.name = c.getString(CallLogQuery.CACHED_NAME); info.type = c.getInt(CallLogQuery.CACHED_NUMBER_TYPE); info.label = c.getString(CallLogQuery.CACHED_NUMBER_LABEL); // TODO: This should be added to the call log cached values. info.number = c.getString(CallLogQuery.NUMBER); info.formattedNumber = info.number; info.normalizedNumber = info.number; info.thumbnailUri = null; info.lookupKey = null; return info; } /** * Returns the call types for the given number of items in the cursor. * <p> Loading src/com/android/contacts/calllog/CallLogQuery.java +7 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ public final class CallLogQuery { Calls.COUNTRY_ISO, Calls.VOICEMAIL_URI, Calls.GEOCODED_LOCATION, Calls.CACHED_NAME, Calls.CACHED_NUMBER_TYPE, Calls.CACHED_NUMBER_LABEL, }; public static final int ID = 0; Loading @@ -44,6 +47,9 @@ public final class CallLogQuery { public static final int COUNTRY_ISO = 5; public static final int VOICEMAIL_URI = 6; public static final int GEOCODED_LOCATION = 7; public static final int CACHED_NAME = 8; public static final int CACHED_NUMBER_TYPE = 9; public static final int CACHED_NUMBER_LABEL = 10; /** * The name of the synthetic "section" column. Loading @@ -53,7 +59,7 @@ public final class CallLogQuery { */ public static final String SECTION_NAME = "section"; /** The index of the "section" column in the projection. */ public static final int SECTION = 8; public static final int SECTION = 11; /** The value of the "section" column for the header of the new section. */ public static final int SECTION_NEW_HEADER = 0; /** The value of the "section" column for the items of the new section. */ Loading src/com/android/contacts/calllog/CallLogQueryHandler.java +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ import javax.annotation.concurrent.GuardedBy; new MatrixCursor(CallLogQuery.EXTENDED_PROJECTION); // The values in this row correspond to default values for _PROJECTION from CallLogQuery // plus the section value. matrixCursor.addRow(new Object[]{ -1L, "", 0L, 0L, 0, "", "", "", section }); matrixCursor.addRow(new Object[]{ -1L, "", 0L, 0L, 0, "", "", "", null, 0, null, section }); return matrixCursor; } Loading tests/src/com/android/contacts/activities/CallLogActivityTests.java +7 −12 Original line number Diff line number Diff line Loading @@ -62,17 +62,6 @@ import java.util.Random; @LargeTest public class CallLogActivityTests extends ActivityInstrumentationTestCase2<CallLogActivity> { private static final String[] EXTENDED_CALL_LOG_PROJECTION = new String[] { Calls._ID, Calls.NUMBER, Calls.DATE, Calls.DURATION, Calls.TYPE, Calls.COUNTRY_ISO, Calls.VOICEMAIL_URI, Calls.GEOCODED_LOCATION, CallLogQuery.SECTION_NAME, }; private static final int RAND_DURATION = -1; private static final long NOW = -1L; Loading Loading @@ -133,7 +122,7 @@ public class CallLogActivityTests mAdapter.disableRequestProcessingForTest(); mAdapter.stopRequestProcessing(); mParentView = new FrameLayout(mActivity); mCursor = new MatrixCursor(EXTENDED_CALL_LOG_PROJECTION); mCursor = new MatrixCursor(CallLogQuery.EXTENDED_PROJECTION); buildIconMap(); } Loading Loading @@ -508,6 +497,9 @@ public class CallLogActivityTests row.add(TEST_COUNTRY_ISO); // country ISO row.add(null); // voicemail_uri row.add(null); // geocoded_location row.add(null); // cached_name row.add(0); // cached_number_type row.add(null); // cached_number_label row.add(CallLogQuery.SECTION_OLD_ITEM); // section } Loading Loading @@ -539,6 +531,9 @@ public class CallLogActivityTests row.add(TEST_COUNTRY_ISO); // country ISO row.add(voicemailUri); // voicemail_uri row.add(null); // geocoded_location row.add(null); // cached_name row.add(0); // cached_number_type row.add(null); // cached_number_label row.add(CallLogQuery.SECTION_OLD_ITEM); // section } Loading tests/src/com/android/contacts/calllog/CallLogGroupBuilderTest.java +4 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.contacts.calllog; import static com.google.android.collect.Lists.newArrayList; import android.database.MatrixCursor; import android.provider.CallLog.Calls; import android.test.AndroidTestCase; Loading Loading @@ -223,7 +222,7 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { } mCursor.moveToNext(); mCursor.addRow(new Object[]{ mCursor.getPosition(), number, 0L, 0L, type, "", "", "", section mCursor.getPosition(), number, 0L, 0L, type, "", "", "", null, 0, null, section }); } Loading @@ -244,7 +243,9 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { throw new IllegalArgumentException("not a header section: " + section); } mCursor.moveToNext(); mCursor.addRow(new Object[]{ mCursor.getPosition(), "", 0L, 0L, 0, "", "", "", section }); mCursor.addRow(new Object[]{ mCursor.getPosition(), "", 0L, 0L, 0, "", "", "", null, 0, null, section }); } /** Asserts that the group matches the given values. */ Loading Loading
src/com/android/contacts/calllog/CallLogAdapter.java +22 −0 Original line number Diff line number Diff line Loading @@ -541,6 +541,8 @@ public final class CallLogAdapter extends GroupingListAdapter final String formattedNumber; final String countryIso = c.getString(CallLogQuery.COUNTRY_ISO); final ContactInfo cachedContactInfo = getContactInfoFromCallLog(c); views.primaryActionView.setTag( IntentProvider.getCallDetailIntentProvider( this, c.getPosition(), c.getLong(CallLogQuery.ID), count)); Loading Loading @@ -592,6 +594,10 @@ public final class CallLogAdapter extends GroupingListAdapter } } if (info == null || info == ContactInfo.EMPTY) { info = cachedContactInfo; } final long personId = info.personId; final String name = info.name; final int ntype = info.type; Loading Loading @@ -623,6 +629,22 @@ public final class CallLogAdapter extends GroupingListAdapter } } /** Returns the contact information as stored in the call log. */ private ContactInfo getContactInfoFromCallLog(Cursor c) { ContactInfo info = new ContactInfo(); info.personId = -1; info.name = c.getString(CallLogQuery.CACHED_NAME); info.type = c.getInt(CallLogQuery.CACHED_NUMBER_TYPE); info.label = c.getString(CallLogQuery.CACHED_NUMBER_LABEL); // TODO: This should be added to the call log cached values. info.number = c.getString(CallLogQuery.NUMBER); info.formattedNumber = info.number; info.normalizedNumber = info.number; info.thumbnailUri = null; info.lookupKey = null; return info; } /** * Returns the call types for the given number of items in the cursor. * <p> Loading
src/com/android/contacts/calllog/CallLogQuery.java +7 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ public final class CallLogQuery { Calls.COUNTRY_ISO, Calls.VOICEMAIL_URI, Calls.GEOCODED_LOCATION, Calls.CACHED_NAME, Calls.CACHED_NUMBER_TYPE, Calls.CACHED_NUMBER_LABEL, }; public static final int ID = 0; Loading @@ -44,6 +47,9 @@ public final class CallLogQuery { public static final int COUNTRY_ISO = 5; public static final int VOICEMAIL_URI = 6; public static final int GEOCODED_LOCATION = 7; public static final int CACHED_NAME = 8; public static final int CACHED_NUMBER_TYPE = 9; public static final int CACHED_NUMBER_LABEL = 10; /** * The name of the synthetic "section" column. Loading @@ -53,7 +59,7 @@ public final class CallLogQuery { */ public static final String SECTION_NAME = "section"; /** The index of the "section" column in the projection. */ public static final int SECTION = 8; public static final int SECTION = 11; /** The value of the "section" column for the header of the new section. */ public static final int SECTION_NEW_HEADER = 0; /** The value of the "section" column for the items of the new section. */ Loading
src/com/android/contacts/calllog/CallLogQueryHandler.java +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ import javax.annotation.concurrent.GuardedBy; new MatrixCursor(CallLogQuery.EXTENDED_PROJECTION); // The values in this row correspond to default values for _PROJECTION from CallLogQuery // plus the section value. matrixCursor.addRow(new Object[]{ -1L, "", 0L, 0L, 0, "", "", "", section }); matrixCursor.addRow(new Object[]{ -1L, "", 0L, 0L, 0, "", "", "", null, 0, null, section }); return matrixCursor; } Loading
tests/src/com/android/contacts/activities/CallLogActivityTests.java +7 −12 Original line number Diff line number Diff line Loading @@ -62,17 +62,6 @@ import java.util.Random; @LargeTest public class CallLogActivityTests extends ActivityInstrumentationTestCase2<CallLogActivity> { private static final String[] EXTENDED_CALL_LOG_PROJECTION = new String[] { Calls._ID, Calls.NUMBER, Calls.DATE, Calls.DURATION, Calls.TYPE, Calls.COUNTRY_ISO, Calls.VOICEMAIL_URI, Calls.GEOCODED_LOCATION, CallLogQuery.SECTION_NAME, }; private static final int RAND_DURATION = -1; private static final long NOW = -1L; Loading Loading @@ -133,7 +122,7 @@ public class CallLogActivityTests mAdapter.disableRequestProcessingForTest(); mAdapter.stopRequestProcessing(); mParentView = new FrameLayout(mActivity); mCursor = new MatrixCursor(EXTENDED_CALL_LOG_PROJECTION); mCursor = new MatrixCursor(CallLogQuery.EXTENDED_PROJECTION); buildIconMap(); } Loading Loading @@ -508,6 +497,9 @@ public class CallLogActivityTests row.add(TEST_COUNTRY_ISO); // country ISO row.add(null); // voicemail_uri row.add(null); // geocoded_location row.add(null); // cached_name row.add(0); // cached_number_type row.add(null); // cached_number_label row.add(CallLogQuery.SECTION_OLD_ITEM); // section } Loading Loading @@ -539,6 +531,9 @@ public class CallLogActivityTests row.add(TEST_COUNTRY_ISO); // country ISO row.add(voicemailUri); // voicemail_uri row.add(null); // geocoded_location row.add(null); // cached_name row.add(0); // cached_number_type row.add(null); // cached_number_label row.add(CallLogQuery.SECTION_OLD_ITEM); // section } Loading
tests/src/com/android/contacts/calllog/CallLogGroupBuilderTest.java +4 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.contacts.calllog; import static com.google.android.collect.Lists.newArrayList; import android.database.MatrixCursor; import android.provider.CallLog.Calls; import android.test.AndroidTestCase; Loading Loading @@ -223,7 +222,7 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { } mCursor.moveToNext(); mCursor.addRow(new Object[]{ mCursor.getPosition(), number, 0L, 0L, type, "", "", "", section mCursor.getPosition(), number, 0L, 0L, type, "", "", "", null, 0, null, section }); } Loading @@ -244,7 +243,9 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { throw new IllegalArgumentException("not a header section: " + section); } mCursor.moveToNext(); mCursor.addRow(new Object[]{ mCursor.getPosition(), "", 0L, 0L, 0, "", "", "", section }); mCursor.addRow(new Object[]{ mCursor.getPosition(), "", 0L, 0L, 0, "", "", "", null, 0, null, section }); } /** Asserts that the group matches the given values. */ Loading