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

Commit a18dbdf4 authored by Joe Onorato's avatar Joe Onorato Committed by Android Git Automerger
Browse files

am 801b63d3: am 51e895f0: Merge "Need to give the AppWidgetHostView the new...

am 801b63d3: am 51e895f0: Merge "Need to give the AppWidgetHostView the new info about the provider, in case the initialLayout changed." into gingerbread

Merge commit '801b63d3'

* commit '801b63d3':
  Need to give the AppWidgetHostView the new info about the provider, in case the initialLayout
parents 038ecb09 801b63d3
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -237,7 +237,7 @@ public class AppWidgetHost {
            v = mViews.get(appWidgetId);
            v = mViews.get(appWidgetId);
        }
        }
        if (v != null) {
        if (v != null) {
            v.updateAppWidget(null, AppWidgetHostView.UPDATE_FLAGS_RESET);
            v.resetAppWidget(appWidget);
        }
        }
    }
    }


@@ -247,7 +247,7 @@ public class AppWidgetHost {
            v = mViews.get(appWidgetId);
            v = mViews.get(appWidgetId);
        }
        }
        if (v != null) {
        if (v != null) {
            v.updateAppWidget(views, 0);
            v.updateAppWidget(views);
        }
        }
    }
    }
}
}
+12 −13
Original line number Original line Diff line number Diff line
@@ -46,8 +46,6 @@ public class AppWidgetHostView extends FrameLayout {
    static final boolean LOGD = false;
    static final boolean LOGD = false;
    static final boolean CROSSFADE = false;
    static final boolean CROSSFADE = false;


    static final int UPDATE_FLAGS_RESET = 0x00000001;

    static final int VIEW_MODE_NOINIT = 0;
    static final int VIEW_MODE_NOINIT = 0;
    static final int VIEW_MODE_CONTENT = 1;
    static final int VIEW_MODE_CONTENT = 1;
    static final int VIEW_MODE_ERROR = 2;
    static final int VIEW_MODE_ERROR = 2;
@@ -147,21 +145,22 @@ public class AppWidgetHostView extends FrameLayout {
        return new FrameLayout.LayoutParams(context, attrs);
        return new FrameLayout.LayoutParams(context, attrs);
    }
    }


    /**
     * Update the AppWidgetProviderInfo for this view, and reset it to the
     * initial layout.
     */
    void resetAppWidget(AppWidgetProviderInfo info) {
        mInfo = info;
        mViewMode = VIEW_MODE_NOINIT;
        updateAppWidget(null);
    }

    /**
    /**
     * Process a set of {@link RemoteViews} coming in as an update from the
     * Process a set of {@link RemoteViews} coming in as an update from the
     * AppWidget provider. Will animate into these new views as needed
     * AppWidget provider. Will animate into these new views as needed
     */
     */
    public void updateAppWidget(RemoteViews remoteViews) {
    public void updateAppWidget(RemoteViews remoteViews) {
        updateAppWidget(remoteViews, 0);
        if (LOGD) Log.d(TAG, "updateAppWidget called mOld=" + mOld);
    }

    void updateAppWidget(RemoteViews remoteViews, int flags) {
        if (LOGD) Log.d(TAG, "updateAppWidget called mOld=" + mOld + " flags=0x"
                + Integer.toHexString(flags));

        if ((flags & UPDATE_FLAGS_RESET) != 0) {
            mViewMode = VIEW_MODE_NOINIT;
        }


        boolean recycled = false;
        boolean recycled = false;
        View content = null;
        View content = null;
+26 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2006 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.
-->

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/oh_hai_text"
    android:layout_width="150dp"
    android:layout_height="150dp"
    android:text="@string/appwidget_view_title"
    android:background="#8fff"
    android:textColor="#000"
    android:textStyle="bold"
/>
+1 −0
Original line number Original line Diff line number Diff line
@@ -41,6 +41,7 @@ public class TestAppWidgetProvider extends BroadcastReceiver {
            Log.d(TAG, "DISABLED");
            Log.d(TAG, "DISABLED");
        }
        }
        else if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)) {
        else if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)) {
            if (true) return;
            Log.d(TAG, "UPDATE");
            Log.d(TAG, "UPDATE");
            Bundle extras = intent.getExtras();
            Bundle extras = intent.getExtras();
            int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
            int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);