diff options
author | Nancy Chen <nancychen@google.com> | 2014-07-28 17:25:14 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-07-28 17:25:14 +0000 |
commit | c035d8455cd2c304b9d9d4b1766992040128a6e7 (patch) | |
tree | 1996a01bef90e78289b426ea2ddcb6d83254cd03 | |
parent | 70257a575ee3fdc5007ab8ec0bcb0d5907280bd1 (diff) | |
parent | d8e5542a7ddba2e107b7f56b9761db1db942c722 (diff) |
am d8e5542a: Merge "Add account label to call details if appropriate" into lmp-dev
* commit 'd8e5542a7ddba2e107b7f56b9761db1db942c722':
Add account label to call details if appropriate
-rw-r--r-- | res/layout/call_detail.xml | 15 | ||||
-rw-r--r-- | res/layout/call_detail_history_header.xml | 1 | ||||
-rw-r--r-- | res/values/dimens.xml | 5 | ||||
-rw-r--r-- | src/com/android/dialer/CallDetailActivity.java | 13 | ||||
-rw-r--r-- | src/com/android/dialer/PhoneCallDetails.java | 21 | ||||
-rw-r--r-- | src/com/android/dialer/PhoneCallDetailsHelper.java | 2 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 4 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/PhoneAccountUtils.java | 5 | ||||
-rw-r--r-- | tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java | 10 |
9 files changed, 52 insertions, 24 deletions
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml index f08531b0c..45431a215 100644 --- a/res/layout/call_detail.xml +++ b/res/layout/call_detail.xml @@ -35,7 +35,6 @@ android:paddingBottom="@dimen/call_detail_bottom_margin" android:baselineAligned="false" android:orientation="horizontal" - android:gravity="center_vertical" android:translationZ="@dimen/call_detail_translation_z" android:focusable="true" android:background="@color/background_dialer_white" > @@ -45,6 +44,8 @@ android:layout_width="@dimen/contact_photo_size" android:layout_height="@dimen/contact_photo_size" android:layout_alignParentStart="true" + android:layout_gravity="top" + android:layout_marginTop="3dp" android:focusable="true" /> @@ -61,6 +62,8 @@ android:layout_height="wrap_content" android:textColor="?attr/call_log_primary_text_color" android:textSize="@dimen/call_log_primary_text_size" + android:includeFontPadding="false" + android:layout_marginBottom="5dp" android:singleLine="true" /> <TextView @@ -69,8 +72,18 @@ android:layout_height="wrap_content" android:textColor="?attr/call_log_secondary_text_color" android:textSize="@dimen/call_log_secondary_text_size" + android:layout_marginBottom="1dp" android:singleLine="true" /> + <TextView + android:id="@+id/phone_account_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="?attr/call_log_secondary_text_color" + android:textSize="@dimen/call_log_secondary_text_size" + android:singleLine="true" + android:visibility="gone" + /> </LinearLayout> </LinearLayout> diff --git a/res/layout/call_detail_history_header.xml b/res/layout/call_detail_history_header.xml index b4b63fb35..04d406fcf 100644 --- a/res/layout/call_detail_history_header.xml +++ b/res/layout/call_detail_history_header.xml @@ -20,6 +20,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingTop="@dimen/call_detail_header_top_margin" + android:paddingBottom="@dimen/call_detail_header_bottom_margin" android:paddingStart="@dimen/call_detail_horizontal_margin" android:textColor="?attr/call_log_secondary_text_color" android:textSize="@dimen/call_log_secondary_text_size" diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 176680ee6..267f0dfd4 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -25,7 +25,7 @@ <dimen name="call_log_call_action_size">32dip</dimen> <dimen name="call_log_call_action_width">54dp</dimen> <dimen name="call_log_icon_margin">4dip</dimen> - <dimen name="call_log_inner_margin">8dip</dimen> + <dimen name="call_log_inner_margin">13dip</dimen> <dimen name="call_log_outer_margin">8dp</dimen> <dimen name="call_log_start_margin">16dp</dimen> <dimen name="call_log_indent_margin">24dip</dimen> @@ -38,7 +38,8 @@ <dimen name="call_detail_horizontal_margin">16dp</dimen> <dimen name="call_detail_top_margin">36dp</dimen> <dimen name="call_detail_bottom_margin">32dp</dimen> - <dimen name="call_detail_header_top_margin">24dp</dimen> + <dimen name="call_detail_header_top_margin">20dp</dimen> + <dimen name="call_detail_header_bottom_margin">9dp</dimen> <dimen name="call_detail_translation_z">0.5dp</dimen> <dimen name="transcription_top_margin">18dp</dimen> <dimen name="transcription_bottom_margin">18dp</dimen> diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index cd5fb3bc7..e44ff83bc 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -115,6 +115,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware private QuickContactBadge mQuickContactBadge; private TextView mCallerName; private TextView mCallerNumber; + private TextView mAccountLabel; private AsyncTaskExecutor mAsyncTaskExecutor; private ContactInfoHelper mContactInfoHelper; @@ -246,6 +247,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware mQuickContactBadge.setOverlay(null); mCallerName = (TextView) findViewById(R.id.caller_name); mCallerNumber = (TextView) findViewById(R.id.caller_number); + mAccountLabel = (TextView) findViewById(R.id.phone_account_label); mDefaultCountryIso = GeoUtil.getCurrentCountryIso(this); mContactPhotoManager = ContactPhotoManager.getInstance(this); mProximitySensorManager = new ProximitySensorManager(this, mProximitySensorListener); @@ -438,6 +440,13 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware } + if (!TextUtils.isEmpty(firstDetails.accountLabel)) { + mAccountLabel.setText(firstDetails.accountLabel); + mAccountLabel.setVisibility(View.VISIBLE); + } else { + mAccountLabel.setVisibility(View.GONE); + } + mHasEditNumberBeforeCallOption = canPlaceCallsTo && !isSipNumber && !isVoicemailNumber; mHasTrashOption = hasVoicemail(); @@ -520,7 +529,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware final String geocode = callCursor.getString(GEOCODED_LOCATION_COLUMN_INDEX); final String transcription = callCursor.getString(TRANSCRIPTION_COLUMN_INDEX); - final Drawable accountIcon = PhoneAccountUtils.getAccountIcon(this, + final String accountLabel = PhoneAccountUtils.getAccountLabel(this, PhoneAccountUtils.getAccount( callCursor.getString(ACCOUNT_COMPONENT_NAME), callCursor.getString(ACCOUNT_ID))); @@ -571,7 +580,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware formattedNumber, countryIso, geocode, new int[]{ callType }, date, duration, nameText, numberType, numberLabel, lookupUri, photoUri, sourceType, - accountIcon, features, dataUsage, transcription); + accountLabel, null, features, dataUsage, transcription); } finally { if (callCursor != null) { callCursor.close(); diff --git a/src/com/android/dialer/PhoneCallDetails.java b/src/com/android/dialer/PhoneCallDetails.java index 869203638..f6f9edace 100644 --- a/src/com/android/dialer/PhoneCallDetails.java +++ b/src/com/android/dialer/PhoneCallDetails.java @@ -67,7 +67,11 @@ public class PhoneCallDetails { */ public final int sourceType; /** - * The unique identifier for the provider associated with the call. + * The unique identifier for the account associated with the call. + */ + public final String accountLabel; + /** + * The icon for the account associated with the call. */ public final Drawable accountIcon; /** @@ -92,18 +96,18 @@ public class PhoneCallDetails { CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration) { this (number, numberPresentation, formattedNumber, countryIso, geocode, - callTypes, date, duration, "", 0, "", null, null, 0, null, Calls.FEATURES_NONE, + callTypes, date, duration, "", 0, "", null, null, 0, null, null, Calls.FEATURES_NONE, null, null); } /** Create the details for a call with a number not associated with a contact. */ public PhoneCallDetails(CharSequence number, int numberPresentation, CharSequence formattedNumber, String countryIso, String geocode, - int[] callTypes, long date, long duration, Drawable accountIcon, int features, - Long dataUsage, String transcription) { + int[] callTypes, long date, long duration, String accountLabel, Drawable accountIcon, + int features, Long dataUsage, String transcription) { this(number, numberPresentation, formattedNumber, countryIso, geocode, - callTypes, date, duration, "", 0, "", null, null, 0, accountIcon, features, - dataUsage, transcription); + callTypes, date, duration, "", 0, "", null, null, 0, accountLabel, accountIcon, + features, dataUsage, transcription); } /** Create the details for a call with a number associated with a contact. */ @@ -111,8 +115,8 @@ public class PhoneCallDetails { CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration, CharSequence name, int numberType, CharSequence numberLabel, Uri contactUri, - Uri photoUri, int sourceType, Drawable accountIcon, int features, Long dataUsage, - String transcription) { + Uri photoUri, int sourceType, String accountLabel, Drawable accountIcon, int features, + Long dataUsage, String transcription) { this.number = number; this.numberPresentation = numberPresentation; this.formattedNumber = formattedNumber; @@ -127,6 +131,7 @@ public class PhoneCallDetails { this.contactUri = contactUri; this.photoUri = photoUri; this.sourceType = sourceType; + this.accountLabel = accountLabel; this.accountIcon = accountIcon; this.features = features; this.dataUsage = dataUsage; diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java index 3846b6fb8..a432dafa2 100644 --- a/src/com/android/dialer/PhoneCallDetailsHelper.java +++ b/src/com/android/dialer/PhoneCallDetailsHelper.java @@ -48,7 +48,6 @@ public class PhoneCallDetailsHelper { /** The injected current time in milliseconds since the epoch. Used only by tests. */ private Long mCurrentTimeMillisForTest; // Helper classes. - private final CallTypeHelper mCallTypeHelper; private final PhoneNumberDisplayHelper mPhoneNumberHelper; private final PhoneNumberUtilsWrapper mPhoneNumberUtilsWrapper; @@ -67,7 +66,6 @@ public class PhoneCallDetailsHelper { public PhoneCallDetailsHelper(Resources resources, CallTypeHelper callTypeHelper, PhoneNumberUtilsWrapper phoneUtils) { mResources = resources; - mCallTypeHelper = callTypeHelper; mPhoneNumberUtilsWrapper = phoneUtils; mPhoneNumberHelper = new PhoneNumberDisplayHelper(mPhoneNumberUtilsWrapper, resources); } diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 630cf3f33..a8c20feb0 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -774,12 +774,12 @@ public class CallLogAdapter extends GroupingListAdapter if (TextUtils.isEmpty(name)) { details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, - duration, accountIcon, features, dataUsage, transcription); + duration, null, accountIcon, features, dataUsage, transcription); } else { details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, duration, name, ntype, label, lookupUri, photoUri, sourceType, - accountIcon, features, dataUsage, transcription); + null, accountIcon, features, dataUsage, transcription); } mCallLogViewsHelper.setPhoneCallDetails(views, details); diff --git a/src/com/android/dialer/calllog/PhoneAccountUtils.java b/src/com/android/dialer/calllog/PhoneAccountUtils.java index 326ffa69d..dc838fb1a 100644 --- a/src/com/android/dialer/calllog/PhoneAccountUtils.java +++ b/src/com/android/dialer/calllog/PhoneAccountUtils.java @@ -54,12 +54,12 @@ public class PhoneAccountUtils { /** * Generate account label from data in Telecomm database */ - public static CharSequence getAccountLabel(Context context, PhoneAccountHandle phoneAccount) { + public static String getAccountLabel(Context context, PhoneAccountHandle phoneAccount) { final PhoneAccount account = getAccountOrNull(context, phoneAccount); if (account == null) { return null; } - return account.getLabel(); + return account.getLabel().toString(); } /** @@ -75,4 +75,5 @@ public class PhoneAccountUtils { } return account; } + } diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java index 569da5414..0190e4926 100644 --- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java +++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java @@ -311,7 +311,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { mHelper.setPhoneCallDetails(mViews, new PhoneCallDetails(number, presentation, formattedNumber, TEST_COUNTRY_ISO, TEST_GEOCODE, - new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null, + new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null, null, Calls.FEATURES_NONE, null, null) ); } @@ -322,7 +322,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { mHelper.setPhoneCallDetails(mViews, new PhoneCallDetails(number, Calls.PRESENTATION_ALLOWED, formattedNumber, TEST_COUNTRY_ISO, geocodedLocation, - new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null, + new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null, null, Calls.FEATURES_NONE, null, null) ); } @@ -352,7 +352,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { mHelper.setPhoneCallDetails(mViews, new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, - new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null, + new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null, null, features, null, null) ); } @@ -361,7 +361,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { mHelper.setCallDetailsHeader(mNameView, new PhoneCallDetails(number, presentation, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, - new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null, + new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null, null, Calls.FEATURES_NONE, null, null)); } @@ -370,6 +370,6 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, - name, 0, "", null, null, 0, null, Calls.FEATURES_NONE, null, null)); + name, 0, "", null, null, 0, null, null, Calls.FEATURES_NONE, null, null)); } } |