Loading packages/SystemUI/res/layout/status_bar.xml +38 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,25 @@ android:orientation="horizontal" > <com.android.keyguard.AlphaOptimizedLinearLayout android:id="@+id/left_clock_layout" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="horizontal" > <com.android.systemui.statusbar.policy.Clock android:id="@+id/clock_left" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingEnd="6dip" android:gravity="center" android:visibility="gone" /> </com.android.keyguard.AlphaOptimizedLinearLayout> <!-- The alpha of this area is controlled from both PhoneStatusBarTransitions and PhoneStatusBar (DISABLE_NOTIFICATION_ICONS). --> <com.android.systemui.statusbar.AlphaOptimizedFrameLayout Loading Loading @@ -94,6 +113,25 @@ </com.android.keyguard.AlphaOptimizedLinearLayout> </LinearLayout> <com.android.keyguard.AlphaOptimizedLinearLayout android:id="@+id/center_clock_layout" android:gravity="center" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" > <com.android.systemui.statusbar.policy.Clock android:id="@+id/clock_center" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:layout_width="wrap_content" android:layout_height="match_parent" android:singleLine="true" android:gravity="center" android:visibility="gone" /> </com.android.keyguard.AlphaOptimizedLinearLayout> <ViewStub android:id="@+id/emergency_cryptkeeper_text" android:layout_width="wrap_content" Loading packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +17 −2 Original line number Diff line number Diff line Loading @@ -33,13 +33,17 @@ import com.android.systemui.R.id; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.qs.QSDetail.Callback; import com.android.systemui.statusbar.SignalClusterView; import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.policy.Clock; import com.android.systemui.statusbar.policy.DarkIconDispatcher.DarkReceiver; import com.android.systemui.tuner.TunerService; public class QuickStatusBarHeader extends RelativeLayout { public class QuickStatusBarHeader extends RelativeLayout implements TunerService.Tunable { private ActivityStarter mActivityStarter; private Clock mClock; private QSPanel mQsPanel; private boolean mExpanded; Loading @@ -57,6 +61,8 @@ public class QuickStatusBarHeader extends RelativeLayout { super.onFinishInflate(); Resources res = getResources(); mClock = findViewById(R.id.clock); mHeaderQsPanel = findViewById(R.id.quick_qs_panel); // RenderThread is doing more harm than good when touching the header (to expand quick Loading @@ -76,6 +82,9 @@ public class QuickStatusBarHeader extends RelativeLayout { battery.setForceShowPercent(true); mActivityStarter = Dependency.get(ActivityStarter.class); Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST); } private void applyDarkness(int id, Rect tintArea, float intensity, int color) { Loading Loading @@ -152,4 +161,10 @@ public class QuickStatusBarHeader extends RelativeLayout { public void setCallback(Callback qsPanelCallback) { mHeaderQsPanel.setCallback(qsPanelCallback); } @Override public void onTuningChanged(String key, String newValue) { mClock.setClockVisibleByUser(!StatusBarIconController.getIconBlacklist(newValue) .contains("clock")); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/ClockController.java 0 → 100644 +100 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.phone; import android.util.Log; import android.view.View; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.policy.Clock; import com.android.systemui.tuner.TunerService; public class ClockController implements TunerService.Tunable { private static final String TAG = "ClockController"; private static final int CLOCK_POSITION_RIGHT = 0; private static final int CLOCK_POSITION_CENTER = 1; private static final int CLOCK_POSITION_LEFT = 2; private static final String CLOCK_POSITION = "lineagesystem:status_bar_clock"; private Clock mActiveClock, mCenterClock, mLeftClock, mRightClock; private View mCenterClockLayout, mLeftClockLayout; private int mClockPosition = CLOCK_POSITION_RIGHT; private boolean mBlackListed = false; public ClockController(View statusBar) { mCenterClock = statusBar.findViewById(R.id.clock_center); mLeftClock = statusBar.findViewById(R.id.clock_left); mRightClock = statusBar.findViewById(R.id.clock); mCenterClockLayout = statusBar.findViewById(R.id.center_clock_layout); mLeftClockLayout = statusBar.findViewById(R.id.left_clock_layout); mActiveClock = mRightClock; Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST, CLOCK_POSITION); } private Clock getClockForCurrentLocation() { Clock clockForAlignment; switch (mClockPosition) { case CLOCK_POSITION_CENTER: clockForAlignment = mCenterClock; break; case CLOCK_POSITION_LEFT: clockForAlignment = mLeftClock; break; case CLOCK_POSITION_RIGHT: default: clockForAlignment = mRightClock; break; } return clockForAlignment; } private void updateActiveClock() { mActiveClock.setClockVisibleByUser(false); mActiveClock = getClockForCurrentLocation(); mActiveClock.setClockVisibleByUser(true); // Override any previous setting mActiveClock.setClockVisibleByUser(mBlackListed); } @Override public void onTuningChanged(String key, String newValue) { Log.d(TAG, "onTuningChanged key=" + key + " value=" + newValue); if (CLOCK_POSITION.equals(key)) { mClockPosition = newValue == null ? CLOCK_POSITION_RIGHT : Integer.valueOf(newValue); } else { mBlackListed = !StatusBarIconController.getIconBlacklist(newValue).contains("clock"); } updateActiveClock(); } public View getClock() { // We default to center, but it has no effect as long the clock itself is invisible return mClockPosition == CLOCK_POSITION_LEFT ? mLeftClockLayout : mCenterClockLayout; } } packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java +6 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue private StatusBar mStatusBarComponent; private DarkIconManager mDarkIconManager; private SignalClusterView mSignalClusterView; private ClockController mClockController; private SignalCallback mSignalCallback = new SignalCallback() { @Override Loading Loading @@ -93,6 +94,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue Dependency.get(StatusBarIconController.class).addIconGroup(mDarkIconManager); mSystemIconArea = mStatusBar.findViewById(R.id.system_icon_area); mSignalClusterView = mStatusBar.findViewById(R.id.signal_cluster); mClockController = new ClockController(mStatusBar); Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mSignalClusterView); // Default to showing until we know otherwise. showSystemIconArea(false); Loading Loading @@ -193,18 +195,22 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue public void hideSystemIconArea(boolean animate) { animateHide(mSystemIconArea, animate); animateHide(mClockController.getClock(), animate); } public void showSystemIconArea(boolean animate) { animateShow(mSystemIconArea, animate); animateShow(mClockController.getClock(), animate); } public void hideNotificationIconArea(boolean animate) { animateHide(mNotificationIconAreaInner, animate); animateHide(mClockController.getClock(), animate); } public void showNotificationIconArea(boolean animate) { animateShow(mNotificationIconAreaInner, animate); animateShow(mClockController.getClock(), animate); } /** Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarTransitions.java +9 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ public final class PhoneStatusBarTransitions extends BarTransitions { private final PhoneStatusBarView mView; private final float mIconAlphaWhenOpaque; private View mLeftSide, mStatusIcons, mSignalCluster, mBattery, mClock, mNetworkTraffic; private View mLeftSide, mStatusIcons, mSignalCluster, mBattery, mNetworkTraffic; private View mClock, mClockCenter, mClockLeft; private Animator mCurrentAnimation; public PhoneStatusBarTransitions(PhoneStatusBarView view) { Loading @@ -48,6 +49,8 @@ public final class PhoneStatusBarTransitions extends BarTransitions { mSignalCluster = mView.findViewById(R.id.signal_cluster); mBattery = mView.findViewById(R.id.battery); mClock = mView.findViewById(R.id.clock); mClockCenter = mView.findViewById(R.id.clock_center); mClockLeft = mView.findViewById(R.id.clock_left); mNetworkTraffic = mView.findViewById(R.id.network_traffic); applyModeBackground(-1, getMode(), false /*animate*/); applyMode(getMode(), false /*animate*/); Loading Loading @@ -94,7 +97,9 @@ public final class PhoneStatusBarTransitions extends BarTransitions { animateTransitionTo(mSignalCluster, newAlpha), animateTransitionTo(mNetworkTraffic, newAlpha), animateTransitionTo(mBattery, newAlphaBC), animateTransitionTo(mClock, newAlphaBC) animateTransitionTo(mClock, newAlphaBC), animateTransitionTo(mClockCenter, newAlphaBC), animateTransitionTo(mClockLeft, newAlphaBC) ); if (isLightsOut(mode)) { anims.setDuration(LIGHTS_OUT_DURATION); Loading @@ -108,6 +113,8 @@ public final class PhoneStatusBarTransitions extends BarTransitions { mNetworkTraffic.setAlpha(newAlpha); mBattery.setAlpha(newAlphaBC); mClock.setAlpha(newAlphaBC); mClockCenter.setAlpha(newAlphaBC); mClockLeft.setAlpha(newAlphaBC); } } } No newline at end of file Loading
packages/SystemUI/res/layout/status_bar.xml +38 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,25 @@ android:orientation="horizontal" > <com.android.keyguard.AlphaOptimizedLinearLayout android:id="@+id/left_clock_layout" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="horizontal" > <com.android.systemui.statusbar.policy.Clock android:id="@+id/clock_left" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingEnd="6dip" android:gravity="center" android:visibility="gone" /> </com.android.keyguard.AlphaOptimizedLinearLayout> <!-- The alpha of this area is controlled from both PhoneStatusBarTransitions and PhoneStatusBar (DISABLE_NOTIFICATION_ICONS). --> <com.android.systemui.statusbar.AlphaOptimizedFrameLayout Loading Loading @@ -94,6 +113,25 @@ </com.android.keyguard.AlphaOptimizedLinearLayout> </LinearLayout> <com.android.keyguard.AlphaOptimizedLinearLayout android:id="@+id/center_clock_layout" android:gravity="center" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" > <com.android.systemui.statusbar.policy.Clock android:id="@+id/clock_center" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:layout_width="wrap_content" android:layout_height="match_parent" android:singleLine="true" android:gravity="center" android:visibility="gone" /> </com.android.keyguard.AlphaOptimizedLinearLayout> <ViewStub android:id="@+id/emergency_cryptkeeper_text" android:layout_width="wrap_content" Loading
packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +17 −2 Original line number Diff line number Diff line Loading @@ -33,13 +33,17 @@ import com.android.systemui.R.id; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.qs.QSDetail.Callback; import com.android.systemui.statusbar.SignalClusterView; import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.policy.Clock; import com.android.systemui.statusbar.policy.DarkIconDispatcher.DarkReceiver; import com.android.systemui.tuner.TunerService; public class QuickStatusBarHeader extends RelativeLayout { public class QuickStatusBarHeader extends RelativeLayout implements TunerService.Tunable { private ActivityStarter mActivityStarter; private Clock mClock; private QSPanel mQsPanel; private boolean mExpanded; Loading @@ -57,6 +61,8 @@ public class QuickStatusBarHeader extends RelativeLayout { super.onFinishInflate(); Resources res = getResources(); mClock = findViewById(R.id.clock); mHeaderQsPanel = findViewById(R.id.quick_qs_panel); // RenderThread is doing more harm than good when touching the header (to expand quick Loading @@ -76,6 +82,9 @@ public class QuickStatusBarHeader extends RelativeLayout { battery.setForceShowPercent(true); mActivityStarter = Dependency.get(ActivityStarter.class); Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST); } private void applyDarkness(int id, Rect tintArea, float intensity, int color) { Loading Loading @@ -152,4 +161,10 @@ public class QuickStatusBarHeader extends RelativeLayout { public void setCallback(Callback qsPanelCallback) { mHeaderQsPanel.setCallback(qsPanelCallback); } @Override public void onTuningChanged(String key, String newValue) { mClock.setClockVisibleByUser(!StatusBarIconController.getIconBlacklist(newValue) .contains("clock")); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/ClockController.java 0 → 100644 +100 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.phone; import android.util.Log; import android.view.View; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.policy.Clock; import com.android.systemui.tuner.TunerService; public class ClockController implements TunerService.Tunable { private static final String TAG = "ClockController"; private static final int CLOCK_POSITION_RIGHT = 0; private static final int CLOCK_POSITION_CENTER = 1; private static final int CLOCK_POSITION_LEFT = 2; private static final String CLOCK_POSITION = "lineagesystem:status_bar_clock"; private Clock mActiveClock, mCenterClock, mLeftClock, mRightClock; private View mCenterClockLayout, mLeftClockLayout; private int mClockPosition = CLOCK_POSITION_RIGHT; private boolean mBlackListed = false; public ClockController(View statusBar) { mCenterClock = statusBar.findViewById(R.id.clock_center); mLeftClock = statusBar.findViewById(R.id.clock_left); mRightClock = statusBar.findViewById(R.id.clock); mCenterClockLayout = statusBar.findViewById(R.id.center_clock_layout); mLeftClockLayout = statusBar.findViewById(R.id.left_clock_layout); mActiveClock = mRightClock; Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST, CLOCK_POSITION); } private Clock getClockForCurrentLocation() { Clock clockForAlignment; switch (mClockPosition) { case CLOCK_POSITION_CENTER: clockForAlignment = mCenterClock; break; case CLOCK_POSITION_LEFT: clockForAlignment = mLeftClock; break; case CLOCK_POSITION_RIGHT: default: clockForAlignment = mRightClock; break; } return clockForAlignment; } private void updateActiveClock() { mActiveClock.setClockVisibleByUser(false); mActiveClock = getClockForCurrentLocation(); mActiveClock.setClockVisibleByUser(true); // Override any previous setting mActiveClock.setClockVisibleByUser(mBlackListed); } @Override public void onTuningChanged(String key, String newValue) { Log.d(TAG, "onTuningChanged key=" + key + " value=" + newValue); if (CLOCK_POSITION.equals(key)) { mClockPosition = newValue == null ? CLOCK_POSITION_RIGHT : Integer.valueOf(newValue); } else { mBlackListed = !StatusBarIconController.getIconBlacklist(newValue).contains("clock"); } updateActiveClock(); } public View getClock() { // We default to center, but it has no effect as long the clock itself is invisible return mClockPosition == CLOCK_POSITION_LEFT ? mLeftClockLayout : mCenterClockLayout; } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java +6 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue private StatusBar mStatusBarComponent; private DarkIconManager mDarkIconManager; private SignalClusterView mSignalClusterView; private ClockController mClockController; private SignalCallback mSignalCallback = new SignalCallback() { @Override Loading Loading @@ -93,6 +94,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue Dependency.get(StatusBarIconController.class).addIconGroup(mDarkIconManager); mSystemIconArea = mStatusBar.findViewById(R.id.system_icon_area); mSignalClusterView = mStatusBar.findViewById(R.id.signal_cluster); mClockController = new ClockController(mStatusBar); Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mSignalClusterView); // Default to showing until we know otherwise. showSystemIconArea(false); Loading Loading @@ -193,18 +195,22 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue public void hideSystemIconArea(boolean animate) { animateHide(mSystemIconArea, animate); animateHide(mClockController.getClock(), animate); } public void showSystemIconArea(boolean animate) { animateShow(mSystemIconArea, animate); animateShow(mClockController.getClock(), animate); } public void hideNotificationIconArea(boolean animate) { animateHide(mNotificationIconAreaInner, animate); animateHide(mClockController.getClock(), animate); } public void showNotificationIconArea(boolean animate) { animateShow(mNotificationIconAreaInner, animate); animateShow(mClockController.getClock(), animate); } /** Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarTransitions.java +9 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ public final class PhoneStatusBarTransitions extends BarTransitions { private final PhoneStatusBarView mView; private final float mIconAlphaWhenOpaque; private View mLeftSide, mStatusIcons, mSignalCluster, mBattery, mClock, mNetworkTraffic; private View mLeftSide, mStatusIcons, mSignalCluster, mBattery, mNetworkTraffic; private View mClock, mClockCenter, mClockLeft; private Animator mCurrentAnimation; public PhoneStatusBarTransitions(PhoneStatusBarView view) { Loading @@ -48,6 +49,8 @@ public final class PhoneStatusBarTransitions extends BarTransitions { mSignalCluster = mView.findViewById(R.id.signal_cluster); mBattery = mView.findViewById(R.id.battery); mClock = mView.findViewById(R.id.clock); mClockCenter = mView.findViewById(R.id.clock_center); mClockLeft = mView.findViewById(R.id.clock_left); mNetworkTraffic = mView.findViewById(R.id.network_traffic); applyModeBackground(-1, getMode(), false /*animate*/); applyMode(getMode(), false /*animate*/); Loading Loading @@ -94,7 +97,9 @@ public final class PhoneStatusBarTransitions extends BarTransitions { animateTransitionTo(mSignalCluster, newAlpha), animateTransitionTo(mNetworkTraffic, newAlpha), animateTransitionTo(mBattery, newAlphaBC), animateTransitionTo(mClock, newAlphaBC) animateTransitionTo(mClock, newAlphaBC), animateTransitionTo(mClockCenter, newAlphaBC), animateTransitionTo(mClockLeft, newAlphaBC) ); if (isLightsOut(mode)) { anims.setDuration(LIGHTS_OUT_DURATION); Loading @@ -108,6 +113,8 @@ public final class PhoneStatusBarTransitions extends BarTransitions { mNetworkTraffic.setAlpha(newAlpha); mBattery.setAlpha(newAlphaBC); mClock.setAlpha(newAlphaBC); mClockCenter.setAlpha(newAlphaBC); mClockLeft.setAlpha(newAlphaBC); } } } No newline at end of file