2 * Copyright (C) 2007 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.internal.telephony.gsm.stk;
19 import android.graphics.Bitmap;
22 * Container class for proactive command parameters.
26 CommandDetails cmdDet;
28 CommandParams(CommandDetails cmdDet) {
32 AppInterface.CommandType getCommandType() {
33 return AppInterface.CommandType.fromInt(cmdDet.typeOfCommand);
36 boolean setIcon(Bitmap icon) { return true; }
39 class DisplayTextParams extends CommandParams {
42 DisplayTextParams(CommandDetails cmdDet, TextMessage textMsg) {
44 this.textMsg = textMsg;
47 boolean setIcon(Bitmap icon) {
48 if (icon != null && textMsg != null) {
56 class LaunchBrowserParams extends CommandParams {
57 TextMessage confirmMsg;
58 LaunchBrowserMode mode;
61 LaunchBrowserParams(CommandDetails cmdDet, TextMessage confirmMsg,
62 String url, LaunchBrowserMode mode) {
64 this.confirmMsg = confirmMsg;
69 boolean setIcon(Bitmap icon) {
70 if (icon != null && confirmMsg != null) {
71 confirmMsg.icon = icon;
78 class PlayToneParams extends CommandParams {
80 ToneSettings settings;
82 PlayToneParams(CommandDetails cmdDet, TextMessage textMsg,
83 Tone tone, Duration duration, boolean vibrate) {
85 this.textMsg = textMsg;
86 this.settings = new ToneSettings(duration, tone, vibrate);
89 boolean setIcon(Bitmap icon) {
90 if (icon != null && textMsg != null) {
98 class CallSetupParams extends CommandParams {
99 TextMessage confirmMsg;
102 CallSetupParams(CommandDetails cmdDet, TextMessage confirmMsg,
103 TextMessage callMsg) {
105 this.confirmMsg = confirmMsg;
106 this.callMsg = callMsg;
109 boolean setIcon(Bitmap icon) {
113 if (confirmMsg != null && confirmMsg.icon == null) {
114 confirmMsg.icon = icon;
116 } else if (callMsg != null && callMsg.icon == null) {
124 class SelectItemParams extends CommandParams {
126 boolean loadTitleIcon = false;
128 SelectItemParams(CommandDetails cmdDet, Menu menu, boolean loadTitleIcon) {
131 this.loadTitleIcon = loadTitleIcon;
134 boolean setIcon(Bitmap icon) {
135 if (icon != null && menu != null) {
136 if (loadTitleIcon && menu.titleIcon == null) {
137 menu.titleIcon = icon;
139 for (Item item : menu.items) {
140 if (item.icon != null) {
153 class GetInputParams extends CommandParams {
156 GetInputParams(CommandDetails cmdDet, Input input) {
161 boolean setIcon(Bitmap icon) {
162 if (icon != null && input != null) {