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

Commit b151fe3b authored by Patrick Dubroy's avatar Patrick Dubroy Committed by Android (Google) Code Review
Browse files

Merge "Add a new attribute to allow widgets to specify a preview image."

parents 68d42e38 d2db2a57
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -7555,6 +7555,17 @@
 visibility="public"
>
</field>
<field name="previewImage"
 type="int"
 transient="false"
 volatile="false"
 value="16843541"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="priority"
 type="int"
 transient="false"
+13 −0
Original line number Diff line number Diff line
@@ -111,6 +111,17 @@ public class AppWidgetProviderInfo implements Parcelable {
     */
    public String oldName;
    
    /**
     * A preview of what the AppWidget will look like after it's configured.
     * If not supplied, the AppWidget's icon will be used.
     *
     * <p>This field corresponds to the <code>android:previewImage</code> attribute in
     * the <code>&lt;receiver&gt;</code> element in the AndroidManifest.xml file.
     * 
     * @hide Pending API approval
     */
	public int previewImage;

    public AppWidgetProviderInfo() {
    }

@@ -130,6 +141,7 @@ public class AppWidgetProviderInfo implements Parcelable {
        }
        this.label = in.readString();
        this.icon = in.readInt();
        this.previewImage = in.readInt();
    }


@@ -152,6 +164,7 @@ public class AppWidgetProviderInfo implements Parcelable {
        }
        out.writeString(this.label);
        out.writeInt(this.icon);
        out.writeInt(this.previewImage);
    }

    public int describeContents() {
+3 −0
Original line number Diff line number Diff line
@@ -3585,6 +3585,9 @@
        <!-- A class name in the AppWidget's package to be launched to configure.
             If not supplied, then no activity will be launched. -->
        <attr name="configure" format="string" />
        <!-- A preview of what the AppWidget will look like after it's configured.
       	     If not supplied, the AppWidget's icon will be used. -->
        <attr name="previewImage" format="reference" />
    </declare-styleable>

    <!-- =============================== -->
+1 −0
Original line number Diff line number Diff line
@@ -1299,6 +1299,7 @@
  <public type="attr" name="actionButtonStyle" />
  <public type="attr" name="showAsAction" />
  <public type="attr" name="actionButtonPadding" />
  <public type="attr" name="previewImage" />

  <public type="id" name="home" />

+3 −0
Original line number Diff line number Diff line
@@ -741,6 +741,9 @@ class AppWidgetService extends IAppWidgetService.Stub
            }
            info.label = activityInfo.loadLabel(mPackageManager).toString();
            info.icon = ri.getIconResource();
            info.previewImage = sa.getResourceId(
            		com.android.internal.R.styleable.AppWidgetProviderInfo_previewImage, 0);

            sa.recycle();
        } catch (Exception e) {
            // Ok to catch Exception here, because anything going wrong because