private void applyLightsOut(boolean lightsOut, boolean animate, boolean force) { if (!force && lightsOut == mLightsOut) return; mLightsOut = lightsOut; final View statusBar = mView.findViewById(TkR.id.bar_contents); final View lowLights = mView.findViewById(TkR.id.bar_shadow); // ok, everyone, stop it right there statusBar.animate().cancel(); lowLights.animate().cancel(); final float navButtonsAlpha = lightsOut ? 0f : 1f; final float lowLightsAlpha = lightsOut ? 1f : 0f; if (!animate) { statusBar.setAlpha(navButtonsAlpha); lowLights.setAlpha(lowLightsAlpha); lowLights.setVisibility(lightsOut ? View.VISIBLE : View.GONE); } else { final int duration = lightsOut ? LIGHTS_OUT_DURATION : LIGHTS_IN_DURATION; statusBar.animate().alpha(navButtonsAlpha).setDuration(duration).start(); lowLights.setOnTouchListener(mLightsOutListener); if (lowLights.getVisibility() == View.GONE) { lowLights.setAlpha(0f); lowLights.setVisibility(View.VISIBLE); } lowLights .animate() .alpha(lowLightsAlpha) .setDuration(duration) .setInterpolator(new AccelerateInterpolator(2.0f)) .setListener( lightsOut ? null : new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator _a) { lowLights.setVisibility(View.GONE); } }) .start(); } }
public void init() { mFeedbackIconArea = mView.findViewById(TkR.id.feedbackIconArea); mStatusIcons = mView.findViewById(SystemR.id.statusIcons); mSignalCluster = mView.findViewById(SystemR.id.signal_cluster); mBattery = mView.findViewById(SystemR.id.battery); mBatteryText = mView.findViewById(TkR.id.battery_text); mBluetooth = mView.findViewById(TkR.id.bluetooth); mClock = mView.findViewById(SystemR.id.clock); applyModeBackground(-1, getMode(), false /*animate*/); applyMode(getMode(), false /*animate*/, true /*force*/); }