Merge "DO NOT MERGE: Get rid of status bar's dim during night." into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
e02e41f484
@ -42,10 +42,6 @@ public class StatusBarView extends FrameLayout {
|
|||||||
View mDate;
|
View mDate;
|
||||||
FixedSizeDrawable mBackground;
|
FixedSizeDrawable mBackground;
|
||||||
|
|
||||||
boolean mNightMode = false;
|
|
||||||
int mStartAlpha = 0, mEndAlpha = 0;
|
|
||||||
long mEndTime = 0;
|
|
||||||
|
|
||||||
public StatusBarView(Context context, AttributeSet attrs) {
|
public StatusBarView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
}
|
}
|
||||||
@ -68,29 +64,6 @@ public class StatusBarView extends FrameLayout {
|
|||||||
mService.onBarViewAttached();
|
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
|
@Override
|
||||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||||
super.onSizeChanged(w, h, oldw, 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));
|
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
|
* Gets the left position of v in this view. Throws if v is not
|
||||||
* a child of this.
|
* a child of this.
|
||||||
|
Reference in New Issue
Block a user