Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f3fe9a5 authored by Jason Monk's avatar Jason Monk Committed by android-build-merger
Browse files

Merge "Move editing from long press to edit button" into nyc-dev

am: 26a3f15a

* commit '26a3f15a':
  Move editing from long press to edit button
parents 06b52d93 26a3f15a
Loading
Loading
Loading
Loading
+25 −5
Original line number Original line Diff line number Diff line
@@ -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>
+3 −0
Original line number Original line Diff line number Diff line
@@ -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>
+4 −3
Original line number Original line Diff line number Diff line
@@ -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;
@@ -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);
@@ -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));
@@ -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() {
+31 −13
Original line number Original line Diff line number Diff line
@@ -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());
@@ -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);
@@ -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();
    }
    }