Merge "QS: Update layout to show gear all the time" into nyc-mr1-dev
This commit is contained in:
24
packages/SystemUI/res/drawable/ic_mode_edit.xml
Normal file
24
packages/SystemUI/res/drawable/ic_mode_edit.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20.0dp"
|
||||
android:height="20.0dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M3.0,17.25L3.0,21.0l3.75,0.0L17.81,9.94l-3.75,-3.75L3.0,17.25zM20.71,7.04c0.39,-0.3 0.39,-1.02 0.0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0.0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||
</vector>
|
||||
24
packages/SystemUI/res/drawable/ic_settings_20dp.xml
Normal file
24
packages/SystemUI/res/drawable/ic_settings_20dp.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:pathData="M19.4,13.0c0.0,-0.3 0.1,-0.6 0.1,-1.0s0.0,-0.7 -0.1,-1.0l2.1,-1.7c0.2,-0.2 0.2,-0.4 0.1,-0.6l-2.0,-3.5C19.5,5.1 19.3,5.0 19.0,5.1l-2.5,1.0c-0.5,-0.4 -1.1,-0.7 -1.7,-1.0l-0.4,-2.6C14.5,2.2 14.2,2.0 14.0,2.0l-4.0,0.0C9.8,2.0 9.5,2.2 9.5,2.4L9.1,5.1C8.5,5.3 8.0,5.7 7.4,6.1L5.0,5.1C4.7,5.0 4.5,5.1 4.3,5.3l-2.0,3.5C2.2,8.9 2.3,9.2 2.5,9.4L4.6,11.0c0.0,0.3 -0.1,0.6 -0.1,1.0s0.0,0.7 0.1,1.0l-2.1,1.7c-0.2,0.2 -0.2,0.4 -0.1,0.6l2.0,3.5C4.5,18.9 4.7,19.0 5.0,18.9l2.5,-1.0c0.5,0.4 1.1,0.7 1.7,1.0l0.4,2.6c0.0,0.2 0.2,0.4 0.5,0.4l4.0,0.0c0.2,0.0 0.5,-0.2 0.5,-0.4l0.4,-2.6c0.6,-0.3 1.2,-0.6 1.7,-1.0l2.5,1.0c0.2,0.1 0.5,0.0 0.6,-0.2l2.0,-3.5c0.1,-0.2 0.1,-0.5 -0.1,-0.6L19.4,13.0zM12.0,15.5c-1.9,0.0 -3.5,-1.6 -3.5,-3.5s1.6,-3.5 3.5,-3.5s3.5,1.6 3.5,3.5S13.9,15.5 12.0,15.5z"
|
||||
android:fillColor="#ffffffff" />
|
||||
</vector>
|
||||
@@ -37,19 +37,6 @@
|
||||
android:importantForAccessibility="yes"
|
||||
android:focusable="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/edit"
|
||||
style="@style/QSBorderlessButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:minWidth="88dp"
|
||||
android:textAppearance="@style/TextAppearance.QS.DetailButton"
|
||||
android:textColor="#64FFFFFF"
|
||||
android:focusable="true"
|
||||
android:text="@string/qs_edit"
|
||||
android:contentDescription="@string/accessibility_quick_settings_edit"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</com.android.systemui.qs.PagedTileLayout>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<com.android.systemui.qs.QSPanel
|
||||
android:id="@+id/quick_settings_panel"
|
||||
android:background="#0000"
|
||||
android:layout_marginTop="@dimen/status_bar_header_height"
|
||||
android:layout_marginTop="80dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="8dp" />
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
android:clipToPadding="false"
|
||||
android:orientation="horizontal"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="12dp">
|
||||
|
||||
<com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@+id/multi_user_switch"
|
||||
@@ -52,6 +52,18 @@
|
||||
android:scaleType="centerInside"/>
|
||||
</com.android.systemui.statusbar.phone.MultiUserSwitch>
|
||||
|
||||
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||
android:id="@android:id/edit"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:clipToPadding="false"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:src="@drawable/ic_mode_edit"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/accessibility_quick_settings_edit"
|
||||
android:padding="14dp" />
|
||||
|
||||
<com.android.systemui.statusbar.AlphaOptimizedFrameLayout
|
||||
android:id="@+id/settings_button_container"
|
||||
android:layout_width="48dp"
|
||||
@@ -64,7 +76,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/ripple_drawable"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:src="@drawable/ic_settings_20dp"
|
||||
android:contentDescription="@string/accessibility_quick_settings_settings" />
|
||||
<com.android.systemui.statusbar.AlphaOptimizedImageView android:id="@+id/tuner_icon"
|
||||
android:layout_width="match_parent"
|
||||
@@ -98,7 +110,7 @@
|
||||
android:layout_alignParentTop="true"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingTop="2dp"
|
||||
android:visibility="gone"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.EmergencyCallsOnly"
|
||||
android:text="@*android:string/emergency_calls_only"
|
||||
@@ -112,7 +124,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:gravity="start"
|
||||
android:orientation="vertical">
|
||||
@@ -169,7 +181,7 @@
|
||||
android:id="@+id/quick_qs_panel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginTop="52dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
|
||||
@@ -94,8 +94,6 @@
|
||||
<dimen name="navigation_key_width">128dp</dimen>
|
||||
<dimen name="navigation_key_padding">25dp</dimen>
|
||||
|
||||
<dimen name="qs_expand_margin">0dp</dimen>
|
||||
|
||||
<!-- Keyboard shortcuts helper -->
|
||||
<dimen name="ksh_layout_width">488dp</dimen>
|
||||
|
||||
|
||||
@@ -18,6 +18,4 @@
|
||||
<resources>
|
||||
<!-- Standard notification width + gravity -->
|
||||
<dimen name="notification_panel_width">544dp</dimen>
|
||||
|
||||
<dimen name="qs_expand_margin">32dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<dimen name="close_handle_underlap">32dp</dimen>
|
||||
|
||||
<!-- Height of the status bar header bar -->
|
||||
<dimen name="status_bar_header_height">80dp</dimen>
|
||||
<dimen name="status_bar_header_height">104dp</dimen>
|
||||
|
||||
<!-- Height of the status bar header bar when expanded -->
|
||||
<dimen name="status_bar_header_height_expanded">116dp</dimen>
|
||||
@@ -169,8 +169,6 @@
|
||||
<dimen name="qs_tile_margin_top">16dp</dimen>
|
||||
<dimen name="qs_quick_tile_size">48dp</dimen>
|
||||
<dimen name="qs_quick_tile_padding">12dp</dimen>
|
||||
<dimen name="qs_date_anim_translation">32dp</dimen>
|
||||
<dimen name="qs_date_alarm_anim_translation">22dp</dimen>
|
||||
<dimen name="qs_date_collapsed_text_size">14sp</dimen>
|
||||
<dimen name="qs_date_text_size">16sp</dimen>
|
||||
<dimen name="qs_header_gear_translation">16dp</dimen>
|
||||
@@ -199,7 +197,6 @@
|
||||
<dimen name="qs_detail_margin_top">28dp</dimen>
|
||||
<dimen name="qs_data_usage_text_size">14sp</dimen>
|
||||
<dimen name="qs_data_usage_usage_text_size">36sp</dimen>
|
||||
<dimen name="qs_expand_margin">0dp</dimen>
|
||||
<dimen name="qs_battery_padding">2dp</dimen>
|
||||
<dimen name="qs_detail_items_padding_top">4dp</dimen>
|
||||
|
||||
|
||||
@@ -103,8 +103,6 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
||||
mTileLayout = (QSTileLayout) LayoutInflater.from(mContext).inflate(
|
||||
R.layout.qs_paged_tile_layout, this, false);
|
||||
addView((View) mTileLayout);
|
||||
findViewById(android.R.id.edit).setOnClickListener(view ->
|
||||
mHost.startRunnableDismissingKeyguard(() -> showEdit(view)));
|
||||
}
|
||||
|
||||
public boolean isShowingCustomize() {
|
||||
@@ -354,7 +352,7 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
||||
}
|
||||
|
||||
|
||||
private void showEdit(final View v) {
|
||||
public void showEdit(final View v) {
|
||||
v.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -362,8 +360,8 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
||||
if (!mCustomizePanel.isCustomizing()) {
|
||||
int[] loc = new int[2];
|
||||
v.getLocationInWindow(loc);
|
||||
int x = loc[0];
|
||||
int y = loc[1];
|
||||
int x = loc[0] + v.getWidth() / 2;
|
||||
int y = loc[1] + v.getHeight() / 2;
|
||||
mCustomizePanel.show(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,12 +140,11 @@ public class QuickQSPanel extends QSPanel {
|
||||
};
|
||||
|
||||
public int getNumQuickTiles(Context context) {
|
||||
return TunerService.get(context).getValue(NUM_QUICK_TILES, 5);
|
||||
return TunerService.get(context).getValue(NUM_QUICK_TILES, 6);
|
||||
}
|
||||
|
||||
private static class HeaderTileLayout extends LinearLayout implements QSTileLayout {
|
||||
|
||||
private final Space mEndSpacer;
|
||||
protected final ArrayList<TileRecord> mRecords = new ArrayList<>();
|
||||
|
||||
public HeaderTileLayout(Context context) {
|
||||
@@ -154,34 +153,15 @@ public class QuickQSPanel extends QSPanel {
|
||||
setClipToPadding(false);
|
||||
setGravity(Gravity.CENTER_VERTICAL);
|
||||
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
|
||||
mEndSpacer = new Space(context);
|
||||
mEndSpacer.setLayoutParams(generateLayoutParams());
|
||||
updateDownArrowMargin();
|
||||
addView(mEndSpacer);
|
||||
setOrientation(LinearLayout.HORIZONTAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
updateDownArrowMargin();
|
||||
}
|
||||
|
||||
private void updateDownArrowMargin() {
|
||||
LayoutParams params = (LayoutParams) mEndSpacer.getLayoutParams();
|
||||
params.setMarginStart(mContext.getResources().getDimensionPixelSize(
|
||||
R.dimen.qs_expand_margin));
|
||||
mEndSpacer.setLayoutParams(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTile(TileRecord tile) {
|
||||
addView(tile.tileView, getChildCount() - 1 /* Leave icon at end */,
|
||||
generateLayoutParams());
|
||||
// Add a spacer.
|
||||
addView(new Space(mContext), getChildCount() - 1 /* Leave icon at end */,
|
||||
generateSpaceParams());
|
||||
if (getChildCount() != 0) {
|
||||
// Add a spacer.
|
||||
addView(new Space(mContext), getChildCount(), generateSpaceParams());
|
||||
}
|
||||
addView(tile.tileView, getChildCount(), generateLayoutParams());
|
||||
mRecords.add(tile);
|
||||
}
|
||||
|
||||
@@ -205,8 +185,10 @@ public class QuickQSPanel extends QSPanel {
|
||||
int childIndex = getChildIndex(tile.tileView);
|
||||
// Remove the tile.
|
||||
removeViewAt(childIndex);
|
||||
// Remove its spacer as well.
|
||||
removeViewAt(childIndex);
|
||||
if (getChildCount() != 0) {
|
||||
// Remove its spacer as well.
|
||||
removeViewAt(childIndex);
|
||||
}
|
||||
mRecords.remove(tile);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,18 +81,16 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
protected MultiUserSwitch mMultiUserSwitch;
|
||||
private ImageView mMultiUserAvatar;
|
||||
|
||||
private float mDateTimeTranslation;
|
||||
private float mDateTimeAlarmTranslation;
|
||||
private float mDateScaleFactor;
|
||||
protected float mGearTranslation;
|
||||
|
||||
private TouchAnimator mSecondHalfAnimator;
|
||||
private TouchAnimator mFirstHalfAnimator;
|
||||
private TouchAnimator mDateSizeAnimator;
|
||||
private TouchAnimator mAlarmTranslation;
|
||||
protected TouchAnimator mSettingsAlpha;
|
||||
private float mExpansionAmount;
|
||||
private QSTileHost mHost;
|
||||
private View mEdit;
|
||||
|
||||
public QuickStatusBarHeader(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -104,6 +102,10 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
|
||||
mEmergencyOnly = (TextView) findViewById(R.id.header_emergency_calls_only);
|
||||
|
||||
mEdit = findViewById(android.R.id.edit);
|
||||
findViewById(android.R.id.edit).setOnClickListener(view ->
|
||||
mHost.startRunnableDismissingKeyguard(() -> mQsPanel.showEdit(view)));
|
||||
|
||||
mDateTimeAlarmGroup = (ViewGroup) findViewById(R.id.date_time_alarm_group);
|
||||
mDateTimeAlarmGroup.findViewById(R.id.empty_time_view).setVisibility(View.GONE);
|
||||
mDateTimeGroup = (ViewGroup) findViewById(R.id.date_time_group);
|
||||
@@ -153,16 +155,11 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
|
||||
mGearTranslation = mContext.getResources().getDimension(R.dimen.qs_header_gear_translation);
|
||||
|
||||
mDateTimeTranslation = mContext.getResources().getDimension(
|
||||
R.dimen.qs_date_anim_translation);
|
||||
mDateTimeAlarmTranslation = mContext.getResources().getDimension(
|
||||
R.dimen.qs_date_alarm_anim_translation);
|
||||
float dateCollapsedSize = mContext.getResources().getDimension(
|
||||
R.dimen.qs_date_collapsed_text_size);
|
||||
float dateExpandedSize = mContext.getResources().getDimension(
|
||||
R.dimen.qs_date_text_size);
|
||||
mDateScaleFactor = dateExpandedSize / dateCollapsedSize;
|
||||
updateDateTimePosition();
|
||||
|
||||
mSecondHalfAnimator = new TouchAnimator.Builder()
|
||||
.addFloat(mAlarmStatus, "alpha", 0, 1)
|
||||
@@ -184,10 +181,9 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
|
||||
protected void updateSettingsAnimator() {
|
||||
mSettingsAlpha = new TouchAnimator.Builder()
|
||||
.addFloat(mSettingsContainer, "translationY", -mGearTranslation, 0)
|
||||
.addFloat(mEdit, "translationY", -mGearTranslation, 0)
|
||||
.addFloat(mMultiUserSwitch, "translationY", -mGearTranslation, 0)
|
||||
.addFloat(mSettingsButton, "rotation", -90, 0)
|
||||
.addFloat(mSettingsContainer, "alpha", 0, 1)
|
||||
.addFloat(mEdit, "alpha", 0, 1)
|
||||
.addFloat(mMultiUserSwitch, "alpha", 0, 1)
|
||||
.setStartDelay(QSAnimator.EXPANDED_TILE_DELAY)
|
||||
.build();
|
||||
@@ -246,7 +242,6 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
mSecondHalfAnimator.setPosition(headerExpansionFraction);
|
||||
mFirstHalfAnimator.setPosition(headerExpansionFraction);
|
||||
mDateSizeAnimator.setPosition(headerExpansionFraction);
|
||||
mAlarmTranslation.setPosition(headerExpansionFraction);
|
||||
mSettingsAlpha.setPosition(headerExpansionFraction);
|
||||
|
||||
updateAlarmVisibilities();
|
||||
@@ -267,15 +262,6 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
mAlarmStatusCollapsed.setVisibility(mAlarmShowing ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
|
||||
private void updateDateTimePosition() {
|
||||
// This one has its own because we have to rebuild it every time the alarm state changes.
|
||||
mAlarmTranslation = new TouchAnimator.Builder()
|
||||
.addFloat(mDateTimeAlarmGroup, "translationY", 0, mAlarmShowing
|
||||
? mDateTimeAlarmTranslation : mDateTimeTranslation)
|
||||
.build();
|
||||
mAlarmTranslation.setPosition(mExpansionAmount);
|
||||
}
|
||||
|
||||
public void setListening(boolean listening) {
|
||||
if (listening == mListening) {
|
||||
return;
|
||||
@@ -287,7 +273,6 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
|
||||
@Override
|
||||
public void updateEverything() {
|
||||
updateDateTimePosition();
|
||||
updateVisibilities();
|
||||
setClickable(false);
|
||||
}
|
||||
@@ -296,7 +281,6 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
updateAlarmVisibilities();
|
||||
mEmergencyOnly.setVisibility(mExpanded && mShowEmergencyCallsOnly
|
||||
? View.VISIBLE : View.INVISIBLE);
|
||||
mSettingsContainer.setVisibility(mExpanded ? View.VISIBLE : View.INVISIBLE);
|
||||
mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility(
|
||||
TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE);
|
||||
mMultiUserSwitch.setVisibility(mExpanded && mMultiUserSwitch.hasMultipleUsers()
|
||||
|
||||
Reference in New Issue
Block a user