diff --git a/packages/SystemUI/res/layout/qs_paged_tile_layout.xml b/packages/SystemUI/res/layout/qs_paged_tile_layout.xml
index 127bddd71c439..c23c745931c6c 100644
--- a/packages/SystemUI/res/layout/qs_paged_tile_layout.xml
+++ b/packages/SystemUI/res/layout/qs_paged_tile_layout.xml
@@ -20,11 +20,31 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
-
+ android:layout_gravity="bottom">
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 6ff9be14b3ce4..5d4789a0f53d7 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1405,4 +1405,7 @@
Drag to add tiles
+
+ Edit
+
diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
index d723367398863..8e9857d27f74b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
@@ -6,7 +6,6 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-
import com.android.internal.widget.PagerAdapter;
import com.android.internal.widget.ViewPager;
import com.android.systemui.R;
@@ -27,6 +26,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
private PageIndicator mPageIndicator;
private int mNumPages;
+ private View mDecorGroup;
public PagedTileLayout(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -55,7 +55,8 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
protected void onFinishInflate() {
super.onFinishInflate();
mPageIndicator = (PageIndicator) findViewById(R.id.page_indicator);
- ((LayoutParams) mPageIndicator.getLayoutParams()).isDecor = true;
+ mDecorGroup = findViewById(R.id.page_decor);
+ ((LayoutParams) mDecorGroup.getLayoutParams()).isDecor = true;
mPages.add((TilePage) LayoutInflater.from(mContext)
.inflate(R.layout.qs_paged_page, this, false));
@@ -137,7 +138,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
maxHeight = height;
}
}
- setMeasuredDimension(getMeasuredWidth(), maxHeight + mPageIndicator.getMeasuredHeight());
+ setMeasuredDimension(getMeasuredWidth(), maxHeight + mDecorGroup.getMeasuredHeight());
}
private final Runnable mDistribute = new Runnable() {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 1961860d95f6e..4ffa527c6a42e 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -117,6 +117,17 @@ public class QSPanel extends FrameLayout implements Tunable {
mTileLayout = (QSTileLayout) LayoutInflater.from(mContext).inflate(
R.layout.qs_paged_tile_layout, mQsContainer, false);
mQsContainer.addView((View) mTileLayout);
+ findViewById(android.R.id.edit).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(final View v) {
+ mHost.startRunnableDismissingKeyguard(new Runnable() {
+ @Override
+ public void run() {
+ showEdit(v);
+ }
+ });
+ }
+ });
mFooter = new QSFooter(this, context);
mQsContainer.addView(mFooter.getView());
@@ -369,19 +380,7 @@ public class QSPanel extends FrameLayout implements Tunable {
final View.OnLongClickListener longClick = new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
- if (mCustomizePanel != null) {
- if (!mCustomizePanel.isCustomizing()) {
- 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();
- }
- return true;
+ return false;
}
};
r.tileView.init(click, longClick);
@@ -395,6 +394,25 @@ public class QSPanel extends FrameLayout implements Tunable {
}
}
+
+ private void showEdit(final View v) {
+ v.post(new Runnable() {
+ @Override
+ public void run() {
+ if (mCustomizePanel != null) {
+ if (!mCustomizePanel.isCustomizing()) {
+ int[] loc = new int[2];
+ v.getLocationInWindow(loc);
+ int x = loc[0];
+ int y = loc[1];
+ mCustomizePanel.show(x, y);
+ }
+ }
+
+ }
+ });
+ }
+
protected void onTileClick(QSTile> tile) {
tile.click();
}