Loading packages/SystemUI/res/layout/qs_paged_tile_layout.xml +25 −5 Original line number Original line Diff line number Diff line Loading @@ -20,11 +20,31 @@ android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content"> android:layout_height="wrap_content"> <FrameLayout android:id="@+id/page_decor" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom"> <com.android.systemui.qs.PageIndicator <com.android.systemui.qs.PageIndicator android:id="@+id/page_indicator" android:id="@+id/page_indicator" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|bottom" android:layout_gravity="center" android:gravity="center" /> android:gravity="center" /> <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="#4DFFFFFF" android:focusable="true" android:text="@string/qs_edit" /> </FrameLayout> </com.android.systemui.qs.PagedTileLayout> </com.android.systemui.qs.PagedTileLayout> packages/SystemUI/res/values/strings.xml +3 −0 Original line number Original line Diff line number Diff line Loading @@ -1405,4 +1405,7 @@ <!-- Label for area where tiles can be dragged out of [CHAR LIMIT=60] --> <!-- Label for area where tiles can be dragged out of [CHAR LIMIT=60] --> <string name="drag_to_add_tiles">Drag to add tiles</string> <string name="drag_to_add_tiles">Drag to add tiles</string> <!-- Button to edit the tile ordering of quick settings [CHAR LIMIT=60] --> <string name="qs_edit">Edit</string> </resources> </resources> packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java +4 −3 Original line number Original line Diff line number Diff line Loading @@ -6,7 +6,6 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.LayoutInflater; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; import com.android.internal.widget.PagerAdapter; import com.android.internal.widget.PagerAdapter; import com.android.internal.widget.ViewPager; import com.android.internal.widget.ViewPager; import com.android.systemui.R; import com.android.systemui.R; Loading @@ -27,6 +26,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { private PageIndicator mPageIndicator; private PageIndicator mPageIndicator; private int mNumPages; private int mNumPages; private View mDecorGroup; public PagedTileLayout(Context context, AttributeSet attrs) { public PagedTileLayout(Context context, AttributeSet attrs) { super(context, attrs); super(context, attrs); Loading Loading @@ -55,7 +55,8 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { protected void onFinishInflate() { protected void onFinishInflate() { super.onFinishInflate(); super.onFinishInflate(); mPageIndicator = (PageIndicator) findViewById(R.id.page_indicator); 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) mPages.add((TilePage) LayoutInflater.from(mContext) .inflate(R.layout.qs_paged_page, this, false)); .inflate(R.layout.qs_paged_page, this, false)); Loading Loading @@ -137,7 +138,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { maxHeight = height; maxHeight = height; } } } } setMeasuredDimension(getMeasuredWidth(), maxHeight + mPageIndicator.getMeasuredHeight()); setMeasuredDimension(getMeasuredWidth(), maxHeight + mDecorGroup.getMeasuredHeight()); } } private final Runnable mDistribute = new Runnable() { private final Runnable mDistribute = new Runnable() { Loading packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +31 −13 Original line number Original line Diff line number Diff line Loading @@ -117,6 +117,17 @@ public class QSPanel extends FrameLayout implements Tunable { mTileLayout = (QSTileLayout) LayoutInflater.from(mContext).inflate( mTileLayout = (QSTileLayout) LayoutInflater.from(mContext).inflate( R.layout.qs_paged_tile_layout, mQsContainer, false); R.layout.qs_paged_tile_layout, mQsContainer, false); mQsContainer.addView((View) mTileLayout); 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); mFooter = new QSFooter(this, context); mQsContainer.addView(mFooter.getView()); mQsContainer.addView(mFooter.getView()); Loading Loading @@ -369,19 +380,7 @@ public class QSPanel extends FrameLayout implements Tunable { final View.OnLongClickListener longClick = new View.OnLongClickListener() { final View.OnLongClickListener longClick = new View.OnLongClickListener() { @Override @Override public boolean onLongClick(View v) { public boolean onLongClick(View v) { if (mCustomizePanel != null) { return false; 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; } } }; }; r.tileView.init(click, longClick); r.tileView.init(click, longClick); Loading @@ -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) { protected void onTileClick(QSTile<?> tile) { tile.click(); tile.click(); } } Loading Loading
packages/SystemUI/res/layout/qs_paged_tile_layout.xml +25 −5 Original line number Original line Diff line number Diff line Loading @@ -20,11 +20,31 @@ android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content"> android:layout_height="wrap_content"> <FrameLayout android:id="@+id/page_decor" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom"> <com.android.systemui.qs.PageIndicator <com.android.systemui.qs.PageIndicator android:id="@+id/page_indicator" android:id="@+id/page_indicator" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|bottom" android:layout_gravity="center" android:gravity="center" /> android:gravity="center" /> <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="#4DFFFFFF" android:focusable="true" android:text="@string/qs_edit" /> </FrameLayout> </com.android.systemui.qs.PagedTileLayout> </com.android.systemui.qs.PagedTileLayout>
packages/SystemUI/res/values/strings.xml +3 −0 Original line number Original line Diff line number Diff line Loading @@ -1405,4 +1405,7 @@ <!-- Label for area where tiles can be dragged out of [CHAR LIMIT=60] --> <!-- Label for area where tiles can be dragged out of [CHAR LIMIT=60] --> <string name="drag_to_add_tiles">Drag to add tiles</string> <string name="drag_to_add_tiles">Drag to add tiles</string> <!-- Button to edit the tile ordering of quick settings [CHAR LIMIT=60] --> <string name="qs_edit">Edit</string> </resources> </resources>
packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java +4 −3 Original line number Original line Diff line number Diff line Loading @@ -6,7 +6,6 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.LayoutInflater; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; import com.android.internal.widget.PagerAdapter; import com.android.internal.widget.PagerAdapter; import com.android.internal.widget.ViewPager; import com.android.internal.widget.ViewPager; import com.android.systemui.R; import com.android.systemui.R; Loading @@ -27,6 +26,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { private PageIndicator mPageIndicator; private PageIndicator mPageIndicator; private int mNumPages; private int mNumPages; private View mDecorGroup; public PagedTileLayout(Context context, AttributeSet attrs) { public PagedTileLayout(Context context, AttributeSet attrs) { super(context, attrs); super(context, attrs); Loading Loading @@ -55,7 +55,8 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { protected void onFinishInflate() { protected void onFinishInflate() { super.onFinishInflate(); super.onFinishInflate(); mPageIndicator = (PageIndicator) findViewById(R.id.page_indicator); 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) mPages.add((TilePage) LayoutInflater.from(mContext) .inflate(R.layout.qs_paged_page, this, false)); .inflate(R.layout.qs_paged_page, this, false)); Loading Loading @@ -137,7 +138,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { maxHeight = height; maxHeight = height; } } } } setMeasuredDimension(getMeasuredWidth(), maxHeight + mPageIndicator.getMeasuredHeight()); setMeasuredDimension(getMeasuredWidth(), maxHeight + mDecorGroup.getMeasuredHeight()); } } private final Runnable mDistribute = new Runnable() { private final Runnable mDistribute = new Runnable() { Loading
packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +31 −13 Original line number Original line Diff line number Diff line Loading @@ -117,6 +117,17 @@ public class QSPanel extends FrameLayout implements Tunable { mTileLayout = (QSTileLayout) LayoutInflater.from(mContext).inflate( mTileLayout = (QSTileLayout) LayoutInflater.from(mContext).inflate( R.layout.qs_paged_tile_layout, mQsContainer, false); R.layout.qs_paged_tile_layout, mQsContainer, false); mQsContainer.addView((View) mTileLayout); 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); mFooter = new QSFooter(this, context); mQsContainer.addView(mFooter.getView()); mQsContainer.addView(mFooter.getView()); Loading Loading @@ -369,19 +380,7 @@ public class QSPanel extends FrameLayout implements Tunable { final View.OnLongClickListener longClick = new View.OnLongClickListener() { final View.OnLongClickListener longClick = new View.OnLongClickListener() { @Override @Override public boolean onLongClick(View v) { public boolean onLongClick(View v) { if (mCustomizePanel != null) { return false; 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; } } }; }; r.tileView.init(click, longClick); r.tileView.init(click, longClick); Loading @@ -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) { protected void onTileClick(QSTile<?> tile) { tile.click(); tile.click(); } } Loading