Merge "DO NOT MERGE: Get rid of status bar's dim during night." into gingerbread

This commit is contained in:
Dianne Hackborn
2010-10-05 12:48:40 -07:00
committed by Android (Google) Code Review

View File

@ -42,10 +42,6 @@ public class StatusBarView extends FrameLayout {
View mDate;
FixedSizeDrawable mBackground;
boolean mNightMode = false;
int mStartAlpha = 0, mEndAlpha = 0;
long mEndTime = 0;
public StatusBarView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@ -68,29 +64,6 @@ public class StatusBarView extends FrameLayout {
mService.onBarViewAttached();
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
boolean nightMode = (newConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK)
== Configuration.UI_MODE_NIGHT_YES;
if (mNightMode != nightMode) {
mNightMode = nightMode;
mStartAlpha = getCurAlpha();
mEndAlpha = mNightMode ? 0x80 : 0x00;
mEndTime = SystemClock.uptimeMillis() + DIM_ANIM_TIME;
invalidate();
}
}
int getCurAlpha() {
long time = SystemClock.uptimeMillis();
if (time > mEndTime) {
return mEndAlpha;
}
return mEndAlpha
- (int)(((mEndAlpha-mStartAlpha) * (mEndTime-time) / DIM_ANIM_TIME));
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
@ -127,18 +100,6 @@ public class StatusBarView extends FrameLayout {
mBackground.setFixedBounds(-mDate.getLeft(), -mDate.getTop(), (r-l), (b-t));
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
int alpha = getCurAlpha();
if (alpha != 0) {
canvas.drawARGB(alpha, 0, 0, 0);
}
if (alpha != mEndAlpha) {
invalidate();
}
}
/**
* Gets the left position of v in this view. Throws if v is not
* a child of this.