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

Commit 2fd7a8bc authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Updating the UI of the options popup to make it look similar to icon popup

Bug: 77327164
Change-Id: I3580df8bf8a43cb44123f203ffed9a85fa33aea7
parent 415a1402
Loading
Loading
Loading
Loading
+6 −78
Original line number Diff line number Diff line
@@ -15,83 +15,11 @@
-->
<com.android.launcher3.views.OptionsPopupView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="96dp"
    android:background="?attr/popupColorPrimary"
    android:elevation="@dimen/deep_shortcuts_elevation"
    android:orientation="horizontal"
    launcher:layout_ignoreInsets="true">

    <FrameLayout
        android:id="@+id/wallpaper_button"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="?android:attr/selectableItemBackground">

        <TextView
    android:id="@+id/deep_shortcuts_container"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:drawablePadding="4dp"
            android:drawableTint="?android:attr/textColorPrimary"
            android:drawableTop="@drawable/ic_wallpaper"
            android:fontFamily="sans-serif-condensed"
            android:gravity="center"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:text="@string/wallpaper_button_text"
            android:textColor="?android:attr/textColorPrimary"
            android:textSize="12sp"/>
    </FrameLayout>

    <FrameLayout
        android:id="@+id/widget_button"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="?android:attr/selectableItemBackground">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:drawablePadding="4dp"
            android:drawableTint="?android:attr/textColorPrimary"
            android:drawableTop="@drawable/ic_widget"
            android:fontFamily="sans-serif-condensed"
            android:gravity="center"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:text="@string/widget_button_text"
            android:textColor="?android:attr/textColorPrimary"
            android:textSize="12sp"/>

    </FrameLayout>

    <FrameLayout
        android:id="@+id/settings_button"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="?android:attr/selectableItemBackground">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:drawablePadding="4dp"
            android:drawableTint="?android:attr/textColorPrimary"
            android:drawableTop="@drawable/ic_setting"
            android:fontFamily="sans-serif-condensed"
            android:gravity="center"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:text="@string/settings_button_text"
            android:textColor="?android:attr/textColorPrimary"
            android:textSize="12sp"/>

    </FrameLayout>

</com.android.launcher3.views.OptionsPopupView>
 No newline at end of file
    android:background="?attr/popupColorPrimary"
    android:clipToPadding="false"
    android:clipChildren="false"
    android:elevation="@dimen/deep_shortcuts_elevation"
    android:orientation="vertical" />
+1 −0
Original line number Diff line number Diff line
@@ -222,4 +222,5 @@

<!-- Overview -->
    <dimen name="options_menu_icon_size">24dp</dimen>
    <dimen name="options_menu_thumb_size">32dp</dimen>
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public abstract class BaseDraggingActivity extends BaseActivity
    private static final String TAG = "BaseDraggingActivity";

    // The Intent extra that defines whether to ignore the launch animation
    protected static final String INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION =
    public static final String INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION =
            "com.android.launcher3.intent.extra.shortcut.INGORE_LAUNCH_ANIMATION";

    // When starting an action mode, setting this tag will cause the action mode to be cancelled
+1 −25
Original line number Diff line number Diff line
@@ -1634,30 +1634,6 @@ public class Launcher extends BaseDraggingActivity
        }
    }

    /**
     * Event handler for the wallpaper picker button that appears after a long press
     * on the home screen.
     */
    public void onClickWallpaperPicker(View v) {
        if (!Utilities.isWallpaperAllowed(this)) {
            Toast.makeText(this, R.string.msg_disabled_by_admin, Toast.LENGTH_SHORT).show();
            return;
        }
        int pageScroll = mWorkspace.getScrollForPage(mWorkspace.getPageNearestToCenterOfScreen());
        float offset = mWorkspace.mWallpaperOffset.wallpaperOffsetForScroll(pageScroll);
        Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER)
                .putExtra(Utilities.EXTRA_WALLPAPER_OFFSET, offset);

        String pickerPackage = getString(R.string.wallpaper_picker_package);
        if (!TextUtils.isEmpty(pickerPackage)) {
            intent.setPackage(pickerPackage);
        } else {
            // If there is no target package, use the default intent chooser animation
            intent.putExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION, true);
        }
        startActivitySafely(v, intent, null);
    }

    @TargetApi(Build.VERSION_CODES.M)
    @Override
    public ActivityOptions getActivityLaunchOptions(View v, boolean useDefaultLaunchOptions) {
@@ -2415,7 +2391,7 @@ public class Launcher extends BaseDraggingActivity

                // Setting the touch point to (-1, -1) will show the options popup in the center of
                // the screen.
                OptionsPopupView.show(this, -1, -1);
                OptionsPopupView.showDefaultOptions(this, -1, -1);
            }
            return true;
        }
+5 −0
Original line number Diff line number Diff line
@@ -349,6 +349,11 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
        }
    }

    public float getWallpaperOffsetForCenterPage() {
        int pageScroll = getScrollForPage(getPageNearestToCenterOfScreen());
        return mWallpaperOffset.wallpaperOffsetForScroll(pageScroll);
    }

    public Rect estimateItemPosition(CellLayout cl, int hCell, int vCell, int hSpan, int vSpan) {
        Rect r = new Rect();
        cl.cellToRect(hCell, vCell, hSpan, vSpan, r);
Loading