Merge "Use same margins as Google Now"
diff --git a/res/layout/quickcontact_header.xml b/res/layout/quickcontact_header.xml
index 0d06917..e3dfa02 100644
--- a/res/layout/quickcontact_header.xml
+++ b/res/layout/quickcontact_header.xml
@@ -18,7 +18,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/card_margin_color"
android:id="@+id/toolbar_parent">
<com.android.contacts.widget.QuickContactImageView
@@ -44,6 +43,9 @@
android:ellipsize="end"
android:layout_gravity="bottom"
android:textSize="@dimen/quickcontact_maximum_title_size"
+ android:layout_marginStart="@dimen/quickcontact_title_initial_margin"
+ android:layout_marginEnd="@dimen/quickcontact_title_initial_margin"
+ android:layout_marginBottom="@dimen/quickcontact_title_initial_margin"
android:id="@+id/large_title"/>
</FrameLayout>
\ No newline at end of file
diff --git a/res/values-fi/strings.xml b/res/values-fi/strings.xml
index 32b7183..c53f006 100644
--- a/res/values-fi/strings.xml
+++ b/res/values-fi/strings.xml
@@ -238,6 +238,5 @@
<string name="tomorrow_at_time_fmt" msgid="4856497969617819421">"Huomenna klo <xliff:g id="TIME_INTERVAL">%s</xliff:g>"</string>
<string name="date_time_fmt" msgid="5053178726906863812">"<xliff:g id="DATE">%s</xliff:g>, <xliff:g id="TIME_INTERVAL">%s</xliff:g>"</string>
<string name="untitled_event" msgid="3484859385405939366">"(Nimetön tapahtuma)"</string>
- <!-- no translation found for date_time_set (4761419824439606690) -->
- <skip />
+ <string name="date_time_set" msgid="4761419824439606690">"Käytä"</string>
</resources>
diff --git a/res/values-km-rKH/strings.xml b/res/values-km-rKH/strings.xml
index 4c0c9f5..63aaea0 100644
--- a/res/values-km-rKH/strings.xml
+++ b/res/values-km-rKH/strings.xml
@@ -39,13 +39,13 @@
<string name="menu_viewContact" msgid="2795575601596468581">"មើលទំនាក់ទំនង"</string>
<string name="menu_addStar" msgid="2908478235715404876">"បន្ថែមទៅសំណព្វ"</string>
<string name="menu_removeStar" msgid="5844227078364227030">"លុបចេញពីសំណព្វ"</string>
- <string name="menu_editContact" msgid="9042415603857662633">"កែសម្រួល"</string>
+ <string name="menu_editContact" msgid="9042415603857662633">"កែសម្រួល"</string>
<string name="menu_deleteContact" msgid="6788644058868189393">"លុប"</string>
<string name="menu_create_contact_shortcut" msgid="1217971915748509640">"ដាក់លើអេក្រង់ដើម"</string>
<string name="menu_call" msgid="3992595586042260618">"ហៅទំនាក់ទំនង"</string>
<string name="menu_sendSMS" msgid="5535886767547006515">"អត្ថបទទំនាក់ទំនង"</string>
<string name="menu_splitAggregate" msgid="8368636463748691868">"បំបែក"</string>
- <string name="menu_editGroup" msgid="5062005185370983720">"កែសម្រួល"</string>
+ <string name="menu_editGroup" msgid="5062005185370983720">"កែសម្រួល"</string>
<string name="menu_deleteGroup" msgid="3486380004411482874">"លុប"</string>
<string name="menu_new_contact_action_bar" msgid="7263362129442119188">"បន្ថែមទំនាក់ទំនង"</string>
<string name="menu_new_group_action_bar" msgid="3520232877587377175">"បន្ថែមក្រុម"</string>
@@ -115,7 +115,7 @@
<string name="search_settings_description" msgid="2675223022992445813">"ឈ្មោះនៃទំនាក់ទំនងរបស់អ្នក"</string>
<string name="quickcontact_missing_app" msgid="358168575340921552">"រកមិនឃើញកម្មវិធីសម្រាប់សកម្មភាពនេះទេ។"</string>
<string name="missing_app" msgid="1466111003546611387">"រកមិនឃើញកម្មវិធីដើម្បីគ្រប់គ្រងសកម្មភាពនេះទេ។"</string>
- <string name="menu_share" msgid="943789700636542260">"ចែករំលែក"</string>
+ <string name="menu_share" msgid="943789700636542260">"ចែករំលែក"</string>
<string name="share_via" msgid="563121028023030093">"ចែករំលែកទំនាក់ទំនងតាម"</string>
<string name="dialog_new_group_account" msgid="2318032089273496830">"បង្កើតក្រុមនៅក្នុងគណនី"</string>
<string name="audio_chat" msgid="2535716629358298691">"ជជែកជាសំឡេង"</string>
@@ -176,7 +176,7 @@
<string name="non_phone_caption" msgid="1541655052330027380">"លេខទូរស័ព្ទ"</string>
<string name="non_phone_add_to_contacts" msgid="6590985286250471169">"បន្ថែមទៅទំនាក់ទំនង"</string>
<string name="activity_title_confirm_add_detail" msgid="4065089866210730616">"បន្ថែមទៅទំនាក់ទំនង"</string>
- <string name="non_phone_close" msgid="7608506439725515667">"បិទ"</string>
+ <string name="non_phone_close" msgid="7608506439725515667">"បិទ"</string>
<string name="widget_name_and_phonetic" msgid="8739586586600099979">"<xliff:g id="DISPLAY_NAME">%1$s</xliff:g> (<xliff:g id="PHONETIC_NAME">%2$s</xliff:g>)"</string>
<string name="date_year_toggle" msgid="7356532842767854606">"ផ្ដល់ឆ្នាំ"</string>
<string name="social_widget_label" msgid="6378905543028924592">"ទំនាក់ទំនង"</string>
diff --git a/res/values-ms-rMY/strings.xml b/res/values-ms-rMY/strings.xml
index 2895da4..5ed7c2b 100644
--- a/res/values-ms-rMY/strings.xml
+++ b/res/values-ms-rMY/strings.xml
@@ -238,6 +238,5 @@
<string name="tomorrow_at_time_fmt" msgid="4856497969617819421">"Esok pada <xliff:g id="TIME_INTERVAL">%s</xliff:g>"</string>
<string name="date_time_fmt" msgid="5053178726906863812">"<xliff:g id="DATE">%s</xliff:g>, <xliff:g id="TIME_INTERVAL">%s</xliff:g>"</string>
<string name="untitled_event" msgid="3484859385405939366">"(Acara tidak bertajuk)"</string>
- <!-- no translation found for date_time_set (4761419824439606690) -->
- <skip />
+ <string name="date_time_set" msgid="4761419824439606690">"Tetapkan"</string>
</resources>
diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml
index 19c137f..dc6174a 100644
--- a/res/values-nb/strings.xml
+++ b/res/values-nb/strings.xml
@@ -238,5 +238,5 @@
<string name="tomorrow_at_time_fmt" msgid="4856497969617819421">"I morgen kl.<xliff:g id="TIME_INTERVAL">%s</xliff:g>"</string>
<string name="date_time_fmt" msgid="5053178726906863812">"<xliff:g id="DATE">%s</xliff:g>, <xliff:g id="TIME_INTERVAL">%s</xliff:g>"</string>
<string name="untitled_event" msgid="3484859385405939366">"(Aktivitet uten navn)"</string>
- <string name="date_time_set" msgid="4761419824439606690">"Angi"</string>
+ <string name="date_time_set" msgid="4761419824439606690">"Still inn"</string>
</resources>
diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml
index b588564..eaa7b9c 100644
--- a/res/values-ro/strings.xml
+++ b/res/values-ro/strings.xml
@@ -238,6 +238,5 @@
<string name="tomorrow_at_time_fmt" msgid="4856497969617819421">"Mâine, la <xliff:g id="TIME_INTERVAL">%s</xliff:g>"</string>
<string name="date_time_fmt" msgid="5053178726906863812">"<xliff:g id="DATE">%s</xliff:g>, <xliff:g id="TIME_INTERVAL">%s</xliff:g>"</string>
<string name="untitled_event" msgid="3484859385405939366">"(Eveniment fără titlu)"</string>
- <!-- no translation found for date_time_set (4761419824439606690) -->
- <skip />
+ <string name="date_time_set" msgid="4761419824439606690">"Setați"</string>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index ecab708..5a2f7ab 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -20,6 +20,8 @@
<dimen name="quickcontact_starting_empty_height">150dp</dimen>
<!-- Initial size of QuickContact's title size -->
<dimen name="quickcontact_maximum_title_size">36dp</dimen>
+ <!-- When QC is uncollapsed, the title has this much margin on its left, right and bottom -->
+ <dimen name="quickcontact_title_initial_margin">16dp</dimen>
<!-- Top padding of the entire contact editor -->
<dimen name="editor_padding_top">0dip</dimen>
diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java
index 3666420..12da3f6 100644
--- a/src/com/android/contacts/widget/MultiShrinkScroller.java
+++ b/src/com/android/contacts/widget/MultiShrinkScroller.java
@@ -85,6 +85,8 @@
private int mMinimumHeaderHeight;
private int mIntermediateHeaderHeight;
private int mMaximumHeaderTextSize;
+ private int mCollapsedTitleBottomMargin;
+ private int mCollapsedTitleStartMargin;
private final Scroller mScroller;
private final EdgeEffect mEdgeGlowBottom;
@@ -92,10 +94,9 @@
private final int mMaximumVelocity;
private final int mMinimumVelocity;
private final int mTransparentStartHeight;
+ private final int mMaximumTitleMargin;
private final float mToolbarElevation;
private final boolean mIsTwoPanel;
- final Rect mLargeTextViewRect = new Rect();
- final Rect mInvisiblePlaceholderTextViewRect = new Rect();
// Objects used to perform color filtering on the header. These are stored as fields for
// the sole purpose of avoiding "new" operations inside animation loops.
@@ -186,9 +187,11 @@
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mTransparentStartHeight = (int) getResources().getDimension(
R.dimen.quickcontact_starting_empty_height);
- mToolbarElevation = mContext.getResources().getDimension(
+ mToolbarElevation = getResources().getDimension(
R.dimen.quick_contact_toolbar_elevation);
- mIsTwoPanel = mContext.getResources().getBoolean(R.bool.quickcontact_two_panel);
+ mIsTwoPanel = getResources().getBoolean(R.bool.quickcontact_two_panel);
+ mMaximumTitleMargin = (int) getResources().getDimension(
+ R.dimen.quickcontact_title_initial_margin);
final TypedArray attributeArray = context.obtainStyledAttributes(
new int[]{android.R.attr.actionBarSize});
@@ -251,6 +254,7 @@
mPhotoViewContainer.setLayoutParams(layoutParams);
}
+ calculateCollapsedLargeTitlePadding();
updateHeaderTextSize();
}
});
@@ -712,7 +716,7 @@
// Keep the text at maximum size since the header is smaller than threshold.
mLargeTextView.setScaleX(1);
mLargeTextView.setScaleY(1);
- configureLargeTitlePadding();
+ setInterpolatedTitleMargin(1);
return;
}
final float ratio = (toolbarHeight - mMinimumHeaderHeight)
@@ -723,36 +727,46 @@
mLargeTextView.setScaleX(scale);
mLargeTextView.setScaleY(scale);
- configureLargeTitlePadding();
+ setInterpolatedTitleMargin(ratio);
}
/**
- * Configure the padding around mLargeTextView so that it will look appropriate once it
+ * Calculate the padding around mLargeTextView so that it will look appropriate once it
* finishes moving into its target location/size.
*/
- private void configureLargeTitlePadding() {
- mToolbar.getBoundsOnScreen(mLargeTextViewRect);
- mInvisiblePlaceholderTextView.getBoundsOnScreen(mInvisiblePlaceholderTextViewRect);
- final int neededPaddingStart;
+ private void calculateCollapsedLargeTitlePadding() {
+ final Rect largeTextViewRect = new Rect();
+ final Rect invisiblePlaceholderTextViewRect = new Rect();
+ mToolbar.getBoundsOnScreen(largeTextViewRect);
+ mInvisiblePlaceholderTextView.getBoundsOnScreen(invisiblePlaceholderTextViewRect);
if (isLayoutRtl()) {
- neededPaddingStart = mInvisiblePlaceholderTextViewRect.right - mLargeTextViewRect.right;
+ mCollapsedTitleStartMargin = invisiblePlaceholderTextViewRect.right
+ - largeTextViewRect.right;
} else {
- neededPaddingStart = mInvisiblePlaceholderTextViewRect.left - mLargeTextViewRect.left;
+ mCollapsedTitleStartMargin = invisiblePlaceholderTextViewRect.left
+ - largeTextViewRect.left;
}
// Distance between top of toolbar to the center of the target rectangle.
final int desiredTopToCenter = (
- mInvisiblePlaceholderTextViewRect.top + mInvisiblePlaceholderTextViewRect.bottom)
- / 2 - mLargeTextViewRect.top;
- // Additional padding needed on the mLargeTextView so that it has the same amount of
+ invisiblePlaceholderTextViewRect.top + invisiblePlaceholderTextViewRect.bottom)
+ / 2 - largeTextViewRect.top;
+ // Padding needed on the mLargeTextView so that it has the same amount of
// padding as the target rectangle.
- final int additionalBottomPaddingNeeded = desiredTopToCenter - mLargeTextView.getHeight()
- / 2;
+ mCollapsedTitleBottomMargin = desiredTopToCenter - mLargeTextView.getHeight() / 2;
+ }
+ /**
+ * Interpolate the title's margin size. When {@param x}=1, use the maximum title margins.
+ * When {@param x}=0, use the margin values taken from {@link #mInvisiblePlaceholderTextView}.
+ */
+ private void setInterpolatedTitleMargin(float x) {
final FrameLayout.LayoutParams layoutParams
= (FrameLayout.LayoutParams) mLargeTextView.getLayoutParams();
- layoutParams.bottomMargin = additionalBottomPaddingNeeded;
- layoutParams.setMarginStart(neededPaddingStart);
+ layoutParams.bottomMargin = (int) (mCollapsedTitleBottomMargin * (1 - x)
+ + mMaximumTitleMargin * x) ;
+ layoutParams.setMarginStart((int) (mCollapsedTitleStartMargin * (1 - x)
+ + mMaximumTitleMargin * x));
mLargeTextView.setLayoutParams(layoutParams);
}