From 8a0d3fcf17d655d9a131b898114357ddd2b3c373 Mon Sep 17 00:00:00 2001 From: Rohan Shah Date: Thu, 29 Mar 2018 18:28:07 +0000 Subject: Revert "[QS] Update landscape UI" This reverts commit bc204efbe5602e130fbe666d6ea2b5185d42b0c4. Reason for revert: Causes crash on rotation due to something with config.xml overriding. Reverting as it's blocking daily build Bug: 77217078 Test: Ran build, checked rotation Change-Id: I79e94fb1703f888ac167cdae20142e130a2e80b3 --- .../quick_status_bar_header_system_icons.xml | 21 ++++---- .../src/com/android/systemui/BatteryMeterView.java | 56 ++++------------------ .../com/android/systemui/qs/QSContainerImpl.java | 34 ++----------- .../android/systemui/qs/QuickStatusBarHeader.java | 40 +++------------- .../systemui/statusbar/phone/ScrimController.java | 2 +- .../android/systemui/statusbar/policy/Clock.java | 37 +------------- .../systemui/statusbar/policy/DateView.java | 32 ------------- .../res/values-land/config.xml | 21 -------- .../res/values-land/config.xml | 21 -------- .../res/values-land/config.xml | 21 -------- .../res/values-land/config.xml | 21 -------- .../res/values-land/config.xml | 21 -------- 12 files changed, 34 insertions(+), 293 deletions(-) delete mode 100644 packages/overlays/DisplayCutoutEmulationCornerOverlay/res/values-land/config.xml delete mode 100644 packages/overlays/DisplayCutoutEmulationDoubleOverlay/res/values-land/config.xml delete mode 100644 packages/overlays/DisplayCutoutEmulationNarrowOverlay/res/values-land/config.xml delete mode 100644 packages/overlays/DisplayCutoutEmulationTallOverlay/res/values-land/config.xml delete mode 100644 packages/overlays/DisplayCutoutEmulationWideOverlay/res/values-land/config.xml (limited to 'packages') diff --git a/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml b/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml index 388b6333c719..f38129f0dffa 100644 --- a/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml +++ b/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml @@ -31,23 +31,25 @@ + android:gravity="center_vertical|start" + systemui:showDark="false" + /> + android:gravity="center_vertical|center_horizontal" + /> - + android:gravity="center_vertical|end" + /> diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java index 0683514f6f2a..1ae06d751255 100644 --- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java @@ -81,14 +81,6 @@ public class BatteryMeterView extends LinearLayout implements private float mDarkIntensity; private int mUser; - /** - * Whether we should use colors that adapt based on wallpaper/the scrim behind quick settings. - */ - private boolean mUseWallpaperTextColors; - - private int mNonAdaptedForegroundColor; - private int mNonAdaptedBackgroundColor; - public BatteryMeterView(Context context) { this(context, null, 0); } @@ -148,29 +140,6 @@ public class BatteryMeterView extends LinearLayout implements updateShowPercent(); } - /** - * Sets whether the battery meter view uses the wallpaperTextColor. If we're not using it, we'll - * revert back to dark-mode-based/tinted colors. - * - * @param shouldUseWallpaperTextColor whether we should use wallpaperTextColor for all - * components - */ - public void useWallpaperTextColor(boolean shouldUseWallpaperTextColor) { - if (shouldUseWallpaperTextColor == mUseWallpaperTextColors) { - return; - } - - mUseWallpaperTextColors = shouldUseWallpaperTextColor; - - if (mUseWallpaperTextColors) { - updateColors( - Utils.getColorAttr(mContext, R.attr.wallpaperTextColor), - Utils.getColorAttr(mContext, R.attr.wallpaperTextColorSecondary)); - } else { - updateColors(mNonAdaptedForegroundColor, mNonAdaptedBackgroundColor); - } - } - public void setColorsFromContext(Context context) { if (context == null) { return; @@ -210,8 +179,7 @@ public class BatteryMeterView extends LinearLayout implements getContext().getContentResolver().registerContentObserver( Settings.System.getUriFor(SHOW_BATTERY_PERCENT), false, mSettingObserver, mUser); updateShowPercent(); - Dependency.get(TunerService.class) - .addTunable(this, StatusBarIconController.ICON_BLACKLIST); + Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST); Dependency.get(ConfigurationController.class).addCallback(this); mUserTracker.startTracking(); } @@ -305,23 +273,19 @@ public class BatteryMeterView extends LinearLayout implements @Override public void onDarkChanged(Rect area, float darkIntensity, int tint) { mDarkIntensity = darkIntensity; - float intensity = DarkIconDispatcher.isInArea(area, this) ? darkIntensity : 0; - mNonAdaptedForegroundColor = getColorForDarkIntensity( - intensity, mLightModeFillColor, mDarkModeFillColor); - mNonAdaptedBackgroundColor = getColorForDarkIntensity( - intensity, mLightModeBackgroundColor,mDarkModeBackgroundColor); - - if (!mUseWallpaperTextColors) { - updateColors(mNonAdaptedForegroundColor, mNonAdaptedBackgroundColor); - } + int foreground = getColorForDarkIntensity(intensity, mLightModeFillColor, + mDarkModeFillColor); + int background = getColorForDarkIntensity(intensity, mLightModeBackgroundColor, + mDarkModeBackgroundColor); + mDrawable.setColors(foreground, background); + setTextColor(foreground); } - private void updateColors(int foregroundColor, int backgroundColor) { - mDrawable.setColors(foregroundColor, backgroundColor); - mTextColor = foregroundColor; + public void setTextColor(int color) { + mTextColor = color; if (mBatteryPercentView != null) { - mBatteryPercentView.setTextColor(foregroundColor); + mBatteryPercentView.setTextColor(color); } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java index 71614634cd00..bfbfbf6fe813 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java @@ -18,15 +18,17 @@ package com.android.systemui.qs; import android.content.Context; import android.content.res.Configuration; +import android.graphics.Canvas; +import android.graphics.Path; import android.graphics.Point; import android.util.AttributeSet; -import android.util.Log; import android.view.View; import android.widget.FrameLayout; import com.android.settingslib.Utils; import com.android.systemui.R; import com.android.systemui.qs.customize.QSCustomizer; +import com.android.systemui.statusbar.ExpandableOutlineView; /** * Wrapper view with background which contains {@link QSPanel} and {@link BaseStatusBarHeader} @@ -42,11 +44,7 @@ public class QSContainerImpl extends FrameLayout { protected float mQsExpansion; private QSCustomizer mQSCustomizer; private View mQSFooter; - private View mBackground; - private View mBackgroundGradient; - private View mStatusBarBackground; - private int mSideMargins; public QSContainerImpl(Context context, AttributeSet attrs) { @@ -62,8 +60,6 @@ public class QSContainerImpl extends FrameLayout { mQSCustomizer = findViewById(R.id.qs_customize); mQSFooter = findViewById(R.id.qs_footer); mBackground = findViewById(R.id.quick_settings_background); - mStatusBarBackground = findViewById(R.id.quick_settings_status_bar_background); - mBackgroundGradient = findViewById(R.id.quick_settings_gradient_view); mSideMargins = getResources().getDimensionPixelSize(R.dimen.notification_side_paddings); setClickable(true); @@ -71,22 +67,6 @@ public class QSContainerImpl extends FrameLayout { setMargins(); } - @Override - protected void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); - - // Hide the backgrounds when in landscape mode. - if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { - mBackgroundGradient.setVisibility(View.INVISIBLE); - mStatusBarBackground.setVisibility(View.INVISIBLE); - } else { - mBackgroundGradient.setVisibility(View.VISIBLE); - mStatusBarBackground.setVisibility(View.VISIBLE); - } - - updateResources(); - } - @Override public boolean performClick() { // Want to receive clicks so missing QQS tiles doesn't cause collapse, but @@ -121,14 +101,6 @@ public class QSContainerImpl extends FrameLayout { updateExpansion(); } - private void updateResources() { - LayoutParams layoutParams = (LayoutParams) mQSPanel.getLayoutParams(); - layoutParams.topMargin = mContext.getResources().getDimensionPixelSize( - com.android.internal.R.dimen.quick_qs_offset_height); - - mQSPanel.setLayoutParams(layoutParams); - } - /** * Overrides the height of this view (post-layout), so that the content is clipped to that * height and the background is set to that height. diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java index ca88d704fd87..0ac8b9ccef7e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java @@ -26,7 +26,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; -import android.content.res.Resources; import android.graphics.Color; import android.graphics.Rect; import android.media.AudioManager; @@ -56,10 +55,8 @@ import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.phone.PhoneStatusBarView; import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.phone.StatusBarIconController.TintedIconManager; -import com.android.systemui.statusbar.policy.Clock; import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.statusbar.policy.DarkIconDispatcher.DarkReceiver; -import com.android.systemui.statusbar.policy.DateView; import com.android.systemui.statusbar.policy.NextAlarmController; import java.util.Locale; @@ -94,7 +91,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue private TouchAnimator mStatusIconsAlphaAnimator; private TouchAnimator mHeaderTextContainerAlphaAnimator; - private View mSystemIconsView; private View mQuickQsStatusIcons; private View mDate; private View mHeaderTextContainerView; @@ -112,9 +108,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue private View mStatusSeparator; private ImageView mRingerModeIcon; private TextView mRingerModeTextView; - private BatteryMeterView mBatteryMeterView; - private Clock mClockView; - private DateView mDateView; private NextAlarmController mAlarmController; /** Counts how many times the long press tooltip has been shown to the user. */ @@ -146,7 +139,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue mHeaderQsPanel = findViewById(R.id.quick_qs_panel); mDate = findViewById(R.id.date); mDate.setOnClickListener(this); - mSystemIconsView = findViewById(R.id.quick_status_bar_system_icons); mQuickQsStatusIcons = findViewById(R.id.quick_qs_status_icons); mIconManager = new TintedIconManager(findViewById(R.id.statusIcons)); @@ -174,10 +166,8 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue // Set the correct tint for the status icons so they contrast mIconManager.setTint(fillColor); - mBatteryMeterView = findViewById(R.id.battery); - mBatteryMeterView.setForceShowPercent(true); - mClockView = findViewById(R.id.clock); - mDateView = findViewById(R.id.date); + BatteryMeterView battery = findViewById(R.id.battery); + battery.setForceShowPercent(true); } private void updateStatusText() { @@ -224,13 +214,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); updateResources(); - - // Update color schemes in landscape to use wallpaperTextColor - boolean shouldUseWallpaperTextColor = - newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE; - mBatteryMeterView.useWallpaperTextColor(shouldUseWallpaperTextColor); - mClockView.useWallpaperTextColor(shouldUseWallpaperTextColor); - mDateView.useWallpaperTextColor(shouldUseWallpaperTextColor); } @Override @@ -240,21 +223,11 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue } private void updateResources() { - Resources resources = mContext.getResources(); - - // Update height for a few views, especially due to landscape mode restricting space. + // Update height, especially due to landscape mode restricting space. mHeaderTextContainerView.getLayoutParams().height = - resources.getDimensionPixelSize(R.dimen.qs_header_tooltip_height); + mContext.getResources().getDimensionPixelSize(R.dimen.qs_header_tooltip_height); mHeaderTextContainerView.setLayoutParams(mHeaderTextContainerView.getLayoutParams()); - mSystemIconsView.getLayoutParams().height = resources.getDimensionPixelSize( - com.android.internal.R.dimen.quick_qs_offset_height); - mSystemIconsView.setLayoutParams(mSystemIconsView.getLayoutParams()); - - getLayoutParams().height = - resources.getDimensionPixelSize(com.android.internal.R.dimen.quick_qs_total_height); - setLayoutParams(getLayoutParams()); - updateStatusIconAlphaAnimator(); updateHeaderTextContainerAlphaAnimator(); } @@ -526,8 +499,9 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue mHeaderQsPanel.setHost(host, null /* No customization in header */); // Use SystemUI context to get battery meter colors, and let it use the default tint (white) - mBatteryMeterView.setColorsFromContext(mHost.getContext()); - mBatteryMeterView.onDarkChanged(new Rect(), 0, DarkIconDispatcher.DEFAULT_ICON_TINT); + BatteryMeterView battery = findViewById(R.id.battery); + battery.setColorsFromContext(mHost.getContext()); + battery.onDarkChanged(new Rect(), 0, DarkIconDispatcher.DEFAULT_ICON_TINT); } public void setCallback(Callback qsPanelCallback) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index 4e12936ff47a..2c025b5e2392 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -85,7 +85,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo /** * Default alpha value for most scrims. */ - public static final float GRADIENT_SCRIM_ALPHA = 0.70f; + public static final float GRADIENT_SCRIM_ALPHA = 0.45f; /** * A scrim varies its opacity based on a busyness factor, for example * how many notifications are currently visible. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java index baeaaadf419f..4c92d01eae4c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java @@ -40,7 +40,6 @@ import android.view.Display; import android.view.View; import android.widget.TextView; -import com.android.settingslib.Utils; import com.android.systemui.DemoMode; import com.android.systemui.Dependency; import com.android.systemui.FontSizeUtils; @@ -85,17 +84,6 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C private boolean mShowSeconds; private Handler mSecondsHandler; - /** - * Whether we should use colors that adapt based on wallpaper/the scrim behind quick settings - * for text. - */ - private boolean mUseWallpaperTextColor; - - /** - * Color to be set on this {@link TextView}, when wallpaperTextColor is not utilized. - */ - private int mNonAdaptedColor; - public Clock(Context context) { this(context, null); } @@ -113,7 +101,6 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C try { mAmPmStyle = a.getInt(R.styleable.Clock_amPmStyle, AM_PM_STYLE_GONE); mShowDark = a.getBoolean(R.styleable.Clock_showDark, true); - mNonAdaptedColor = getCurrentTextColor(); } finally { a.recycle(); } @@ -240,10 +227,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C @Override public void onDarkChanged(Rect area, float darkIntensity, int tint) { - mNonAdaptedColor = DarkIconDispatcher.getTint(area, this, tint); - if (!mUseWallpaperTextColor) { - setTextColor(mNonAdaptedColor); - } + setTextColor(DarkIconDispatcher.getTint(area, this, tint)); } @Override @@ -258,25 +242,6 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C 0); } - /** - * Sets whether the clock uses the wallpaperTextColor. If we're not using it, we'll revert back - * to dark-mode-based/tinted colors. - * - * @param shouldUseWallpaperTextColor whether we should use wallpaperTextColor for text color - */ - public void useWallpaperTextColor(boolean shouldUseWallpaperTextColor) { - if (shouldUseWallpaperTextColor == mUseWallpaperTextColor) { - return; - } - mUseWallpaperTextColor = shouldUseWallpaperTextColor; - - if (mUseWallpaperTextColor) { - setTextColor(Utils.getColorAttr(mContext, R.attr.wallpaperTextColor)); - } else { - setTextColor(mNonAdaptedColor); - } - } - private void updateShowSeconds() { if (mShowSeconds) { // Wait until we have a display to start trying to show seconds. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java index ef630c7205e1..74a30fa8094f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java @@ -27,7 +27,6 @@ import android.text.TextUtils; import android.util.AttributeSet; import android.widget.TextView; -import com.android.settingslib.Utils; import com.android.systemui.Dependency; import com.android.systemui.R; @@ -43,17 +42,6 @@ public class DateView extends TextView { private String mLastText; private String mDatePattern; - /** - * Whether we should use colors that adapt based on wallpaper/the scrim behind quick settings - * for text. - */ - private boolean mUseWallpaperTextColor; - - /** - * Color to be set on this {@link TextView}, when wallpaperTextColor is not utilized. - */ - private int mNonAdaptedTextColor; - private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -74,7 +62,6 @@ public class DateView extends TextView { public DateView(Context context, AttributeSet attrs) { super(context, attrs); - mNonAdaptedTextColor = getCurrentTextColor(); TypedArray a = context.getTheme().obtainStyledAttributes( attrs, R.styleable.DateView, @@ -130,25 +117,6 @@ public class DateView extends TextView { } } - /** - * Sets whether the date view uses the wallpaperTextColor. If we're not using it, we'll revert - * back to dark-mode-based/tinted colors. - * - * @param shouldUseWallpaperTextColor whether we should use wallpaperTextColor for text color - */ - public void useWallpaperTextColor(boolean shouldUseWallpaperTextColor) { - if (shouldUseWallpaperTextColor == mUseWallpaperTextColor) { - return; - } - mUseWallpaperTextColor = shouldUseWallpaperTextColor; - - if (mUseWallpaperTextColor) { - setTextColor(Utils.getColorAttr(mContext, R.attr.wallpaperTextColor)); - } else { - setTextColor(mNonAdaptedTextColor); - } - } - public void setDatePattern(String pattern) { if (TextUtils.equals(pattern, mDatePattern)) { return; diff --git a/packages/overlays/DisplayCutoutEmulationCornerOverlay/res/values-land/config.xml b/packages/overlays/DisplayCutoutEmulationCornerOverlay/res/values-land/config.xml deleted file mode 100644 index 1aa1af3b76fc..000000000000 --- a/packages/overlays/DisplayCutoutEmulationCornerOverlay/res/values-land/config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - @dimen/status_bar_height_landscape - - 156dp - \ No newline at end of file diff --git a/packages/overlays/DisplayCutoutEmulationDoubleOverlay/res/values-land/config.xml b/packages/overlays/DisplayCutoutEmulationDoubleOverlay/res/values-land/config.xml deleted file mode 100644 index 1aa1af3b76fc..000000000000 --- a/packages/overlays/DisplayCutoutEmulationDoubleOverlay/res/values-land/config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - @dimen/status_bar_height_landscape - - 156dp - \ No newline at end of file diff --git a/packages/overlays/DisplayCutoutEmulationNarrowOverlay/res/values-land/config.xml b/packages/overlays/DisplayCutoutEmulationNarrowOverlay/res/values-land/config.xml deleted file mode 100644 index 1aa1af3b76fc..000000000000 --- a/packages/overlays/DisplayCutoutEmulationNarrowOverlay/res/values-land/config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - @dimen/status_bar_height_landscape - - 156dp - \ No newline at end of file diff --git a/packages/overlays/DisplayCutoutEmulationTallOverlay/res/values-land/config.xml b/packages/overlays/DisplayCutoutEmulationTallOverlay/res/values-land/config.xml deleted file mode 100644 index 1aa1af3b76fc..000000000000 --- a/packages/overlays/DisplayCutoutEmulationTallOverlay/res/values-land/config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - @dimen/status_bar_height_landscape - - 156dp - \ No newline at end of file diff --git a/packages/overlays/DisplayCutoutEmulationWideOverlay/res/values-land/config.xml b/packages/overlays/DisplayCutoutEmulationWideOverlay/res/values-land/config.xml deleted file mode 100644 index 1aa1af3b76fc..000000000000 --- a/packages/overlays/DisplayCutoutEmulationWideOverlay/res/values-land/config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - @dimen/status_bar_height_landscape - - 156dp - \ No newline at end of file -- cgit v1.2.3-59-g8ed1b