diff options
-rw-r--r-- | api/cm_current.txt | 2 | ||||
-rw-r--r-- | src/java/cyanogenmod/app/CustomTile.java | 27 | ||||
-rw-r--r-- | system-api/cm_system-current.txt | 2 |
3 files changed, 30 insertions, 1 deletions
diff --git a/api/cm_current.txt b/api/cm_current.txt index 93d868d..ab82c67 100644 --- a/api/cm_current.txt +++ b/api/cm_current.txt @@ -17,6 +17,7 @@ package cyanogenmod.app { method public int describeContents(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<cyanogenmod.app.CustomTile> CREATOR; + field public boolean collapsePanel; field public java.lang.String contentDescription; field public cyanogenmod.app.CustomTile.ExpandedStyle expandedStyle; field public int icon; @@ -38,6 +39,7 @@ package cyanogenmod.app { method public cyanogenmod.app.CustomTile.Builder setOnClickIntent(android.app.PendingIntent); method public cyanogenmod.app.CustomTile.Builder setOnClickUri(android.net.Uri); method public cyanogenmod.app.CustomTile.Builder setOnSettingsClickIntent(android.content.Intent); + method public cyanogenmod.app.CustomTile.Builder shouldCollapsePanel(boolean); } public static class CustomTile.ExpandedGridItem extends cyanogenmod.app.CustomTile.ExpandedItem { diff --git a/src/java/cyanogenmod/app/CustomTile.java b/src/java/cyanogenmod/app/CustomTile.java index 3578a66..02811c3 100644 --- a/src/java/cyanogenmod/app/CustomTile.java +++ b/src/java/cyanogenmod/app/CustomTile.java @@ -83,6 +83,13 @@ public class CustomTile implements Parcelable { public ExpandedStyle expandedStyle; /** + * Boolean that forces the status bar panel to collapse when a user clicks on the + * {@link CustomTile} + * By default {@link #collapsePanel} is true + */ + public boolean collapsePanel = true; + + /** * Unflatten the CustomTile from a parcel. */ public CustomTile(Parcel parcel) { @@ -119,6 +126,7 @@ public class CustomTile implements Parcelable { if (parcelableVersion >= Build.CM_VERSION_CODES.BOYSENBERRY) { this.resourcesPackageName = parcel.readString(); + this.collapsePanel = (parcel.readInt() == 1); } parcel.setDataPosition(startPosition + parcelableSize); @@ -149,7 +157,6 @@ public class CustomTile implements Parcelable { public String toString() { StringBuilder b = new StringBuilder(); String NEW_LINE = System.getProperty("line.separator"); - b.append("resourcesPackageName=" + resourcesPackageName + NEW_LINE); if (onClickUri != null) { b.append("onClickUri=" + onClickUri.toString() + NEW_LINE); } @@ -168,7 +175,10 @@ public class CustomTile implements Parcelable { if (expandedStyle != null) { b.append("expandedStyle=" + expandedStyle + NEW_LINE); } + b.append("icon=" + icon + NEW_LINE); + b.append("resourcesPackageName=" + resourcesPackageName + NEW_LINE); + b.append("collapsePanel=" + collapsePanel + NEW_LINE); return b.toString(); } @@ -185,6 +195,7 @@ public class CustomTile implements Parcelable { that.contentDescription = this.contentDescription; that.expandedStyle = this.expandedStyle; that.icon = this.icon; + that.collapsePanel = this.collapsePanel; } @Override @@ -245,6 +256,7 @@ public class CustomTile implements Parcelable { // ==== BOYSENBERRY ===== out.writeString(resourcesPackageName); + out.writeInt(collapsePanel ? 1 : 0); // Go back and write size int parcelableSize = out.dataPosition() - startPosition; @@ -730,6 +742,7 @@ public class CustomTile implements Parcelable { private int mIcon; private Context mContext; private ExpandedStyle mExpandedStyle; + private boolean mCollapsePanel; /** * Constructs a new Builder with the defaults: @@ -835,6 +848,17 @@ public class CustomTile implements Parcelable { } /** + * Set whether or not the Statusbar Panel should be collapsed when an + * {@link #onClick} or {@link #onClickUri} event is fired. + * @param bool + * @return {@link cyanogenmod.app.CustomTile.Builder} + */ + public Builder shouldCollapsePanel(boolean bool) { + mCollapsePanel = bool; + return this; + } + + /** * Create a {@link cyanogenmod.app.CustomTile} object * @return {@link cyanogenmod.app.CustomTile} */ @@ -848,6 +872,7 @@ public class CustomTile implements Parcelable { tile.contentDescription = mContentDescription; tile.expandedStyle = mExpandedStyle; tile.icon = mIcon; + tile.collapsePanel = mCollapsePanel; return tile; } } diff --git a/system-api/cm_system-current.txt b/system-api/cm_system-current.txt index 93d868d..ab82c67 100644 --- a/system-api/cm_system-current.txt +++ b/system-api/cm_system-current.txt @@ -17,6 +17,7 @@ package cyanogenmod.app { method public int describeContents(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<cyanogenmod.app.CustomTile> CREATOR; + field public boolean collapsePanel; field public java.lang.String contentDescription; field public cyanogenmod.app.CustomTile.ExpandedStyle expandedStyle; field public int icon; @@ -38,6 +39,7 @@ package cyanogenmod.app { method public cyanogenmod.app.CustomTile.Builder setOnClickIntent(android.app.PendingIntent); method public cyanogenmod.app.CustomTile.Builder setOnClickUri(android.net.Uri); method public cyanogenmod.app.CustomTile.Builder setOnSettingsClickIntent(android.content.Intent); + method public cyanogenmod.app.CustomTile.Builder shouldCollapsePanel(boolean); } public static class CustomTile.ExpandedGridItem extends cyanogenmod.app.CustomTile.ExpandedItem { |