diff options
6 files changed, 80 insertions, 27 deletions
diff --git a/packages/SystemUI/res/drawable/qs_customizer_background.xml b/packages/SystemUI/res/drawable/qs_customizer_background.xml new file mode 100644 index 000000000000..6bb27cc2a517 --- /dev/null +++ b/packages/SystemUI/res/drawable/qs_customizer_background.xml @@ -0,0 +1,19 @@ +<!-- + Copyright (C) 2015 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. +--> +<transition xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@color/qs_detail_transition" /> + <item android:drawable="?android:attr/windowBackground" /> +</transition> diff --git a/packages/SystemUI/res/layout/qs_customize_panel.xml b/packages/SystemUI/res/layout/qs_customize_panel.xml index dc928c77baaa..59fed5ba7d2a 100644 --- a/packages/SystemUI/res/layout/qs_customize_panel.xml +++ b/packages/SystemUI/res/layout/qs_customize_panel.xml @@ -20,7 +20,8 @@ android:layout_height="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/navigation_bar_size" - android:background="?android:attr/windowBackground"> + android:background="@drawable/qs_customizer_background" + android:gravity="center_horizontal"> <FrameLayout android:layout_width="match_parent" @@ -76,10 +77,10 @@ </FrameLayout> <com.android.systemui.tuner.AutoScrollView - android:layout_width="match_parent" + android:layout_width="@dimen/notification_panel_width" android:layout_height="0dp" android:layout_weight="1" - android:paddingTop="8dp" + android:paddingTop="12dp" android:paddingBottom="8dp" android:elevation="2dp"> @@ -87,7 +88,9 @@ android:id="@+id/quick_settings_panel" android:background="#0000" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:layout_marginLeft="@dimen/notification_side_padding" + android:layout_marginRight="@dimen/notification_side_padding" /> </com.android.systemui.tuner.AutoScrollView> diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java index c612600ac82e..32c906e46afb 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java +++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java @@ -181,6 +181,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { public TilePage(Context context, AttributeSet attrs) { super(context, attrs); mAllowDual = false; + updateResources(); } public void setMaxRows(int maxRows) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 880349e232fe..18af35ea61cb 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -172,7 +172,8 @@ public class QSPanel extends FrameLayout implements Tunable { mCustomizePanel.setHost(mHost); } else { if (mCustomizePanel != null && mCustomizePanel.isCustomizing()) { - mCustomizePanel.hide(); + mCustomizePanel.hide(mCustomizePanel.getWidth() / 2, + mCustomizePanel.getHeight() / 2); } mCustomizePanel = null; } @@ -242,7 +243,7 @@ public class QSPanel extends FrameLayout implements Tunable { public void onCollapse() { if (mCustomizePanel != null && mCustomizePanel.isCustomizing()) { - mCustomizePanel.hide(); + mCustomizePanel.hide(mCustomizePanel.getWidth() / 2, mCustomizePanel.getHeight() / 2); } } @@ -382,7 +383,12 @@ public class QSPanel extends FrameLayout implements Tunable { public boolean onLongClick(View v) { if (mCustomizePanel != null) { if (!mCustomizePanel.isCustomizing()) { - mCustomizePanel.show(); + int[] loc = new int[2]; + getLocationInWindow(loc); + int x = r.tileView.getLeft() + r.tileView.getWidth() / 2 + loc[0]; + int y = r.tileView.getTop() + mTileLayout.getOffsetTop(r) + + r.tileView.getHeight() / 2 + loc[1]; + mCustomizePanel.show(x, y); } } else { r.tile.longClick(); @@ -409,7 +415,7 @@ public class QSPanel extends FrameLayout implements Tunable { public void closeDetail() { if (mCustomizePanel != null && mCustomizePanel.isCustomizing()) { // Treat this as a detail panel for now, to make things easy. - mCustomizePanel.hide(); + mCustomizePanel.hide(mCustomizePanel.getWidth() / 2, mCustomizePanel.getHeight() / 2); return; } showDetail(false, mDetailRecord); diff --git a/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java index 8bd05fad5699..b8342e2ada7c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java +++ b/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java @@ -68,9 +68,10 @@ public class TileLayout extends ViewGroup implements QSTileLayout { final Resources res = mContext.getResources(); final int columns = Math.max(1, res.getInteger(R.integer.quick_settings_num_columns)); mCellHeight = res.getDimensionPixelSize(R.dimen.qs_tile_height); - mCellWidth = (int)(mCellHeight * TILE_ASPECT); - mLargeCellHeight = res.getDimensionPixelSize(R.dimen.qs_dual_tile_height); - mLargeCellWidth = (int)(mLargeCellHeight * TILE_ASPECT); + mCellWidth = (int) (mCellHeight * TILE_ASPECT); + mLargeCellHeight = mAllowDual ? res.getDimensionPixelSize(R.dimen.qs_dual_tile_height) + : mCellHeight; + mLargeCellWidth = mAllowDual ? (int) (mLargeCellHeight * TILE_ASPECT) : mCellWidth; mDualTileUnderlap = res.getDimensionPixelSize(R.dimen.qs_dual_tile_padding_vertical); if (mColumns != columns) { mColumns = columns; diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java index 7e7478545a07..601961b41a16 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java @@ -15,23 +15,19 @@ */ package com.android.systemui.qs.customize; +import android.animation.Animator; import android.content.ClipData; import android.content.Context; import android.util.AttributeSet; import android.util.TypedValue; -import android.view.ContextThemeWrapper; -import android.view.DragEvent; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; +import android.view.*; import android.view.View.OnClickListener; -import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.Toolbar; import android.widget.Toolbar.OnMenuItemClickListener; - import com.android.systemui.R; import com.android.systemui.SystemUIApplication; +import com.android.systemui.qs.QSDetailClipper; import com.android.systemui.qs.QSTile.Host.Callback; import com.android.systemui.qs.customize.DropButton.OnDropListener; import com.android.systemui.statusbar.phone.PhoneStatusBar; @@ -48,10 +44,11 @@ import java.util.ArrayList; * *someday* do fancy animations to get into/out of it. */ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListener, Callback, - OnDropListener, OnClickListener { + OnDropListener, OnClickListener, Animator.AnimatorListener { private static final int MENU_SAVE = Menu.FIRST; private static final int MENU_RESET = Menu.FIRST + 1; + private final QSDetailClipper mClipper; private PhoneStatusBar mPhoneStatusBar; @@ -69,6 +66,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene super(new ContextThemeWrapper(context, android.R.style.Theme_Material), attrs); mPhoneStatusBar = ((SystemUIApplication) mContext.getApplicationContext()) .getComponent(PhoneStatusBar.class); + mClipper = new QSDetailClipper(this); } public void setHost(QSTileHost host) { @@ -90,8 +88,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene mToolbar.setNavigationOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - // TODO: Is this all we want...? - hide(); + hide(0, 0); } }); mToolbar.setOnMenuItemClickListener(this); @@ -115,17 +112,18 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene mFab.setOnClickListener(this); } - public void show() { + public void show(int x, int y) { isShown = true; mHost.setSavedTiles(); - // TODO: Fancy shmancy reveal. mPhoneStatusBar.getStatusBarWindow().addView(this); + mQsPanel.setListening(true); + mClipper.animateCircularClip(x, y, true, this); } - public void hide() { + public void hide(int x, int y) { isShown = false; - // TODO: Similarly awesome or better hide. - mPhoneStatusBar.getStatusBarWindow().removeView(this); + mQsPanel.setListening(false); + mClipper.animateCircularClip(x, y, false, this); } public boolean isCustomizing() { @@ -146,7 +144,8 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene private void save() { mHost.saveCurrentTiles(); - hide(); + // TODO: At save button. + hide(0, 0); } @Override @@ -197,4 +196,28 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene // TODO: Show list of tiles. } } + + @Override + public void onAnimationEnd(Animator animation) { + if (!isShown) { + mPhoneStatusBar.getStatusBarWindow().removeView(this); + } + } + + @Override + public void onAnimationCancel(Animator animation) { + if (!isShown) { + mPhoneStatusBar.getStatusBarWindow().removeView(this); + } + } + + @Override + public void onAnimationStart(Animator animation) { + // Don't care. + } + + @Override + public void onAnimationRepeat(Animator animation) { + // Don't care. + } }
\ No newline at end of file |