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 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 Diff line number Diff line
@@ -22,18 +22,28 @@
    android:layout_height="match_parent">

    <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:layout_width="match_parent"
        android:layout_height="wrap_content" />

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

        <include
            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
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
+4 −1
Original line number 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
                // app was updated while we are generating the preview, we use the old version info,
                // 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
                preview = generatePreview(mActivity, mInfo, unusedBitmap, mPreviewWidth, mPreviewHeight);
+9 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.launcher3.compat;

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

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

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

    private ShortcutConfigActivityInfo(ComponentName cn, UserHandle user) {
    protected ShortcutConfigActivityInfo(ComponentName cn, UserHandle user) {
        mCn = cn;
        mUser = user;
    }
@@ -84,6 +84,14 @@ public abstract class ShortcutConfigActivityInfo {
        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 {

        private final ActivityInfo mInfo;
Loading