Fields Summary |
---|
private static final String | TAG |
private static final boolean | ALWAYS_ON |
private final Container | mUserSwitcherContainer |
private final android.view.ViewGroup | mUserSwitcher |
private final com.android.systemui.statusbar.phone.KeyguardStatusBarView | mStatusBarView |
private final Adapter | mAdapter |
private final com.android.keyguard.AppearAnimationUtils | mAppearAnimationUtils |
private final KeyguardUserSwitcherScrim | mBackground |
private android.animation.ObjectAnimator | mBgAnimator |
private UserSwitcherController | mUserSwitcherController |
private boolean | mAnimating |
public final android.database.DataSetObserver | mDataSetObserver |
Methods Summary |
---|
private void | cancelAnimations()
int count = mUserSwitcher.getChildCount();
for (int i = 0; i < count; i++) {
mUserSwitcher.getChildAt(i).animate().cancel();
}
if (mBgAnimator != null) {
mBgAnimator.cancel();
}
mUserSwitcher.animate().cancel();
mAnimating = false;
|
private void | hide(boolean animate)
if (mUserSwitcher != null && mUserSwitcherContainer.getVisibility() == View.VISIBLE) {
cancelAnimations();
if (animate) {
startDisappearAnimation();
} else {
mUserSwitcherContainer.setVisibility(View.GONE);
}
mStatusBarView.setKeyguardUserSwitcherShowing(false, animate);
}
|
public void | hideIfNotSimple(boolean animate)
if (mUserSwitcherContainer != null && !mUserSwitcherController.isSimpleUserSwitcher()) {
hide(animate);
}
|
boolean | isAnimating()
return mAnimating;
|
private void | refresh()
final int childCount = mUserSwitcher.getChildCount();
final int adapterCount = mAdapter.getCount();
final int N = Math.max(childCount, adapterCount);
for (int i = 0; i < N; i++) {
if (i < adapterCount) {
View oldView = null;
if (i < childCount) {
oldView = mUserSwitcher.getChildAt(i);
}
View newView = mAdapter.getView(i, oldView, mUserSwitcher);
if (oldView == null) {
// We ran out of existing views. Add it at the end.
mUserSwitcher.addView(newView);
} else if (oldView != newView) {
// We couldn't rebind the view. Replace it.
mUserSwitcher.removeViewAt(i);
mUserSwitcher.addView(newView, i);
}
} else {
int lastIndex = mUserSwitcher.getChildCount() - 1;
mUserSwitcher.removeViewAt(lastIndex);
}
}
|
public void | setKeyguard(boolean keyguard, boolean animate)
if (mUserSwitcher != null) {
if (keyguard && shouldExpandByDefault()) {
show(animate);
} else {
hide(animate);
}
}
|
private boolean | shouldExpandByDefault()
return (mUserSwitcherController != null) && mUserSwitcherController.isSimpleUserSwitcher();
|
public void | show(boolean animate)
if (mUserSwitcher != null && mUserSwitcherContainer.getVisibility() != View.VISIBLE) {
cancelAnimations();
mAdapter.refresh();
mUserSwitcherContainer.setVisibility(View.VISIBLE);
mStatusBarView.setKeyguardUserSwitcherShowing(true, animate);
if (animate) {
startAppearAnimation();
}
}
|
private void | startAppearAnimation()
int count = mUserSwitcher.getChildCount();
View[] objects = new View[count];
for (int i = 0; i < count; i++) {
objects[i] = mUserSwitcher.getChildAt(i);
}
mUserSwitcher.setClipChildren(false);
mUserSwitcher.setClipToPadding(false);
mAppearAnimationUtils.startAnimation(objects, new Runnable() {
@Override
public void run() {
mUserSwitcher.setClipChildren(true);
mUserSwitcher.setClipToPadding(true);
}
});
mAnimating = true;
mBgAnimator = ObjectAnimator.ofInt(mBackground, "alpha", 0, 255);
mBgAnimator.setDuration(400);
mBgAnimator.setInterpolator(PhoneStatusBar.ALPHA_IN);
mBgAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mBgAnimator = null;
mAnimating = false;
}
});
mBgAnimator.start();
|
private void | startDisappearAnimation()
mAnimating = true;
mUserSwitcher.animate()
.alpha(0f)
.setDuration(300)
.setInterpolator(PhoneStatusBar.ALPHA_OUT)
.withEndAction(new Runnable() {
@Override
public void run() {
mUserSwitcherContainer.setVisibility(View.GONE);
mUserSwitcher.setAlpha(1f);
mAnimating = false;
}
});
|