diff --git a/packages/SystemUI/res/drawable/ic_data_saver.xml b/packages/SystemUI/res/drawable/ic_data_saver.xml index 9c3bd3a7f374e..64bbff02cbbce 100644 --- a/packages/SystemUI/res/drawable/ic_data_saver.xml +++ b/packages/SystemUI/res/drawable/ic_data_saver.xml @@ -23,7 +23,7 @@ android:fillColor="#FFFFFFFF" android:pathData="M12.0,19.0c-3.9,0.0 -7.0,-3.1 -7.0,-7.0c0.0,-3.5 2.6,-6.4 6.0,-6.9L11.0,2.0C5.9,2.5 2.0,6.8 2.0,12.0c0.0,5.5 4.5,10.0 10.0,10.0c3.3,0.0 6.2,-1.6 8.1,-4.1l-2.6,-1.5C16.2,18.0 14.2,19.0 12.0,19.0z"/> diff --git a/packages/SystemUI/res/layout/battery_percentage_view.xml b/packages/SystemUI/res/layout/battery_percentage_view.xml index d6abc47c5af38..acae9f51c142a 100644 --- a/packages/SystemUI/res/layout/battery_percentage_view.xml +++ b/packages/SystemUI/res/layout/battery_percentage_view.xml @@ -25,5 +25,5 @@ android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:textColor="?android:attr/textColorPrimary" android:gravity="center_vertical|start" - android:paddingEnd="4dp" + android:paddingStart="4dp" /> diff --git a/packages/SystemUI/res/layout/divider.xml b/packages/SystemUI/res/layout/divider.xml index 95814371ed568..f1f0df054240a 100644 --- a/packages/SystemUI/res/layout/divider.xml +++ b/packages/SystemUI/res/layout/divider.xml @@ -16,5 +16,6 @@ diff --git a/packages/SystemUI/res/layout/qs_page_indicator.xml b/packages/SystemUI/res/layout/qs_page_indicator.xml index 02bd31a4c9723..583753a362f15 100644 --- a/packages/SystemUI/res/layout/qs_page_indicator.xml +++ b/packages/SystemUI/res/layout/qs_page_indicator.xml @@ -20,9 +20,8 @@ android:layout_width="match_parent" android:layout_height="48dp" android:layout_gravity="center" - android:layout_marginTop="40dp" android:layout_marginBottom="24dp" android:focusable="true" android:gravity="center" android:importantForAccessibility="yes" - android:visibility="gone"/> \ No newline at end of file + android:visibility="gone"/> diff --git a/packages/SystemUI/res/layout/qs_paged_tile_layout.xml b/packages/SystemUI/res/layout/qs_paged_tile_layout.xml index 8ff1d1e3ba18d..00427cb1c428e 100644 --- a/packages/SystemUI/res/layout/qs_paged_tile_layout.xml +++ b/packages/SystemUI/res/layout/qs_paged_tile_layout.xml @@ -19,6 +19,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" + android:paddingBottom="24dp" android:clipChildren="false" android:clipToPadding="false"> diff --git a/packages/SystemUI/res/layout/qs_tile_label.xml b/packages/SystemUI/res/layout/qs_tile_label.xml index a093b8734dbbc..8d1f9e4131f93 100644 --- a/packages/SystemUI/res/layout/qs_tile_label.xml +++ b/packages/SystemUI/res/layout/qs_tile_label.xml @@ -16,10 +16,12 @@ --> + android:gravity="center_horizontal" + android:paddingTop="8dp" + android:paddingBottom="8dp"> diff --git a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml index 3e8e72a3d1007..78d4bdd6c9dcb 100644 --- a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml @@ -85,16 +85,6 @@ - - 25dp - 80dp - 36dp + 88dp + 28dp 16dp 48dp 12dp diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java index f821308685549..bda4c957c5e8d 100644 --- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java @@ -65,6 +65,7 @@ public class BatteryMeterView extends LinearLayout implements private SettingObserver mSettingObserver; private int mTextColor; private int mLevel; + private boolean mForceShowPercent; public BatteryMeterView(Context context) { this(context, null, 0); @@ -103,6 +104,11 @@ public class BatteryMeterView extends LinearLayout implements updateShowPercent(); } + public void forceShowPercent() { + mForceShowPercent = true; + updateShowPercent(); + } + // StatusBarIconController reaches in here and adjusts the layout parameters of the icon public ImageView getBatteryIconView() { return mBatteryIconView; @@ -173,13 +179,12 @@ public class BatteryMeterView extends LinearLayout implements private void updateShowPercent() { final boolean showing = mBatteryPercentView != null; if (0 != Settings.System.getInt(getContext().getContentResolver(), - BatteryMeterView.SHOW_PERCENT_SETTING, 0)) { + BatteryMeterView.SHOW_PERCENT_SETTING, 0) || mForceShowPercent) { if (!showing) { mBatteryPercentView = loadPercentView(); if (mTextColor != 0) mBatteryPercentView.setTextColor(mTextColor); updatePercentText(); addView(mBatteryPercentView, - 0, new ViewGroup.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java index a231e791e3b00..35592576043d7 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java +++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java @@ -242,7 +242,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { maxHeight = height; } } - setMeasuredDimension(getMeasuredWidth(), maxHeight); + setMeasuredDimension(getMeasuredWidth(), maxHeight + getPaddingBottom()); } private final Runnable mDistribute = new Runnable() { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java index c85f83ba35886..e0d1cba401a17 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java @@ -160,7 +160,9 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha mAllViews.clear(); mTopFiveQs.clear(); - mAllViews.add((View) mQsPanel.getTileLayout()); + QSTileLayout tileLayout = mQsPanel.getTileLayout(); + mAllViews.add((View) tileLayout); + firstPageBuilder.addFloat(tileLayout, "translationY", mQsPanel.getHeight(), 0); for (QSTile tile : tiles) { QSTileBaseView tileView = mQsPanel.getTileView(tile); @@ -168,7 +170,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha Log.e(TAG, "tileView is null " + tile.getTileSpec()); continue; } - final TextView label = ((QSTileView) tileView).getLabel(); final View tileIcon = tileView.getIcon().getIconView(); View view = mQs.getView(); if (count < mNumQuickTiles && mAllowFancy) { @@ -187,12 +188,12 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha // Counteract the parent translation on the tile. So we have a static base to // animate the label position off from. - firstPageBuilder.addFloat(tileView, "translationY", mQsPanel.getHeight(), 0); + //firstPageBuilder.addFloat(tileView, "translationY", mQsPanel.getHeight(), 0); - // Move the real tile's label from the quick tile position to its final + // Move the real tile from the quick tile position to its final // location. - translationXBuilder.addFloat(label, "translationX", -xDiff, 0); - translationYBuilder.addFloat(label, "translationY", -yDiff, 0); + translationXBuilder.addFloat(tileView, "translationX", -xDiff, 0); + translationYBuilder.addFloat(tileView, "translationY", -yDiff, 0); mTopFiveQs.add(tileView.getIcon()); mAllViews.add(tileView.getIcon()); @@ -209,22 +210,22 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha firstPageBuilder.addFloat(tileView, "translationY", mQsPanel.getHeight(), 0); translationXBuilder.addFloat(tileView, "translationX", -xDiff, 0); - translationYBuilder.addFloat(label, "translationY", -yDiff, 0); + translationYBuilder.addFloat(tileView, "translationY", -yDiff, 0); translationYBuilder.addFloat(tileIcon, "translationY", -yDiff, 0); mAllViews.add(tileIcon); } else { firstPageBuilder.addFloat(tileView, "alpha", 0, 1); + firstPageBuilder.addFloat(tileView, "translationY", -mQsPanel.getHeight(), 0); } mAllViews.add(tileView); - mAllViews.add(label); count++; } if (mAllowFancy) { // Make brightness appear static position and alpha in through second half. View brightness = mQsPanel.getBrightnessView(); if (brightness != null) { -// firstPageBuilder.addFloat(brightness, "translationY", mQsPanel.getHeight(), 0); + firstPageBuilder.addFloat(brightness, "translationY", mQsPanel.getHeight(), 0); mBrightnessAnimator = new TouchAnimator.Builder() .addFloat(brightness, "alpha", 0, 1) .addFloat(mQsPanel.getPageIndicator(), "alpha", 0, 1) @@ -240,7 +241,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha // Fade in the tiles/labels as we reach the final position. mFirstPageDelayedAnimator = new TouchAnimator.Builder() .setStartDelay(EXPANDED_TILE_DELAY) - .addFloat(mQsPanel.getTileLayout(), "alpha", 0, 1) + .addFloat(tileLayout, "alpha", 0, 1) .addFloat(mQsPanel.getFooter().getView(), "alpha", 0, 1).build(); mAllViews.add(mQsPanel.getFooter().getView()); float px = 0; diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 504678c7f1c55..e8d5ece2072c6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -86,6 +86,10 @@ public class QSPanel extends LinearLayout implements Tunable, Callback { setOrientation(VERTICAL); + mBrightnessView = LayoutInflater.from(context).inflate( + R.layout.quick_settings_brightness_dialog, this, false); + addView(mBrightnessView); + setupTileLayout(); mFooter = new QSFooter(this, context); @@ -100,10 +104,6 @@ public class QSPanel extends LinearLayout implements Tunable, Callback { updateResources(); - mBrightnessView = LayoutInflater.from(context).inflate( - R.layout.quick_settings_brightness_dialog, this, false); - addView(mBrightnessView); - mBrightnessController = new BrightnessController(getContext(), (ImageView) findViewById(R.id.brightness_icon), (ToggleSliderView) findViewById(R.id.brightness_slider)); @@ -441,8 +441,15 @@ public class QSPanel extends LinearLayout implements Tunable, Callback { } r.tile.setDetailListening(show); int x = r.tileView.getLeft() + r.tileView.getWidth() / 2; - int y = r.tileView.getTop() + mTileLayout.getOffsetTop(r) + r.tileView.getHeight() / 2 - + getTop(); + int y; + if (r.tileView instanceof QSTileView) { + View labelContainer = (View) ((QSTileView) r.tileView).getLabel().getParent(); + y = r.tileView.getTop() + mTileLayout.getOffsetTop(r) + getTop() + + labelContainer.getTop() + labelContainer.getHeight() / 2; + } else { + y = r.tileView.getTop() + mTileLayout.getOffsetTop(r) + r.tileView.getHeight() / 2 + + getTop(); + } handleShowDetailImpl(r, show, x, y); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileBaseView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileBaseView.java index 0e04d0a0c825b..c750fdcd9fad3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileBaseView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileBaseView.java @@ -15,38 +15,30 @@ */ package com.android.systemui.qs; -import android.animation.ValueAnimator; import android.content.Context; -import android.content.res.ColorStateList; import android.content.res.TypedArray; -import android.graphics.Color; import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; import android.os.Handler; import android.os.Looper; import android.os.Message; -import android.service.quicksettings.Tile; import android.text.TextUtils; -import android.util.Log; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.ImageView.ScaleType; import android.widget.LinearLayout; import android.widget.Switch; -import com.android.settingslib.Utils; - import com.android.systemui.R; public class QSTileBaseView extends LinearLayout { private static final String TAG = "QSTileBaseView"; private final H mHandler = new H(); + private final FrameLayout mIconFrame; protected QSIconView mIcon; protected RippleDrawable mRipple; private Drawable mTileBackground; @@ -63,15 +55,15 @@ public class QSTileBaseView extends LinearLayout { // Default to Quick Tile padding, and QSTileView will specify its own padding. int padding = context.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_padding); - FrameLayout frame = new FrameLayout(context); - frame.setForegroundGravity(Gravity.CENTER); + mIconFrame = new FrameLayout(context); + mIconFrame.setForegroundGravity(Gravity.CENTER); int size = context.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size); - addView(frame, new LayoutParams(size, size)); + addView(mIconFrame, new LayoutParams(size, size)); mIcon = icon; FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.setMargins(0, padding, 0, padding); - frame.addView(mIcon, params); + mIconFrame.addView(mIcon, params); mTileBackground = newTileBackground(); if (mTileBackground instanceof RippleDrawable) { @@ -105,7 +97,7 @@ public class QSTileBaseView extends LinearLayout { private void updateRippleSize(int width, int height) { // center the touch feedback on the center of the icon, and dial it down a bit final int cx = width / 2; - final int cy = height / 2; + final int cy = mIconFrame.getMeasuredHeight() / 2; final int rad = (int) (mIcon.getHeight() * .85f); mRipple.setHotspotBounds(cx - rad, cy - rad, cx + rad, cy + rad); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java index 232941dc629b7..428fe9bbff7e0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java @@ -20,6 +20,7 @@ import static com.android.systemui.qs.QSTile.getColorForState; import android.content.Context; import android.content.res.Configuration; +import android.graphics.drawable.RippleDrawable; import android.service.quicksettings.Tile; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; @@ -28,6 +29,7 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.ViewGroup.LayoutParams; import android.widget.ImageView; import android.widget.TextView; @@ -43,8 +45,7 @@ public class QSTileView extends QSTileBaseView { protected TextView mLabel; private ImageView mPadLock; private int mState; - private OnClickListener mClick; - private OnClickListener mSecondaryClick; + private ViewGroup mLabelContainer; public QSTileView(Context context, QSIconView icon) { this(context, icon, false); @@ -76,13 +77,15 @@ public class QSTileView extends QSTileBaseView { } protected void createLabel() { - ViewGroup view = (ViewGroup) LayoutInflater.from(getContext()) - .inflate(R.layout.qs_tile_label, null); - view.setClipChildren(false); - view.setClipToPadding(false); - mLabel = (TextView) view.findViewById(R.id.tile_label); - mPadLock = (ImageView) view.findViewById(R.id.restricted_padlock); - addView(view); + mLabelContainer = (ViewGroup) LayoutInflater.from(getContext()) + .inflate(R.layout.qs_tile_label, this, false); + mLabelContainer.setClipChildren(false); + mLabelContainer.setClipToPadding(false); + mLabel = (TextView) mLabelContainer.findViewById(R.id.tile_label); + mPadLock = (ImageView) mLabelContainer.findViewById(R.id.restricted_padlock); + + mLabelContainer.setBackground(newTileBackground()); + addView(mLabelContainer); } @Override @@ -104,17 +107,10 @@ public class QSTileView extends QSTileBaseView { } @Override - public void init(OnClickListener click, OnClickListener secondaryClick, OnLongClickListener longClick) { - mClick = click; - mSecondaryClick = secondaryClick; + public void init(OnClickListener click, OnClickListener secondaryClick, + OnLongClickListener longClick) { super.init(click, secondaryClick, longClick); - } - - @Override - public boolean onTouchEvent(MotionEvent event) { - if (event.getActionMasked() == MotionEvent.ACTION_UP) { - setOnClickListener(event.getY() < (getMeasuredHeight() / 2) ? mClick : mSecondaryClick); - } - return super.onTouchEvent(event); + mLabelContainer.setClickable(true); + mLabelContainer.setOnClickListener(secondaryClick); } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BatteryTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BatteryTile.java index 8227f8f63cebb..f7bfc1e6d4fcd 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BatteryTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BatteryTile.java @@ -103,11 +103,6 @@ public class BatteryTile extends QSTile implements BatteryControll mBatteryController.setPowerSaveMode(!mPowerSave); } - @Override - protected void handleSecondaryClick() { - showDetail(true); - } - @Override public CharSequence getTileLabel() { return mContext.getString(R.string.battery); @@ -118,7 +113,6 @@ public class BatteryTile extends QSTile implements BatteryControll int level = (arg != null) ? (Integer) arg : mLevel; String percentage = NumberFormat.getPercentInstance().format((double) level / 100.0); - state.dualTarget = true; state.state = mCharging ? Tile.STATE_UNAVAILABLE : mPowerSave ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE; state.icon = ResourceIcon.get(R.drawable.ic_qs_battery_saver); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java index b48b829d14f77..3c28f7602c18d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java @@ -123,7 +123,6 @@ public class CastTile extends QSTile { @Override protected void handleUpdateState(BooleanState state, Object arg) { - state.dualTarget = true; state.label = mContext.getString(R.string.quick_settings_cast_title); state.contentDescription = state.label; state.value = false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java index 457ed6cc42379..ade1b0b6844e5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java @@ -26,7 +26,6 @@ import android.graphics.Color; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; -import android.icu.text.NumberFormat; import android.os.UserManager; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; @@ -55,7 +54,6 @@ import com.android.systemui.qs.QuickQSPanel; import com.android.systemui.qs.TouchAnimator; import com.android.systemui.qs.TouchAnimator.Builder; import com.android.systemui.statusbar.SignalClusterView; -import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.statusbar.policy.NetworkController.EmergencyListener; import com.android.systemui.statusbar.policy.NetworkController.IconState; @@ -68,7 +66,7 @@ import com.android.systemui.tuner.TunerService; public class QuickStatusBarHeader extends BaseStatusBarHeader implements NextAlarmChangeCallback, OnClickListener, OnUserInfoChangedListener, EmergencyListener, - BatteryStateChangeCallback, SignalCallback { + SignalCallback { private static final float EXPAND_INDICATOR_THRESHOLD = .93f; private ActivityStarter mActivityStarter; @@ -110,7 +108,6 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements private boolean mShowFullAlarm; private float mDateTimeTranslation; - private TextView mBatteryLevel; private SparseBooleanArray mRoamingsBySubId = new SparseBooleanArray(); private boolean mIsRoaming; @@ -161,8 +158,6 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements mAlarmStatus = (TextView) findViewById(R.id.alarm_status); mAlarmStatus.setOnClickListener(this); - mBatteryLevel = (TextView) findViewById(R.id.battery_level); - mMultiUserSwitch = (MultiUserSwitch) findViewById(R.id.multi_user_switch); mMultiUserAvatar = (ImageView) mMultiUserSwitch.findViewById(R.id.multi_user_avatar); mAlwaysShowMultiUserSwitch = res.getBoolean(R.bool.config_alwaysShowMultiUserSwitcher); @@ -179,7 +174,9 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements int colorForeground = Utils.getColorAttr(getContext(), android.R.attr.colorForeground); float intensity = colorForeground == Color.WHITE ? 0 : 1; cluster.onDarkChanged(new Rect(0, 0, 0, 0), intensity, colorForeground); + BatteryMeterView battery = (BatteryMeterView) findViewById(R.id.battery); + battery.forceShowPercent(); int colorSecondary = Utils.getColorAttr(getContext(), android.R.attr.textColorSecondary); battery.setRawColors(colorForeground, colorSecondary); @@ -443,17 +440,6 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements } } - @Override - public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) { - String percentage = NumberFormat.getPercentInstance().format((double) level / 100.0); - mBatteryLevel.setText(percentage); - } - - @Override - public void onPowerSaveChanged(boolean isPowerSave) { - // Don't care. - } - public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, int qsType, boolean activityIn, boolean activityOut, String typeContentDescription, String description, boolean isWide, int subId, boolean roaming) {