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.gsm.stk;
18
19import android.graphics.Bitmap;
20import android.os.Parcel;
21import android.os.Parcelable;
22
23/**
24 * Container class for STK 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
40    Input() {
41        text = "";
42        defaultText = null;
43        icon = null;
44        minLen = 0;
45        maxLen = 1;
46        ucs2 = false;
47        packed = false;
48        digitOnly = false;
49        echo = false;
50        yesNo = false;
51        helpAvailable = false;
52    }
53
54    private Input(Parcel in) {
55        text = in.readString();
56        defaultText = in.readString();
57        icon = in.readParcelable(null);
58        minLen = in.readInt();
59        maxLen = in.readInt();
60        ucs2 = in.readInt() == 1 ? true : false;
61        packed = in.readInt() == 1 ? true : false;
62        digitOnly = in.readInt() == 1 ? true : false;
63        echo = in.readInt() == 1 ? true : false;
64        yesNo = in.readInt() == 1 ? true : false;
65        helpAvailable = in.readInt() == 1 ? true : false;
66    }
67
68    public int describeContents() {
69        return 0;
70    }
71
72    public void writeToParcel(Parcel dest, int flags) {
73        dest.writeString(text);
74        dest.writeString(defaultText);
75        dest.writeParcelable(icon, 0);
76        dest.writeInt(minLen);
77        dest.writeInt(maxLen);
78        dest.writeInt(ucs2 ? 1 : 0);
79        dest.writeInt(packed ? 1 : 0);
80        dest.writeInt(digitOnly ? 1 : 0);
81        dest.writeInt(echo ? 1 : 0);
82        dest.writeInt(yesNo ? 1 : 0);
83        dest.writeInt(helpAvailable ? 1 : 0);
84    }
85
86    public static final Parcelable.Creator<Input> CREATOR = new Parcelable.Creator<Input>() {
87        public Input createFromParcel(Parcel in) {
88            return new Input(in);
89        }
90
91        public Input[] newArray(int size) {
92            return new Input[size];
93        }
94    };
95
96    boolean setIcon(Bitmap Icon) { return true; }
97}