Commit fb5c3cad authored by Tomasz Wiszkowski's avatar Tomasz Wiszkowski Committed by Commit Bot

Fix empty space appearing in place of Status icon on phones.

Bug: 918685, 918578
Change-Id: I96799594c1fae2f10c00b8d2d2f54bd09ed0d012
Reviewed-on: https://chromium-review.googlesource.com/c/1393888
Commit-Queue: Tomasz Wiszkowski <ender@google.com>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619652}
parent 87789925
......@@ -12,6 +12,8 @@
android:layout_width="@dimen/location_bar_icon_width"
android:layout_height="match_parent"
android:layout_gravity="center"
android:src="@android:color/transparent"
android:visibility="gone"
android:contentDescription="@string/accessibility_toolbar_btn_site_info"
android:scaleType="center" />
</merge>
......@@ -13,6 +13,8 @@
android:layout_height="match_parent"
android:layout_gravity="center"
android:paddingEnd="4dp"
android:src="@android:color/transparent"
android:visibility="gone"
android:contentDescription="@string/accessibility_toolbar_btn_site_info"
android:scaleType="center" />
</merge>
......@@ -61,24 +61,32 @@ public class StatusView extends LinearLayout {
* Start animating transition of status icon.
*/
private void animateStatusIcon() {
Drawable sourceIcon = mIconView.getDrawable();
Drawable targetIcon = null;
if (sourceIcon == null) {
sourceIcon = new ColorDrawable(Color.TRANSPARENT);
}
// Ensure no animations are pending.
mIconView.animate().cancel();
Drawable targetIcon = null;
if (mIconRes != 0 && mIconTintRes != 0) {
targetIcon =
TintedDrawable.constructTintedDrawable(getContext(), mIconRes, mIconTintRes);
mIconView.setVisibility(View.VISIBLE);
} else if (mIconRes != 0) {
targetIcon = ApiCompatibilityUtils.getDrawable(getContext().getResources(), mIconRes);
mIconView.setVisibility(View.VISIBLE);
} else {
targetIcon = new ColorDrawable(Color.TRANSPARENT);
mIconView.animate()
.setStartDelay(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS)
.withEndAction(new Runnable() {
@Override
public void run() {
mIconView.setVisibility(View.GONE);
}
});
}
TransitionDrawable newImage =
new TransitionDrawable(new Drawable[] {sourceIcon, targetIcon});
new TransitionDrawable(new Drawable[] {mIconView.getDrawable(), targetIcon});
mIconView.setImageDrawable(newImage);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment