Home | History | Annotate | Download | only in ui
      1 /*
      2  * Copyright (C) 2012 Google Inc.
      3  * Licensed to The Android Open Source Project.
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 package com.android.mail.ui;
     18 
     19 import android.os.Parcel;
     20 import android.os.Parcelable;
     21 
     22 import com.android.mail.providers.Conversation;
     23 
     24 public class LeaveBehindData implements Parcelable {
     25     final Conversation data;
     26     final ToastBarOperation op;
     27     final int height;
     28 
     29     public LeaveBehindData(Conversation conv, ToastBarOperation undoOp, int height) {
     30         data = conv;
     31         op = undoOp;
     32         this.height = height;
     33     }
     34 
     35     @Override
     36     public int describeContents() {
     37         return 0;
     38     }
     39 
     40     @Override
     41     public void writeToParcel(Parcel arg, int flags) {
     42         arg.writeParcelable(data, 0);
     43         arg.writeParcelable(op, 0);
     44         arg.writeInt(height);
     45     }
     46 
     47     private LeaveBehindData(Parcel arg, ClassLoader loader) {
     48         data = arg.readParcelable(loader);
     49         op = arg.readParcelable(loader);
     50         height = arg.readInt();
     51     }
     52 
     53     public static final ClassLoaderCreator<LeaveBehindData> CREATOR =
     54             new ClassLoaderCreator<LeaveBehindData>() {
     55 
     56         @Override
     57         public LeaveBehindData createFromParcel(Parcel source) {
     58             return new LeaveBehindData(source, null);
     59         }
     60 
     61         @Override
     62         public LeaveBehindData createFromParcel(Parcel source, ClassLoader loader) {
     63             return new LeaveBehindData(source, loader);
     64         }
     65 
     66         @Override
     67         public LeaveBehindData[] newArray(int size) {
     68             return new LeaveBehindData[size];
     69         }
     70 
     71     };
     72 }