summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/layout/qs_footer_impl.xml54
-rw-r--r--packages/SystemUI/res/layout/qs_paged_tile_layout.xml4
-rw-r--r--packages/SystemUI/res/values-land/dimens.xml1
-rw-r--r--packages/SystemUI/res/values-land/integers.xml22
-rw-r--r--packages/SystemUI/res/values/dimens.xml1
-rw-r--r--packages/SystemUI/res/values/integers.xml5
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/PageIndicator.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanel.java49
10 files changed, 135 insertions, 31 deletions
diff --git a/packages/SystemUI/res/layout/qs_footer_impl.xml b/packages/SystemUI/res/layout/qs_footer_impl.xml
index f424171286f0..f554150ab0d0 100644
--- a/packages/SystemUI/res/layout/qs_footer_impl.xml
+++ b/packages/SystemUI/res/layout/qs_footer_impl.xml
@@ -38,35 +38,49 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginStart="16dp"
android:layout_gravity="center_vertical"
android:gravity="end" >
- <include
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|start"
- android:layout_marginEnd="8dp"
- android:visibility="gone"
- layout="@layout/mobile_signal_group" />
-
- <com.android.keyguard.CarrierText
- android:id="@+id/qs_carrier_text"
+ <LinearLayout
android:layout_width="0dp"
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
android:layout_weight="1"
- android:layout_gravity="center_vertical|start"
- android:layout_marginEnd="32dp"
- android:ellipsize="marquee"
- android:textAppearance="@style/TextAppearance.QS.TileLabel"
- android:textColor="?android:attr/textColorPrimary"
- android:textDirection="locale"
- android:singleLine="true" />
+ android:gravity="center_vertical|start"
+ android:paddingStart="16dp">
+
+ <include
+ layout="@layout/mobile_signal_group"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="8dp"
+ android:visibility="gone" />
+
+ <com.android.keyguard.CarrierText
+ android:id="@+id/qs_carrier_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginEnd="32dp"
+ android:ellipsize="marquee"
+ android:textAppearance="@style/TextAppearance.QS.TileLabel"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textDirection="locale"
+ android:singleLine="true" />
+
+ </LinearLayout>
+
+ <com.android.systemui.qs.PageIndicator
+ android:id="@+id/footer_page_indicator"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_vertical"
+ android:visibility="gone" />
<com.android.keyguard.AlphaOptimizedLinearLayout
android:id="@+id/qs_footer_actions_container"
- android:layout_width="wrap_content"
+ android:layout_width="@integer/qs_footer_actions_width"
android:layout_height="match_parent"
+ android:layout_weight="@integer/qs_footer_actions_weight"
android:gravity="center_vertical|end" >
<com.android.systemui.statusbar.phone.MultiUserSwitch
android:id="@+id/multi_user_switch"
diff --git a/packages/SystemUI/res/layout/qs_paged_tile_layout.xml b/packages/SystemUI/res/layout/qs_paged_tile_layout.xml
index 00427cb1c428..e96a09baa9db 100644
--- a/packages/SystemUI/res/layout/qs_paged_tile_layout.xml
+++ b/packages/SystemUI/res/layout/qs_paged_tile_layout.xml
@@ -19,9 +19,9 @@
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">
+ android:clipToPadding="false"
+ android:paddingBottom="@dimen/qs_paged_tile_layout_padding_bottom">
<FrameLayout
android:id="@+id/page_decor"
diff --git a/packages/SystemUI/res/values-land/dimens.xml b/packages/SystemUI/res/values-land/dimens.xml
index c59492fbc111..b81d363eab81 100644
--- a/packages/SystemUI/res/values-land/dimens.xml
+++ b/packages/SystemUI/res/values-land/dimens.xml
@@ -35,4 +35,5 @@
<integer name="quick_settings_num_columns">4</integer>
<bool name="quick_settings_wide">true</bool>
<dimen name="qs_detail_margin_top">0dp</dimen>
+ <dimen name="qs_paged_tile_layout_padding_bottom">0dp</dimen>
</resources>
diff --git a/packages/SystemUI/res/values-land/integers.xml b/packages/SystemUI/res/values-land/integers.xml
new file mode 100644
index 000000000000..fb226659dae7
--- /dev/null
+++ b/packages/SystemUI/res/values-land/integers.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2018 The Android Open Source 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
+ -->
+<resources>
+ <!-- Action footer width is set to 0 to allow it to stretch (through a weight of 1) and center
+ the page indicator in between the footer and the carrier text.-->
+ <integer name="qs_footer_actions_width">0</integer>
+ <integer name="qs_footer_actions_weight">1</integer>
+</resources> \ No newline at end of file
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 1e55eb34579d..b2200910a282 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -382,6 +382,7 @@
<dimen name="qs_footer_padding_start">16dp</dimen>
<dimen name="qs_footer_padding_end">16dp</dimen>
<dimen name="qs_footer_icon_size">16dp</dimen>
+ <dimen name="qs_paged_tile_layout_padding_bottom">24dp</dimen>
<dimen name="qs_notif_collapsed_space">64dp</dimen>
diff --git a/packages/SystemUI/res/values/integers.xml b/packages/SystemUI/res/values/integers.xml
index 8f23283478b0..87c4bbba86ef 100644
--- a/packages/SystemUI/res/values/integers.xml
+++ b/packages/SystemUI/res/values/integers.xml
@@ -16,4 +16,9 @@
-->
<resources>
<integer name="fingerprint_dialog_text_gravity">8388611</integer> <!-- gravity start -->
+
+ <!-- Action footer width used for layout_width to indicate WRAP_CONTENT (along with a weight of
+ 0) as we can allow the carrier text to stretch as far as needed in the QS footer. -->
+ <integer name="qs_footer_actions_width">-2</integer>
+ <integer name="qs_footer_actions_weight">0</integer>
</resources> \ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/qs/PageIndicator.java b/packages/SystemUI/src/com/android/systemui/qs/PageIndicator.java
index 2629f30f40e2..aa2f8d171143 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/PageIndicator.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/PageIndicator.java
@@ -45,7 +45,7 @@ public class PageIndicator extends ViewGroup {
}
public void setNumPages(int numPages) {
- setVisibility(numPages > 1 ? View.VISIBLE : View.INVISIBLE);
+ setVisibility(numPages > 1 ? View.VISIBLE : View.GONE);
if (mAnimating) {
Log.w(TAG, "setNumPages during animation");
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
index c548cf6a6519..d8d07c01fc96 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
@@ -46,6 +46,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
private final ArrayList<TilePage> mPages = new ArrayList<>();
private PageIndicator mPageIndicator;
+ private float mPageIndicatorPosition;
private int mNumPages;
private PageListener mPageListener;
@@ -145,6 +146,8 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
public void setPageIndicator(PageIndicator indicator) {
mPageIndicator = indicator;
+ mPageIndicator.setNumPages(mNumPages);
+ mPageIndicator.setLocation(mPageIndicatorPosition);
}
@Override
@@ -212,7 +215,6 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
}
if (DEBUG) Log.d(TAG, "Size: " + mNumPages);
mPageIndicator.setNumPages(mNumPages);
- mPageIndicator.setVisibility(mNumPages > 1 ? View.VISIBLE : View.GONE);
setAdapter(mAdapter);
mAdapter.notifyDataSetChanged();
setCurrentItem(0, false);
@@ -221,6 +223,12 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
@Override
public boolean updateResources() {
+ // Update bottom padding, useful for removing extra space once the panel page indicator is
+ // hidden.
+ setPadding(0, 0, 0,
+ getContext().getResources().getDimensionPixelSize(
+ R.dimen.qs_paged_tile_layout_padding_bottom));
+
boolean changed = false;
for (int i = 0; i < mPages.size(); i++) {
changed |= mPages.get(i).updateResources();
@@ -326,7 +334,8 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
if (mPageIndicator == null) return;
- mPageIndicator.setLocation(position + positionOffset);
+ mPageIndicatorPosition = position + positionOffset;
+ mPageIndicator.setLocation(mPageIndicatorPosition);
if (mPageListener != null) {
mPageListener.onPageChanged(positionOffsetPixels == 0 &&
(isLayoutRtl() ? position == mPages.size() - 1 : position == 0));
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
index 3ff0fe631342..aca601b19703 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
@@ -17,6 +17,7 @@
package com.android.systemui.qs;
import static android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS;
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import android.content.Context;
import android.content.Intent;
@@ -35,6 +36,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.Toast;
import com.android.internal.logging.MetricsLogger;
@@ -66,6 +68,7 @@ public class QSFooterImpl extends FrameLayout implements QSFooter,
private UserInfoController mUserInfoController;
private SettingsButton mSettingsButton;
protected View mSettingsContainer;
+ private PageIndicator mPageIndicator;
private CarrierText mCarrierText;
private boolean mQsDisabled;
@@ -108,6 +111,8 @@ public class QSFooterImpl extends FrameLayout implements QSFooter,
Dependency.get(ActivityStarter.class).postQSRunnableDismissingKeyguard(() ->
mQsPanel.showEdit(view)));
+ mPageIndicator = findViewById(R.id.footer_page_indicator);
+
mSettingsButton = findViewById(R.id.settings_button);
mSettingsContainer = findViewById(R.id.settings_button_container);
mSettingsButton.setOnClickListener(this);
@@ -167,6 +172,14 @@ public class QSFooterImpl extends FrameLayout implements QSFooter,
private void updateResources() {
updateFooterAnimator();
+
+ // Update the width and weight of the actions container as the page indicator can sometimes
+ // show and the layout needs to center it between the carrier text and actions container.
+ LinearLayout.LayoutParams params =
+ (LinearLayout.LayoutParams) mActionsContainer.getLayoutParams();
+ params.width = mContext.getResources().getInteger(R.integer.qs_footer_actions_width);
+ params.weight = mContext.getResources().getInteger(R.integer.qs_footer_actions_weight);
+ mActionsContainer.setLayoutParams(params);
}
private void updateFooterAnimator() {
@@ -181,6 +194,7 @@ public class QSFooterImpl extends FrameLayout implements QSFooter,
.addFloat(mMobileGroup, "alpha", 0, 1)
.addFloat(mActionsContainer, "alpha", 0, 1)
.addFloat(mDragHandle, "alpha", 1, 0, 0)
+ .addFloat(mPageIndicator, "alpha", 0, 1)
.setStartDelay(0.15f)
.build();
}
@@ -291,6 +305,7 @@ public class QSFooterImpl extends FrameLayout implements QSFooter,
mQsPanel = qsPanel;
if (mQsPanel != null) {
mMultiUserSwitch.setQsPanel(qsPanel);
+ mQsPanel.setFooterPageIndicator(mPageIndicator);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 3e1eed5b6efa..0876a5d3f456 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -16,6 +16,7 @@
package com.android.systemui.qs;
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import static com.android.systemui.qs.tileimpl.QSTileImpl.getColorForState;
import android.annotation.Nullable;
@@ -63,7 +64,6 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
protected final ArrayList<TileRecord> mRecords = new ArrayList<>();
protected final View mBrightnessView;
private final H mHandler = new H();
- private final View mPageIndicator;
private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class);
private final QSTileRevealController mQsTileRevealController;
@@ -75,6 +75,8 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
protected QSTileHost mHost;
protected QSSecurityFooter mFooter;
+ private PageIndicator mPanelPageIndicator;
+ private PageIndicator mFooterPageIndicator;
private boolean mGridContentVisible = true;
protected QSTileLayout mTileLayout;
@@ -104,13 +106,13 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
mTileLayout.setListening(mListening);
addView((View) mTileLayout);
- mPageIndicator = LayoutInflater.from(context).inflate(
+ mPanelPageIndicator = (PageIndicator) LayoutInflater.from(context).inflate(
R.layout.qs_page_indicator, this, false);
- addView(mPageIndicator);
+ addView(mPanelPageIndicator);
- ((PagedTileLayout) mTileLayout).setPageIndicator((PageIndicator) mPageIndicator);
+ ((PagedTileLayout) mTileLayout).setPageIndicator(mPanelPageIndicator);
mQsTileRevealController = new QSTileRevealController(mContext, this,
- ((PagedTileLayout) mTileLayout));
+ (PagedTileLayout) mTileLayout);
addDivider();
@@ -136,7 +138,7 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
}
public View getPageIndicator() {
- return mPageIndicator;
+ return mPanelPageIndicator;
}
public QSTileRevealController getQsTileRevealController() {
@@ -241,6 +243,38 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
}
}
+ /**
+ * Links the footer's page indicator, which is used in landscape orientation to save space.
+ *
+ * @param pageIndicator indicator to use for page scrolling
+ */
+ public void setFooterPageIndicator(PageIndicator pageIndicator) {
+ if (mTileLayout instanceof PagedTileLayout) {
+ mFooterPageIndicator = pageIndicator;
+ updatePageIndicator();
+ }
+ }
+
+ private void updatePageIndicator() {
+ if (mTileLayout instanceof PagedTileLayout) {
+ // If we're in landscape, and we have the footer page indicator (which we should if the
+ // footer has been initialized & linked), then we'll show the footer page indicator to
+ // save space in the main QS tile area. Otherwise, we'll use the default one under the
+ // tiles/above the footer.
+ boolean shouldUseFooterPageIndicator =
+ getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE
+ && mFooterPageIndicator != null;
+
+ mPanelPageIndicator.setVisibility(View.GONE);
+ if (mFooterPageIndicator != null) {
+ mFooterPageIndicator.setVisibility(View.GONE);
+ }
+
+ ((PagedTileLayout) mTileLayout).setPageIndicator(
+ shouldUseFooterPageIndicator ? mFooterPageIndicator : mPanelPageIndicator);
+ }
+ }
+
public QSTileHost getHost() {
return mHost;
}
@@ -248,6 +282,9 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
public void updateResources() {
final Resources res = mContext.getResources();
setPadding(0, res.getDimensionPixelSize(R.dimen.qs_panel_padding_top), 0, res.getDimensionPixelSize(R.dimen.qs_panel_padding_bottom));
+
+ updatePageIndicator();
+
for (TileRecord r : mRecords) {
r.tile.clearState();
}