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    public boolean iconSelfExplanatory;
41
42    Input() {
43        text = "";
44        defaultText = null;
45        icon = null;
46        minLen = 0;
47        maxLen = 1;
48        ucs2 = false;
49        packed = false;
50        digitOnly = false;
51        echo = false;
52        yesNo = false;
53        helpAvailable = false;
54        duration = null;
55        iconSelfExplanatory = false;
56    }
57
58    private Input(Parcel in) {
59        text = in.readString();
60        defaultText = in.readString();
61        icon = in.readParcelable(null);
62        minLen = in.readInt();
63        maxLen = in.readInt();
64        ucs2 = in.readInt() == 1 ? true : false;
65        packed = in.readInt() == 1 ? true : false;
66        digitOnly = in.readInt() == 1 ? true : false;
67        echo = in.readInt() == 1 ? true : false;
68        yesNo = in.readInt() == 1 ? true : false;
69        helpAvailable = in.readInt() == 1 ? true : false;
70        duration = in.readParcelable(null);
71        iconSelfExplanatory = in.readInt() == 1 ? true : false;
72    }
73
74    @Override
75    public int describeContents() {
76        return 0;
77    }
78
79    @Override
80    public void writeToParcel(Parcel dest, int flags) {
81        dest.writeString(text);
82        dest.writeString(defaultText);
83        dest.writeParcelable(icon, 0);
84        dest.writeInt(minLen);
85        dest.writeInt(maxLen);
86        dest.writeInt(ucs2 ? 1 : 0);
87        dest.writeInt(packed ? 1 : 0);
88        dest.writeInt(digitOnly ? 1 : 0);
89        dest.writeInt(echo ? 1 : 0);
90        dest.writeInt(yesNo ? 1 : 0);
91        dest.writeInt(helpAvailable ? 1 : 0);
92        dest.writeParcelable(duration, 0);
93        dest.writeInt(iconSelfExplanatory ? 1 : 0);
94    }
95
96    public static final Parcelable.Creator<Input> CREATOR = new Parcelable.Creator<Input>() {
97        @Override
98        public Input createFromParcel(Parcel in) {
99            return new Input(in);
100        }
101
102        @Override
103        public Input[] newArray(int size) {
104            return new Input[size];
105        }
106    };
107
108    boolean setIcon(Bitmap Icon) { return true; }
109}