Merge "Shrink the ticker's icon to match the status bar." into ics-mr0

This commit is contained in:
Daniel Sandler
2011-10-14 10:16:14 -07:00
committed by Android (Google) Code Review
2 changed files with 18 additions and 7 deletions

View File

@@ -89,17 +89,19 @@
android:animationCache="false" android:animationCache="false"
android:orientation="horizontal" > android:orientation="horizontal" >
<ImageSwitcher android:id="@+id/tickerIcon" <ImageSwitcher android:id="@+id/tickerIcon"
android:layout_width="wrap_content" android:layout_width="@dimen/status_bar_icon_size"
android:layout_height="match_parent" android:layout_height="@dimen/status_bar_icon_size"
android:layout_marginRight="8dip" android:layout_marginRight="2dip"
> >
<com.android.systemui.statusbar.AnimatedImageView <com.android.systemui.statusbar.AnimatedImageView
android:layout_width="25dip" android:layout_width="@dimen/status_bar_icon_size"
android:layout_height="25dip" android:layout_height="@dimen/status_bar_icon_size"
android:scaleType="center"
/> />
<com.android.systemui.statusbar.AnimatedImageView <com.android.systemui.statusbar.AnimatedImageView
android:layout_width="25dip" android:layout_width="@dimen/status_bar_icon_size"
android:layout_height="25dip" android:layout_height="@dimen/status_bar_icon_size"
android:scaleType="center"
/> />
</ImageSwitcher> </ImageSwitcher>
<com.android.systemui.statusbar.phone.TickerView android:id="@+id/tickerText" <com.android.systemui.statusbar.phone.TickerView android:id="@+id/tickerText"

View File

@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.phone; package com.android.systemui.statusbar.phone;
import android.content.Context; import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Handler; import android.os.Handler;
import android.text.StaticLayout; import android.text.StaticLayout;
@@ -50,6 +51,7 @@ public abstract class Ticker {
private View mTickerView; private View mTickerView;
private ImageSwitcher mIconSwitcher; private ImageSwitcher mIconSwitcher;
private TextSwitcher mTextSwitcher; private TextSwitcher mTextSwitcher;
private float mIconScale;
private final class Segment { private final class Segment {
StatusBarNotification notification; StatusBarNotification notification;
@@ -145,6 +147,11 @@ public abstract class Ticker {
public Ticker(Context context, View sb) { public Ticker(Context context, View sb) {
mContext = context; mContext = context;
final Resources res = context.getResources();
final int outerBounds = res.getDimensionPixelSize(R.dimen.status_bar_icon_size);
final int imageBounds = res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size);
mIconScale = (float)imageBounds / (float)outerBounds;
mTickerView = sb.findViewById(R.id.ticker); mTickerView = sb.findViewById(R.id.ticker);
mIconSwitcher = (ImageSwitcher)sb.findViewById(R.id.tickerIcon); mIconSwitcher = (ImageSwitcher)sb.findViewById(R.id.tickerIcon);
@@ -152,6 +159,8 @@ public abstract class Ticker {
AnimationUtils.loadAnimation(context, com.android.internal.R.anim.push_up_in)); AnimationUtils.loadAnimation(context, com.android.internal.R.anim.push_up_in));
mIconSwitcher.setOutAnimation( mIconSwitcher.setOutAnimation(
AnimationUtils.loadAnimation(context, com.android.internal.R.anim.push_up_out)); AnimationUtils.loadAnimation(context, com.android.internal.R.anim.push_up_out));
mIconSwitcher.setScaleX(mIconScale);
mIconSwitcher.setScaleY(mIconScale);
mTextSwitcher = (TextSwitcher)sb.findViewById(R.id.tickerText); mTextSwitcher = (TextSwitcher)sb.findViewById(R.id.tickerText);
mTextSwitcher.setInAnimation( mTextSwitcher.setInAnimation(