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

Commit 22308ce1 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Updating the icon click feedback" into ub-now-porkchop

parents 21116068 508da155
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -14,10 +14,8 @@
     limitations under the License.
-->

<com.android.launcher3.PagedViewIcon
<com.android.launcher3.BubbleTextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"

    style="@style/WorkspaceIcon.AppsCustomize"
    android:id="@+id/application_icon"
    android:focusable="true" />
+0 −1
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@
    <declare-styleable name="BubbleTextView">
        <!-- A spacing override for the icons within a page -->
        <attr name="customShadows" format="boolean" />
        <attr name="glowColor" format="color" />
    </declare-styleable>

    <!-- AppsCustomizePagedView specific attributes.  These attributes are used to
+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@

    <color name="quantum_panel_text_color">#FF666666</color>
    <color name="quantum_panel_text_shadow_color">#FFC4C4C4</color>
    <color name="folder_items_glow_color">#FFCCCCCC</color>
    <color name="outline_color">#FFFFFFFF</color>
    <color name="widget_text_panel">#FF374248</color>

+2 −2
Original line number Diff line number Diff line
@@ -91,7 +91,8 @@
        <item name="android:shadowRadius">2.0</item>
        <item name="android:shadowDx">0</item>
        <item name="android:shadowDy">2</item>
        <item name="android:shadowColor">#FFC4C4C4</item>
        <item name="android:shadowColor">@color/quantum_panel_text_shadow_color</item>
        <item name="customShadows">false</item>
    </style>

    <style name="WorkspaceIcon.Folder">
@@ -103,7 +104,6 @@
        <item name="android:shadowDy">2</item>

        <item name="customShadows">false</item>
        <item name="glowColor">@color/folder_items_glow_color</item>
    </style>

    <style name="SearchDropTargetBar">
+26 −60
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.GridLayout;
import android.widget.ImageView;
import android.widget.Toast;
@@ -144,8 +143,7 @@ class AppsCustomizeAsyncTask extends AsyncTask<AsyncTaskPageData, Void, AsyncTas
 */
public class AppsCustomizePagedView extends PagedViewWithDraggableItems implements
        View.OnClickListener, View.OnKeyListener, DragSource,
        PagedViewIcon.PressedCallback, PagedViewWidget.ShortPressListener,
        LauncherTransitionable {
        PagedViewWidget.ShortPressListener, LauncherTransitionable {
    static final String TAG = "AppsCustomizePagedView";

    private static Rect sTmpRect = new Rect();
@@ -167,7 +165,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen

    // Save and Restore
    private int mSaveInstanceStateItemIndex = -1;
    private PagedViewIcon mPressedIcon;

    // Content
    private ArrayList<AppInfo> mApps;
@@ -444,19 +441,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
    @Override
    public void onClick(View v) {
        // When we have exited all apps or are in transition, disregard clicks
        if (!mLauncher.isAllAppsVisible() ||
                mLauncher.getWorkspace().isSwitchingState()) return;
        if (!mLauncher.isAllAppsVisible()
                || mLauncher.getWorkspace().isSwitchingState()
                || !(v instanceof PagedViewWidget)) return;

        if (v instanceof PagedViewIcon) {
            // Animate some feedback to the click
            final AppInfo appInfo = (AppInfo) v.getTag();

            // Lock the drawable state to pressed until we return to Launcher
            if (mPressedIcon != null) {
                mPressedIcon.lockDrawableState();
            }
            mLauncher.onClickPagedViewIcon(v, appInfo);
        } else if (v instanceof PagedViewWidget) {
        // Let the user know that they have to long press to add a widget
        if (mWidgetInstructionToast != null) {
            mWidgetInstructionToast.cancel();
@@ -477,7 +465,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
        bounce.setInterpolator(new AccelerateInterpolator());
        bounce.start();
    }
    }

    public boolean onKey(View v, int keyCode, KeyEvent event) {
        return FocusHelper.handleAppsCustomizeKeyEvent(v,  keyCode, event);
@@ -492,7 +479,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
    }

    private void beginDraggingApplication(View v) {
        mLauncher.getWorkspace().onDragStartedWithItem(v);
        mLauncher.getWorkspace().beginDragShared(v, this);
    }

@@ -726,7 +712,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
    protected boolean beginDragging(final View v) {
        if (!super.beginDragging(v)) return false;

        if (v instanceof PagedViewIcon) {
        if (v instanceof BubbleTextView) {
            beginDraggingApplication(v);
        } else if (v instanceof PagedViewWidget) {
            if (!beginDraggingWidget(v)) {
@@ -741,9 +727,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
            public void run() {
                // We don't enter spring-loaded mode if the drag has been cancelled
                if (mLauncher.getDragController().isDragging()) {
                    // Reset the alpha on the dragged icon before we drag
                    resetDrawableState();

                    // Go into spring loaded mode (must happen before we startDrag())
                    mLauncher.enterSpringLoadedDragMode();
                }
@@ -992,10 +975,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
        ArrayList<Bitmap> images = new ArrayList<Bitmap>();
        for (int i = startIndex; i < endIndex; ++i) {
            AppInfo info = mApps.get(i);
            PagedViewIcon icon = (PagedViewIcon) mLayoutInflater.inflate(
            BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(
                    R.layout.apps_customize_application, layout, false);
            icon.applyFromApplicationInfo(info, true, this);
            icon.setOnClickListener(this);
            icon.applyFromApplicationInfo(info);
            icon.setOnClickListener(mLauncher);
            icon.setOnLongClickListener(this);
            icon.setOnTouchListener(this);
            icon.setOnKeyListener(this);
@@ -1559,23 +1542,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
        cancelAllTasks();
    }

    @Override
    public void iconPressed(PagedViewIcon icon) {
        // Reset the previously pressed icon and store a reference to the pressed icon so that
        // we can reset it on return to Launcher (in Launcher.onResume())
        if (mPressedIcon != null) {
            mPressedIcon.resetDrawableState();
        }
        mPressedIcon = icon;
    }

    public void resetDrawableState() {
        if (mPressedIcon != null) {
            mPressedIcon.resetDrawableState();
            mPressedIcon = null;
        }
    }

    /*
     * We load an extra page on each side to prevent flashes from scrolling and loading of the
     * widget previews in the background with the AsyncTasks.
Loading