1/*
2 * Copyright (C) 2007 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.telephony.cat;
18
19import android.graphics.Bitmap;
20import android.os.Parcel;
21import android.os.Parcelable;
22
23/**
24 * Container class for CAT GET INPUT, GET IN KEY commands parameters.
25 *
26 */
27public class Input implements Parcelable {
28    public String text;
29    public String defaultText;
30    public Bitmap icon;
31    public int minLen;
32    public int maxLen;
33    public boolean ucs2;
34    public boolean packed;
35    public boolean digitOnly;
36    public boolean echo;
37    public boolean yesNo;
38    public boolean helpAvailable;
39    public Duration duration;
40
41    Input() {
42        text = "";
43        defaultText = null;
44        icon = null;
45        minLen = 0;
46        maxLen = 1;
47        ucs2 = false;
48        packed = false;
49        digitOnly = false;
50        echo = false;
51        yesNo = false;
52        helpAvailable = false;
53        duration = null;
54    }
55
56    private Input(Parcel in) {
57        text = in.readString();
58        defaultText = in.readString();
59        icon = in.readParcelable(null);
60        minLen = in.readInt();
61        maxLen = in.readInt();
62        ucs2 = in.readInt() == 1 ? true : false;
63        packed = in.readInt() == 1 ? true : false;
64        digitOnly = in.readInt() == 1 ? true : false;
65        echo = in.readInt() == 1 ? true : false;
66        yesNo = in.readInt() == 1 ? true : false;
67        helpAvailable = in.readInt() == 1 ? true : false;
68        duration = in.readParcelable(null);
69    }
70
71    @Override
72    public int describeContents() {
73        return 0;
74    }
75
76    @Override
77    public void writeToParcel(Parcel dest, int flags) {
78        dest.writeString(text);
79        dest.writeString(defaultText);
80        dest.writeParcelable(icon, 0);
81        dest.writeInt(minLen);
82        dest.writeInt(maxLen);
83        dest.writeInt(ucs2 ? 1 : 0);
84        dest.writeInt(packed ? 1 : 0);
85        dest.writeInt(digitOnly ? 1 : 0);
86        dest.writeInt(echo ? 1 : 0);
87        dest.writeInt(yesNo ? 1 : 0);
88        dest.writeInt(helpAvailable ? 1 : 0);
89        dest.writeParcelable(duration, 0);
90    }
91
92    public static final Parcelable.Creator<Input> CREATOR = new Parcelable.Creator<Input>() {
93        @Override
94        public Input createFromParcel(Parcel in) {
95            return new Input(in);
96        }
97
98        @Override
99        public Input[] newArray(int size) {
100            return new Input[size];
101        }
102    };
103
104    boolean setIcon(Bitmap Icon) { return true; }
105}