Do not show black header if there is no action.
In the call details activity we show a black overlay on top of the
picture for adding a contact or accessing the contact. For some numbers,
no action is possible, e.g., SIP number without a contact, voicemail
number, private numbers.
In those cases, do not show the black header at all, since there is no
action this header would be describing.
This requires a bit of changes to the scrolling: if the header is not
present, we should scroll out the entire picture and the separator line
out of it.
Bug: 5400504
Change-Id: I2effa6664df6eec6051b5c685cea527f56e049f1
diff --git a/src/com/android/contacts/CallDetailActivity.java b/src/com/android/contacts/CallDetailActivity.java
index 8d7561a..a70119f 100644
--- a/src/com/android/contacts/CallDetailActivity.java
+++ b/src/com/android/contacts/CallDetailActivity.java
@@ -96,6 +96,7 @@
private PhoneNumberHelper mPhoneNumberHelper;
private PhoneCallDetailsHelper mPhoneCallDetailsHelper;
private TextView mHeaderTextView;
+ private View mHeaderOverlayView;
private ImageView mMainActionView;
private ImageButton mMainActionPushLayerView;
private ImageView mContactBackgroundView;
@@ -240,6 +241,7 @@
mVoicemailStatusHelper = new VoicemailStatusHelperImpl();
mAsyncQueryHandler = new CallDetailActivityQueryHandler(this);
mHeaderTextView = (TextView) findViewById(R.id.header_text);
+ mHeaderOverlayView = findViewById(R.id.photo_text_bar);
mStatusMessageView = findViewById(R.id.voicemail_status);
mStatusMessageText = (TextView) findViewById(R.id.voicemail_status_message);
mStatusMessageAction = (TextView) findViewById(R.id.voicemail_status_action);
@@ -454,6 +456,8 @@
if (mainActionIntent == null) {
mMainActionView.setVisibility(View.INVISIBLE);
mMainActionPushLayerView.setVisibility(View.GONE);
+ mHeaderTextView.setVisibility(View.INVISIBLE);
+ mHeaderOverlayView.setVisibility(View.INVISIBLE);
} else {
mMainActionView.setVisibility(View.VISIBLE);
mMainActionView.setImageResource(mainActionIcon);
@@ -465,6 +469,8 @@
}
});
mMainActionPushLayerView.setContentDescription(mainActionDescription);
+ mHeaderTextView.setVisibility(View.VISIBLE);
+ mHeaderOverlayView.setVisibility(View.VISIBLE);
}
// This action allows to call the number that places the call.
@@ -511,19 +517,27 @@
findViewById(R.id.controls)));
BackScrollManager.bind(
new ScrollableHeader() {
- private View controls = findViewById(R.id.controls);
- private View photo = findViewById(R.id.contact_background_sizer);
- private View nameHeader = findViewById(R.id.photo_text_bar);
+ private View mControls = findViewById(R.id.controls);
+ private View mPhoto = findViewById(R.id.contact_background_sizer);
+ private View mHeader = findViewById(R.id.photo_text_bar);
+ private View mSeparator = findViewById(R.id.blue_separator);
@Override
public void setOffset(int offset) {
- controls.setY(-offset);
+ mControls.setY(-offset);
}
@Override
public int getMaximumScrollableHeaderOffset() {
- // We can scroll the photo out, but we should keep the header.
- return photo.getHeight() - nameHeader.getHeight();
+ // We can scroll the photo out, but we should keep the header if
+ // present.
+ if (mHeader.getVisibility() == View.VISIBLE) {
+ return mPhoto.getHeight() - mHeader.getHeight();
+ } else {
+ // If the header is not present, we should also scroll out the
+ // separator line.
+ return mPhoto.getHeight() + mSeparator.getHeight();
+ }
}
},
historyList);