am 4d539f2c: Merge "Fix important notice strip text layout"
* commit '4d539f2c1e6120651aafce5104e15f2b484af033': Fix important notice strip text layoutmain
commit
b247cafcc0
|
@ -52,9 +52,9 @@
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/important_notice_title"
|
android:id="@+id/important_notice_title"
|
||||||
android:layout_width="0dp"
|
android:text="@string/important_notice_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
style="?attr/suggestionWordStyle" />
|
style="?attr/suggestionWordStyle" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -502,11 +502,17 @@ final class SuggestionStripLayoutHelper {
|
||||||
titleView.setTextColor(mColorAutoCorrect);
|
titleView.setTextColor(mColorAutoCorrect);
|
||||||
TextViewCompatUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
TextViewCompatUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||||
titleView, infoIcon, null, moreIcon, null);
|
titleView, infoIcon, null, moreIcon, null);
|
||||||
final CharSequence importantNoticeTitle = res.getText(R.string.important_notice_title);
|
final CharSequence importantNoticeTitle = titleView.getText();
|
||||||
titleView.setTextScaleX(1.0f); // Reset textScaleX.
|
titleView.setTextScaleX(1.0f); // Reset textScaleX.
|
||||||
final float titleScaleX = getTextScaleX(importantNoticeTitle, width, titleView.getPaint());
|
// When the suggestions strip is displayed first time, stripWidth may be zero.
|
||||||
titleView.setText(importantNoticeTitle);
|
// Then importantNoticeTitle will be displayed as is without auto text scaleX.
|
||||||
titleView.setTextScaleX(titleScaleX);
|
// TODO: Fix the logic to always have a correct value of stripWidth.
|
||||||
|
if (width > 0) {
|
||||||
|
// Auto text scaleX to show entire important notice title should be on the strip.
|
||||||
|
final float titleScaleX = getTextScaleX(
|
||||||
|
importantNoticeTitle, width, titleView.getPaint());
|
||||||
|
titleView.setTextScaleX(titleScaleX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setLayoutWeight(final View v, final float weight, final int height) {
|
static void setLayoutWeight(final View v, final float weight, final int height) {
|
||||||
|
|
|
@ -220,6 +220,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This method should be called after this View has been attached and displayed.
|
||||||
public void showImportantNoticeTitle() {
|
public void showImportantNoticeTitle() {
|
||||||
mLayoutHelper.layoutImportantNotice(mImportantNoticeStrip, getWidth());
|
mLayoutHelper.layoutImportantNotice(mImportantNoticeStrip, getWidth());
|
||||||
mStripVisibilityGroup.showImportantNoticeStrip();
|
mStripVisibilityGroup.showImportantNoticeStrip();
|
||||||
|
|
Loading…
Reference in New Issue