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

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

Merge "Using WidgetCell in the Pin Item confirmation prompt for a consistent...

Merge "Using WidgetCell in the Pin Item confirmation prompt for a consistent UI Also fixing some platform API changes in PinItemRequestCompat" into ub-launcher3-master
parents 331ade2b 65513ba5
Loading
Loading
Loading
Loading

res/drawable/bg_drag_box.xml

deleted100644 → 0
+0 −25
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2017, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <stroke android:color="?android:attr/colorAccent"
        android:dashGap="2dp"
        android:dashWidth="4dp"
        android:width="1dp" />
</shape>
+17 −7
Original line number Original line Diff line number Diff line
@@ -22,18 +22,28 @@
    android:layout_height="match_parent">
    android:layout_height="match_parent">


    <TextView
    <TextView
        android:padding="16dp"
        android:paddingLeft="16dp"
        android:paddingRight="16dp"
        android:paddingTop="8dp"
        android:paddingBottom="8dp"
        android:text="@string/add_item_request_drag_hint"
        android:text="@string/add_item_request_drag_hint"
        android:layout_width="match_parent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
        android:layout_height="wrap_content" />


    <TextView
    <FrameLayout
        android:theme="@style/WidgetContainerTheme"
        android:layout_width="match_parent"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:background="?android:attr/colorPrimary"
        android:layout_margin="10dp"
        android:layout_height="wrap_content">
        android:gravity="center"

        android:id="@+id/drag_target"
        <include
        android:background="@drawable/bg_drag_box" />
            layout="@layout/widget_cell"
            android:layout_gravity="center_horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/widget_cell" />
    </FrameLayout>

    <LinearLayout
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_height="wrap_content"
+4 −1
Original line number Original line Diff line number Diff line
@@ -592,7 +592,10 @@ public class WidgetPreviewLoader {
                // Fetch the version info before we generate the preview, so that, in-case the
                // Fetch the version info before we generate the preview, so that, in-case the
                // app was updated while we are generating the preview, we use the old version info,
                // app was updated while we are generating the preview, we use the old version info,
                // which would gets re-written next time.
                // which would gets re-written next time.
                mVersions = getPackageVersion(mKey.componentName.getPackageName());
                boolean persistable = mInfo.activityInfo == null
                        || mInfo.activityInfo.isPersistable();
                mVersions = persistable ? getPackageVersion(mKey.componentName.getPackageName())
                        : null;


                // it's not in the db... we need to generate it
                // it's not in the db... we need to generate it
                preview = generatePreview(mActivity, mInfo, unusedBitmap, mPreviewWidth, mPreviewHeight);
                preview = generatePreview(mActivity, mInfo, unusedBitmap, mPreviewWidth, mPreviewHeight);
+9 −2
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.launcher3.compat;
package com.android.launcher3.compat;


import android.appwidget.AppWidgetProviderInfo;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.pm.ShortcutInfo;
import android.content.pm.ShortcutInfo;
import android.os.Bundle;
import android.os.Bundle;
@@ -47,8 +48,14 @@ public class PinItemRequestCompat {
        return (ShortcutInfo) invokeMethod("getShortcutInfo");
        return (ShortcutInfo) invokeMethod("getShortcutInfo");
    }
    }


    public AppWidgetProviderInfo getAppWidgetProviderInfo() {
    public AppWidgetProviderInfo getAppWidgetProviderInfo(Context context) {
        return (AppWidgetProviderInfo) invokeMethod("getAppWidgetProviderInfo");
        try {
            return (AppWidgetProviderInfo) mObject.getClass()
                    .getDeclaredMethod("getAppWidgetProviderInfo", Context.class)
                    .invoke(mObject, context);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    }


    public boolean isValid() {
    public boolean isValid() {
+9 −1
Original line number Original line Diff line number Diff line
@@ -50,7 +50,7 @@ public abstract class ShortcutConfigActivityInfo {
    private final ComponentName mCn;
    private final ComponentName mCn;
    private final UserHandle mUser;
    private final UserHandle mUser;


    private ShortcutConfigActivityInfo(ComponentName cn, UserHandle user) {
    protected ShortcutConfigActivityInfo(ComponentName cn, UserHandle user) {
        mCn = cn;
        mCn = cn;
        mUser = user;
        mUser = user;
    }
    }
@@ -84,6 +84,14 @@ public abstract class ShortcutConfigActivityInfo {
        return false;
        return false;
    }
    }


    /**
     * Returns true if various properties ({@link #getLabel()}, {@link #getFullResIcon}) can
     * be safely persisted.
     */
    public boolean isPersistable() {
        return true;
    }

    static class ShortcutConfigActivityInfoVL extends ShortcutConfigActivityInfo {
    static class ShortcutConfigActivityInfoVL extends ShortcutConfigActivityInfo {


        private final ActivityInfo mInfo;
        private final ActivityInfo mInfo;
Loading