导航菜单

页面标题

页面副标题

Tasker v6.5.11 - CustomTile.java 源代码

正在查看: Tasker v6.5.11 应用的 CustomTile.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package cyanogenmod.app;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
import android.widget.RemoteViews;
import java.util.ArrayList;

public class CustomTile implements Parcelable {
    public static final Parcelable.Creator<CustomTile> CREATOR = new a();
    public static final int PSEUDO_GRID_ITEM_MAX_COUNT = 9;
    public boolean collapsePanel;
    public String contentDescription;
    public PendingIntent deleteIntent;
    public ExpandedStyle expandedStyle;
    private String i;
    public int icon;
    public String label;
    public PendingIntent onClick;
    public Uri onClickUri;
    public Intent onSettingsClick;
    public Bitmap remoteIcon;

    public static class Builder {
        private PendingIntent a;
        private Intent b;
        private Uri c;
        private String d;
        private String e;
        private int f;
        private Bitmap g;
        private Context h;
        private ExpandedStyle i;
        private boolean j = true;
        private PendingIntent k;

        public Builder(Context context) {
            this.h = context;
        }

        public CustomTile build() {
            CustomTile customTile = new CustomTile();
            customTile.i = this.h.getPackageName();
            customTile.onClick = this.a;
            customTile.onSettingsClick = this.b;
            customTile.onClickUri = this.c;
            customTile.label = this.d;
            customTile.contentDescription = this.e;
            customTile.expandedStyle = this.i;
            customTile.icon = this.f;
            customTile.collapsePanel = this.j;
            customTile.remoteIcon = this.g;
            customTile.deleteIntent = this.k;
            return customTile;
        }

        public Builder setContentDescription(String str) {
            this.e = str;
            return this;
        }

        public Builder setDeleteIntent(PendingIntent pendingIntent) {
            this.k = pendingIntent;
            return this;
        }

        public Builder setExpandedStyle(ExpandedStyle expandedStyle) {
            if (this.i != expandedStyle) {
                this.i = expandedStyle;
                if (expandedStyle != null) {
                    expandedStyle.setBuilder(this);
                }
            }
            return this;
        }

        public Builder setIcon(int i) {
            this.f = i;
            return this;
        }

        public Builder setLabel(String str) {
            this.d = str;
            return this;
        }

        public Builder setOnClickIntent(PendingIntent pendingIntent) {
            this.a = pendingIntent;
            return this;
        }

        public Builder setOnClickUri(Uri uri) {
            this.c = uri;
            return this;
        }

        public Builder setOnSettingsClickIntent(Intent intent) {
            this.b = intent;
            return this;
        }

        public Builder shouldCollapsePanel(boolean z) {
            this.j = z;
            return this;
        }

        public Builder setContentDescription(int i) {
            this.e = this.h.getString(i);
            return this;
        }

        public Builder setIcon(Bitmap bitmap) {
            this.f = 0;
            this.g = bitmap;
            return this;
        }

        public Builder setLabel(int i) {
            this.d = this.h.getString(i);
            return this;
        }
    }

    public static class ExpandedGridItem extends ExpandedItem {
        public ExpandedGridItem() {
            super((a) null);
        }

        public void setExpandedGridItemBitmap(Bitmap bitmap) {
            a(bitmap);
        }

        public void setExpandedGridItemDrawable(int i) {
            b(i);
        }

        public void setExpandedGridItemOnClickIntent(PendingIntent pendingIntent) {
            e(pendingIntent);
        }

        public void setExpandedGridItemTitle(String str) {
            d(str);
        }
    }

    public static class ExpandedItem implements Parcelable {
        public static final Parcelable.Creator<ExpandedItem> CREATOR = new a();
        public Bitmap itemBitmapResource;
        public int itemDrawableResourceId;
        public String itemSummary;
        public String itemTitle;
        public PendingIntent onClickPendingIntent;

        static class a implements Parcelable.Creator<ExpandedItem> {
            a() {
            }

            @Override
            public ExpandedItem createFromParcel(Parcel parcel) {
                return new ExpandedItem(parcel);
            }

            @Override
            public ExpandedItem[] newArray(int i) {
                return new ExpandedItem[i];
            }
        }

        ExpandedItem(a aVar) {
            this();
        }

        protected void a(Bitmap bitmap) {
            this.itemBitmapResource = bitmap;
        }

        protected void b(int i) {
            this.itemDrawableResourceId = i;
        }

        protected void c(String str) {
            this.itemSummary = str;
        }

        protected void d(String str) {
            this.itemTitle = str;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        protected void e(PendingIntent pendingIntent) {
            this.onClickPendingIntent = pendingIntent;
        }

        public String toString() {
            StringBuilder sb = new StringBuilder();
            String property = System.getProperty("line.separator");
            if (this.onClickPendingIntent != null) {
                sb.append("onClickPendingIntent= " + this.onClickPendingIntent.toString() + property);
            }
            if (this.itemTitle != null) {
                sb.append("itemTitle= " + this.itemTitle.toString() + property);
            }
            if (this.itemSummary != null) {
                sb.append("itemSummary= " + this.itemSummary.toString() + property);
            }
            sb.append("itemDrawableResourceId=" + this.itemDrawableResourceId + property);
            if (this.itemBitmapResource != null) {
                sb.append("itemBitmapResource=" + this.itemBitmapResource.getGenerationId() + property);
            }
            return sb.toString();
        }

        @Override
        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeInt(2);
            int dataPosition = parcel.dataPosition();
            parcel.writeInt(0);
            int dataPosition2 = parcel.dataPosition();
            if (this.onClickPendingIntent != null) {
                parcel.writeInt(1);
                this.onClickPendingIntent.writeToParcel(parcel, 0);
            } else {
                parcel.writeInt(0);
            }
            if (TextUtils.isEmpty(this.itemTitle)) {
                parcel.writeInt(0);
            } else {
                parcel.writeInt(1);
                parcel.writeString(this.itemTitle);
            }
            if (TextUtils.isEmpty(this.itemSummary)) {
                parcel.writeInt(0);
            } else {
                parcel.writeInt(1);
                parcel.writeString(this.itemSummary);
            }
            parcel.writeInt(this.itemDrawableResourceId);
            if (this.itemBitmapResource != null) {
                parcel.writeInt(1);
                this.itemBitmapResource.writeToParcel(parcel, 0);
            } else {
                parcel.writeInt(0);
            }
            int dataPosition3 = parcel.dataPosition() - dataPosition2;
            parcel.setDataPosition(dataPosition);
            parcel.writeInt(dataPosition3);
            parcel.setDataPosition(dataPosition2 + dataPosition3);
        }

        private ExpandedItem() {
            this.itemSummary = null;
        }

        protected ExpandedItem(Parcel parcel) {
            this.itemSummary = null;
            int readInt = parcel.readInt();
            int readInt2 = parcel.readInt();
            int dataPosition = parcel.dataPosition();
            if (readInt >= 1) {
                if (parcel.readInt() != 0) {
                    this.onClickPendingIntent = (PendingIntent) PendingIntent.CREATOR.createFromParcel(parcel);
                }
                if (parcel.readInt() != 0) {
                    this.itemTitle = parcel.readString();
                }
                if (parcel.readInt() != 0) {
                    this.itemSummary = parcel.readString();
                }
                this.itemDrawableResourceId = parcel.readInt();
            }
            if (readInt >= 2 && parcel.readInt() != 0) {
                this.itemBitmapResource = (Bitmap) Bitmap.CREATOR.createFromParcel(parcel);
            }
            parcel.setDataPosition(dataPosition + readInt2);
        }
    }

    public static class ExpandedListItem extends ExpandedItem {
        public ExpandedListItem() {
            super((a) null);
        }

        public void setExpandedListItemBitmap(Bitmap bitmap) {
            a(bitmap);
        }

        public void setExpandedListItemDrawable(int i) {
            b(i);
        }

        public void setExpandedListItemOnClickIntent(PendingIntent pendingIntent) {
            e(pendingIntent);
        }

        public void setExpandedListItemSummary(String str) {
            c(str);
        }

        public void setExpandedListItemTitle(String str) {
            d(str);
        }
    }

    public static class ExpandedStyle implements Parcelable {
        public static final Parcelable.Creator<ExpandedStyle> CREATOR = new a();
        public static final int GRID_STYLE = 0;
        public static final int LIST_STYLE = 1;
        public static final int NO_STYLE = -1;
        public static final int REMOTE_STYLE = 2;
        private RemoteViews i;
        private ExpandedItem[] q;
        private int r;

        static class a implements Parcelable.Creator<ExpandedStyle> {
            a() {
            }

            @Override
            public ExpandedStyle createFromParcel(Parcel parcel) {
                return new ExpandedStyle(parcel, null);
            }

            @Override
            public ExpandedStyle[] newArray(int i) {
                return new ExpandedStyle[i];
            }
        }

        ExpandedStyle(Parcel parcel, a aVar) {
            this(parcel);
        }

        protected void a(ArrayList<? extends ExpandedItem> arrayList) {
            if (this.r == 0 && arrayList.size() > 9) {
                Log.w(CustomTile.class.getName(), "Attempted to publish greater than max grid item count");
            }
            ExpandedItem[] expandedItemArr = new ExpandedItem[arrayList.size()];
            this.q = expandedItemArr;
            arrayList.toArray(expandedItemArr);
        }

        protected void b(RemoteViews remoteViews) {
            this.i = remoteViews;
        }

        protected void c(int i) {
            this.r = i;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        public RemoteViews getContentViews() {
            return this.i;
        }

        public ExpandedItem[] getExpandedItems() {
            return this.q;
        }

        public int getStyle() {
            return this.r;
        }

        public void setBuilder(Builder builder) {
            if (builder != null) {
                builder.setExpandedStyle(this);
            }
        }

        public String toString() {
            StringBuilder sb = new StringBuilder();
            String property = System.getProperty("line.separator");
            if (this.q != null) {
                sb.append("expandedItems= " + property);
                for (ExpandedItem expandedItem : this.q) {
                    sb.append("     item=" + expandedItem.toString() + property);
                }
            }
            sb.append("styleId=" + this.r + property);
            return sb.toString();
        }

        @Override
        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeInt(2);
            int dataPosition = parcel.dataPosition();
            parcel.writeInt(0);
            int dataPosition2 = parcel.dataPosition();
            if (this.q != null) {
                parcel.writeInt(1);
                parcel.writeTypedArray(this.q, 0);
            } else {
                parcel.writeInt(0);
            }
            parcel.writeInt(this.r);
            if (this.i != null) {
                parcel.writeInt(1);
                this.i.writeToParcel(parcel, 0);
            } else {
                parcel.writeInt(0);
            }
            int dataPosition3 = parcel.dataPosition() - dataPosition2;
            parcel.setDataPosition(dataPosition);
            parcel.writeInt(dataPosition3);
            parcel.setDataPosition(dataPosition2 + dataPosition3);
        }

        ExpandedStyle(a aVar) {
            this();
        }

        private ExpandedStyle() {
            this.r = -1;
        }

        private ExpandedStyle(Parcel parcel) {
            int readInt = parcel.readInt();
            int readInt2 = parcel.readInt();
            int dataPosition = parcel.dataPosition();
            if (readInt >= 1) {
                if (parcel.readInt() != 0) {
                    this.q = (ExpandedItem[]) parcel.createTypedArray(ExpandedItem.CREATOR);
                }
                this.r = parcel.readInt();
            }
            if (readInt >= 2 && parcel.readInt() != 0) {
                this.i = (RemoteViews) RemoteViews.CREATOR.createFromParcel(parcel);
            }
            parcel.setDataPosition(dataPosition + readInt2);
        }
    }

    public static class GridExpandedStyle extends ExpandedStyle {
        public GridExpandedStyle() {
            super((a) null);
            c(0);
        }

        public void setGridItems(ArrayList<ExpandedGridItem> arrayList) {
            a(arrayList);
        }
    }

    public static class ListExpandedStyle extends ExpandedStyle {
        public ListExpandedStyle() {
            super((a) null);
            c(1);
        }

        public void setListItems(ArrayList<ExpandedListItem> arrayList) {
            a(arrayList);
        }
    }

    public static class RemoteExpandedStyle extends ExpandedStyle {
        public RemoteExpandedStyle() {
            super((a) null);
            c(2);
        }

        public void setRemoteViews(RemoteViews remoteViews) {
            b(remoteViews);
        }
    }

    static class a implements Parcelable.Creator<CustomTile> {
        a() {
        }

        @Override
        public CustomTile createFromParcel(Parcel parcel) {
            return new CustomTile(parcel);
        }

        @Override
        public CustomTile[] newArray(int i) {
            return new CustomTile[i];
        }
    }

    public CustomTile(Parcel parcel) {
        this.i = "";
        this.collapsePanel = true;
        int readInt = parcel.readInt();
        int readInt2 = parcel.readInt();
        int dataPosition = parcel.dataPosition();
        if (readInt >= 1) {
            if (parcel.readInt() != 0) {
                this.onClick = (PendingIntent) PendingIntent.CREATOR.createFromParcel(parcel);
            }
            if (parcel.readInt() != 0) {
                this.onSettingsClick = (Intent) Intent.CREATOR.createFromParcel(parcel);
            }
            if (parcel.readInt() != 0) {
                this.onClickUri = (Uri) Uri.CREATOR.createFromParcel(parcel);
            }
            if (parcel.readInt() != 0) {
                this.label = parcel.readString();
            }
            if (parcel.readInt() != 0) {
                this.contentDescription = parcel.readString();
            }
            if (parcel.readInt() != 0) {
                this.expandedStyle = ExpandedStyle.CREATOR.createFromParcel(parcel);
            }
            this.icon = parcel.readInt();
        }
        if (readInt >= 2) {
            this.i = parcel.readString();
            this.collapsePanel = parcel.readInt() == 1;
            if (parcel.readInt() != 0) {
                this.remoteIcon = (Bitmap) Bitmap.CREATOR.createFromParcel(parcel);
            }
            if (parcel.readInt() != 0) {
                this.deleteIntent = (PendingIntent) PendingIntent.CREATOR.createFromParcel(parcel);
            }
        }
        parcel.setDataPosition(dataPosition + readInt2);
    }

    public void cloneInto(CustomTile customTile) {
        customTile.i = this.i;
        customTile.onClick = this.onClick;
        customTile.onSettingsClick = this.onSettingsClick;
        customTile.onClickUri = this.onClickUri;
        customTile.label = this.label;
        customTile.contentDescription = this.contentDescription;
        customTile.expandedStyle = this.expandedStyle;
        customTile.icon = this.icon;
        customTile.collapsePanel = this.collapsePanel;
        customTile.remoteIcon = this.remoteIcon;
        customTile.deleteIntent = this.deleteIntent;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public String getResourcesPackageName() {
        return this.i;
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        String property = System.getProperty("line.separator");
        if (this.onClickUri != null) {
            sb.append("onClickUri=" + this.onClickUri.toString() + property);
        }
        if (this.onClick != null) {
            sb.append("onClick=" + this.onClick.toString() + property);
        }
        if (this.onSettingsClick != null) {
            sb.append("onSettingsClick=" + this.onSettingsClick.toString() + property);
        }
        if (!TextUtils.isEmpty(this.label)) {
            sb.append("label=" + this.label + property);
        }
        if (!TextUtils.isEmpty(this.contentDescription)) {
            sb.append("contentDescription=" + this.contentDescription + property);
        }
        if (this.expandedStyle != null) {
            sb.append("expandedStyle=" + this.expandedStyle + property);
        }
        sb.append("icon=" + this.icon + property);
        sb.append("resourcesPackageName=" + this.i + property);
        sb.append("collapsePanel=" + this.collapsePanel + property);
        if (this.remoteIcon != null) {
            sb.append("remoteIcon=" + this.remoteIcon.getGenerationId() + property);
        }
        if (this.deleteIntent != null) {
            sb.append("deleteIntent=" + this.deleteIntent.toString() + property);
        }
        return sb.toString();
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(2);
        int dataPosition = parcel.dataPosition();
        parcel.writeInt(0);
        int dataPosition2 = parcel.dataPosition();
        if (this.onClick != null) {
            parcel.writeInt(1);
            this.onClick.writeToParcel(parcel, 0);
        } else {
            parcel.writeInt(0);
        }
        if (this.onSettingsClick != null) {
            parcel.writeInt(1);
            this.onSettingsClick.writeToParcel(parcel, 0);
        } else {
            parcel.writeInt(0);
        }
        if (this.onClickUri != null) {
            parcel.writeInt(1);
            this.onClickUri.writeToParcel(parcel, 0);
        } else {
            parcel.writeInt(0);
        }
        if (this.label != null) {
            parcel.writeInt(1);
            parcel.writeString(this.label);
        } else {
            parcel.writeInt(0);
        }
        if (this.contentDescription != null) {
            parcel.writeInt(1);
            parcel.writeString(this.contentDescription);
        } else {
            parcel.writeInt(0);
        }
        if (this.expandedStyle != null) {
            parcel.writeInt(1);
            this.expandedStyle.writeToParcel(parcel, 0);
        } else {
            parcel.writeInt(0);
        }
        parcel.writeInt(this.icon);
        parcel.writeString(this.i);
        parcel.writeInt(this.collapsePanel ? 1 : 0);
        if (this.remoteIcon != null) {
            parcel.writeInt(1);
            this.remoteIcon.writeToParcel(parcel, 0);
        } else {
            parcel.writeInt(0);
        }
        if (this.deleteIntent != null) {
            parcel.writeInt(1);
            this.deleteIntent.writeToParcel(parcel, 0);
        } else {
            parcel.writeInt(0);
        }
        int dataPosition3 = parcel.dataPosition() - dataPosition2;
        parcel.setDataPosition(dataPosition);
        parcel.writeInt(dataPosition3);
        parcel.setDataPosition(dataPosition2 + dataPosition3);
    }

    public CustomTile m6clone() {
        CustomTile customTile = new CustomTile();
        cloneInto(customTile);
        return customTile;
    }

    public CustomTile() {
        this.i = "";
        this.collapsePanel = true;
    }
}