Merge "Move editing from long press to edit button" into nyc-dev
This commit is contained in:
@@ -20,11 +20,31 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.android.systemui.qs.PageIndicator
|
||||
android:id="@+id/page_indicator"
|
||||
android:layout_width="match_parent"
|
||||
<FrameLayout
|
||||
android:id="@+id/page_decor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center" />
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<com.android.systemui.qs.PageIndicator
|
||||
android:id="@+id/page_indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_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>
|
||||
|
||||
@@ -1405,4 +1405,7 @@
|
||||
<!-- Label for area where tiles can be dragged out of [CHAR LIMIT=60] -->
|
||||
<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>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user