StatusBarIcon.java revision 18e69dfc7235f8a4bfe257f9d1c43539049a22ce
1/* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.internal.statusbar; 18 19import android.os.Parcel; 20import android.os.Parcelable; 21 22/** 23 * @hide 24 */ 25public class StatusBarIcon implements Parcelable { 26 public String iconPackage; 27 public int iconId; 28 public int iconLevel; 29 public boolean visible = true; 30 public int number; 31 32 private StatusBarIcon() { 33 } 34 35 public StatusBarIcon(String iconPackage, int iconId, int iconLevel) { 36 this.iconPackage = iconPackage; 37 this.iconId = iconId; 38 this.iconLevel = iconLevel; 39 } 40 41 public String toString() { 42 return "StatusBarIcon(pkg=" + this.iconPackage + " id=0x" + Integer.toHexString(this.iconId) 43 + " level=" + this.iconLevel + " visible=" + visible 44 + " num=" + this.number + " )"; 45 } 46 47 public StatusBarIcon clone() { 48 StatusBarIcon that = new StatusBarIcon(this.iconPackage, this.iconId, this.iconLevel); 49 that.visible = this.visible; 50 that.number = this.number; 51 return that; 52 } 53 54 /** 55 * Unflatten the StatusBarIcon from a parcel. 56 */ 57 public StatusBarIcon(Parcel in) { 58 readFromParcel(in); 59 } 60 61 public void readFromParcel(Parcel in) { 62 this.iconPackage = in.readString(); 63 this.iconId = in.readInt(); 64 this.iconLevel = in.readInt(); 65 this.visible = in.readInt() != 0; 66 this.number = in.readInt(); 67 } 68 69 public void writeToParcel(Parcel out, int flags) { 70 out.writeString(this.iconPackage); 71 out.writeInt(this.iconId); 72 out.writeInt(this.iconLevel); 73 out.writeInt(this.number); 74 } 75 76 public int describeContents() { 77 return 0; 78 } 79 80 /** 81 * Parcelable.Creator that instantiates StatusBarIcon objects 82 */ 83 public static final Parcelable.Creator<StatusBarIcon> CREATOR 84 = new Parcelable.Creator<StatusBarIcon>() 85 { 86 public StatusBarIcon createFromParcel(Parcel parcel) 87 { 88 return new StatusBarIcon(parcel); 89 } 90 91 public StatusBarIcon[] newArray(int size) 92 { 93 return new StatusBarIcon[size]; 94 } 95 }; 96} 97 98