Home | History | Annotate | Download | only in utils
      1 /*
      2  * Copyright (C) 2014 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 package android.hardware.camera2.utils;
     17 
     18 import android.os.Parcel;
     19 import android.os.Parcelable;
     20 
     21 /**
     22  * @hide
     23  */
     24 public class LongParcelable implements Parcelable {
     25     private long number;
     26 
     27     public LongParcelable() {
     28         this.number = 0;
     29     }
     30 
     31     public LongParcelable(long number) {
     32         this.number = number;
     33     }
     34 
     35     public static final Parcelable.Creator<LongParcelable> CREATOR =
     36             new Parcelable.Creator<LongParcelable>() {
     37         @Override
     38         public LongParcelable createFromParcel(Parcel in) {
     39             return new LongParcelable(in);
     40         }
     41 
     42         @Override
     43         public LongParcelable[] newArray(int size) {
     44             return new LongParcelable[size];
     45         }
     46     };
     47 
     48     private LongParcelable(Parcel in) {
     49         readFromParcel(in);
     50     }
     51 
     52     @Override
     53     public int describeContents() {
     54         return 0;
     55     }
     56 
     57     @Override
     58     public void writeToParcel(Parcel dest, int flags) {
     59         dest.writeLong(number);
     60     }
     61 
     62     public void readFromParcel(Parcel in) {
     63         number = in.readLong();
     64     }
     65 
     66     public long getNumber() {
     67         return number;
     68     }
     69 
     70     public void setNumber(long number) {
     71         this.number = number;
     72     }
     73 
     74 }
     75