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

Commit 1917334c authored by Flavio Fiszman's avatar Flavio Fiszman
Browse files

Handle width and height options in Tile previews

Change-Id: Id960248ec8438ed26a2cbf30ddbddce1b87bfc15
Bug: 179988318
Test: manual
parent 10cbd1f1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ public class PeopleProvider extends ContentProvider {
                : Dependency.get(NotificationEntryManager.class);

        RemoteViews view = PeopleSpaceUtils.getPreview(getContext(), mPeopleManager, mLauncherApps,
                mNotificationEntryManager, shortcutId, userHandle, packageName);
                mNotificationEntryManager, shortcutId, userHandle, packageName, extras);
        if (view == null) {
            if (DEBUG) Log.d(TAG, "No preview available for shortcutId: " + shortcutId);
            return null;
+2 −3
Original line number Diff line number Diff line
@@ -619,7 +619,7 @@ public class PeopleSpaceUtils {
     */
    public static RemoteViews getPreview(Context context, IPeopleManager peopleManager,
            LauncherApps launcherApps, NotificationEntryManager notificationEntryManager,
            String shortcutId, UserHandle userHandle, String packageName) {
            String shortcutId, UserHandle userHandle, String packageName, Bundle options) {
        peopleManager = (peopleManager != null) ? peopleManager : IPeopleManager.Stub.asInterface(
                ServiceManager.getService(Context.PEOPLE_SERVICE));
        launcherApps = (launcherApps != null) ? launcherApps
@@ -646,8 +646,7 @@ public class PeopleSpaceUtils {
                context, tile, notificationEntryManager);

        if (DEBUG) Log.i(TAG, "Returning tile preview for shortcutId: " + shortcutId);
        Bundle bundle = new Bundle();
        return new PeopleTileViewHelper(context, augmentedTile, 0, bundle).getViews();
        return new PeopleTileViewHelper(context, augmentedTile, 0, options).getViews();
    }

    /** Returns the userId associated with a {@link PeopleSpaceTile} */
+2 −2
Original line number Diff line number Diff line
@@ -764,12 +764,12 @@ public class PeopleSpaceWidgetManager {
     * Builds a request to pin a People Tile app widget, with a preview and storing necessary
     * information as the callback.
     */
    public boolean requestPinAppWidget(ShortcutInfo shortcutInfo) {
    public boolean requestPinAppWidget(ShortcutInfo shortcutInfo, Bundle options) {
        if (DEBUG) Log.d(TAG, "Requesting pin widget, shortcutId: " + shortcutInfo.getId());

        RemoteViews widgetPreview = PeopleSpaceUtils.getPreview(mContext, mIPeopleManager,
                mLauncherApps, mNotificationEntryManager, shortcutInfo.getId(),
                shortcutInfo.getUserHandle(), shortcutInfo.getPackage());
                shortcutInfo.getUserHandle(), shortcutInfo.getPackage(), options);
        if (widgetPreview == null) {
            Log.w(TAG, "Skipping pinning widget: no tile for shortcutId: " + shortcutInfo.getId());
            return false;
+2 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.content.pm.ShortcutInfo;
import android.content.pm.ShortcutManager;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
import android.os.UserHandle;
@@ -181,7 +182,7 @@ public class NotificationConversationInfo extends LinearLayout implements
            showPriorityOnboarding();
        } else if (mSelectedAction == ACTION_FAVORITE && getPriority() != mSelectedAction) {
            mShadeController.animateCollapsePanels();
            mPeopleSpaceWidgetManager.requestPinAppWidget(mShortcutInfo);
            mPeopleSpaceWidgetManager.requestPinAppWidget(mShortcutInfo, new Bundle());
        }
        mGutsContainer.closeControls(v, true);
    };
+2 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.graphics.PixelFormat
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.os.Bundle
import android.text.SpannableStringBuilder
import android.text.style.BulletSpan
import android.view.Gravity
@@ -86,7 +87,7 @@ class PriorityOnboardingDialogController @Inject constructor(
        Prefs.putBoolean(context, Prefs.Key.HAS_SEEN_PRIORITY_ONBOARDING_IN_S, true)
        dialog.dismiss()
        shadeController.animateCollapsePanels()
        peopleSpaceWidgetManager.requestPinAppWidget(shortcutInfo)
        peopleSpaceWidgetManager.requestPinAppWidget(shortcutInfo, Bundle())
    }

    private fun settings() {
Loading