1f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban/*
2f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban * Copyright 2014, The Android Open Source Project
3f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban *
4f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban * Licensed under the Apache License, Version 2.0 (the "License");
5f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban * you may not use this file except in compliance with the License.
6f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban * You may obtain a copy of the License at
7f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban *
8f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban *      http://www.apache.org/licenses/LICENSE-2.0
9f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban *
10f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban * Unless required by applicable law or agreed to in writing, software
11f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban * distributed under the License is distributed on an "AS IS" BASIS,
12f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban * See the License for the specific language governing permissions and
14f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban * limitations under the License.
15f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban */
16f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban
17f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Banpackage com.android.internal.util;
18f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban
19f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Banimport android.os.Parcel;
20f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Banimport android.os.Parcelable;
21f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban
22f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban/**
23f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban * Helper class to adapt a simple String to cases where a Parcelable is expected.
24f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban * @hide
25f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban */
26f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Banpublic class ParcelableString implements Parcelable {
27f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban    public String string;
28f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban
29f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban    @Override
30f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban    public int describeContents() {
31f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban        return 0;
32f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban    }
33f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban
34f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban    @Override
35f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban    public void writeToParcel(Parcel out, int flags) {
36f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban        out.writeString(string);
37f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban    }
38f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban
39f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban    public static final Parcelable.Creator<ParcelableString> CREATOR =
40f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban            new Parcelable.Creator<ParcelableString>() {
41f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban                @Override
42f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban                public ParcelableString createFromParcel(Parcel in) {
43f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban                    ParcelableString ret = new ParcelableString();
44f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban                    ret.string = in.readString();
45f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban                    return ret;
46f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban                }
47f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban                @Override
48f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban                public ParcelableString[] newArray(int size) {
49f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban                    return new ParcelableString[size];
50f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban                }
51f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban    };
52f0ae135049048424bceccb0799b12377181b25f0Zoltan Szatmary-Ban}