blob: 9d653c1cc6eeeda5d0802f73bf324ec70ca49a99 [file] [log] [blame]
The Android Open Source Project9d9730a2009-03-03 19:32:37 -08001/*
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.stk;
18
19import android.app.Application;
20
Alex Yakavenkad41f1d92010-07-12 14:13:13 -070021import com.android.internal.telephony.cat.Duration;
The Android Open Source Project9d9730a2009-03-03 19:32:37 -080022
23/**
24 * Top-level Application class for STK app.
25 */
26abstract class StkApp extends Application {
27 // Application constants
28 public static final boolean DBG = true;
29
30 // Identifiers for option menu items
31 static final int MENU_ID_END_SESSION = android.view.Menu.FIRST;
32 static final int MENU_ID_BACK = android.view.Menu.FIRST + 1;
33 static final int MENU_ID_HELP = android.view.Menu.FIRST + 2;
34
Christopher.Posselwhite1772c042012-11-22 12:15:54 +010035 // Display Text timeouts
36 static final int DISP_TEXT_CLEAR_AFTER_DELAY_TIMEOUT = (15 * 1000);
37 static final int DISP_TEXT_WAIT_FOR_USER_TIMEOUT = (60 * 1000);
38
39 // UI timeout, 30 seconds - used for menues and input
40 static final int UI_TIMEOUT = (30 * 1000);
The Android Open Source Project9d9730a2009-03-03 19:32:37 -080041
42 // Tone default timeout - 2 seconds
Srikanth Chintala8dbe3852014-03-14 16:26:57 +053043 static final int TONE_DEFAULT_TIMEOUT = (2 * 1000);
The Android Open Source Project9d9730a2009-03-03 19:32:37 -080044
45 public static final String TAG = "STK App";
46
47 /**
48 * This function calculate the time in MS from a duration instance.
49 * returns zero when duration is null.
50 */
51 public static int calculateDurationInMilis(Duration duration) {
52 int timeout = 0;
53 if (duration != null) {
54 switch (duration.timeUnit) {
55 case MINUTE:
56 timeout = 1000 * 60;
57 break;
58 case TENTH_SECOND:
Pierre Frojdc2400df2010-10-05 17:57:33 +020059 timeout = 1000 / 10;
The Android Open Source Project9d9730a2009-03-03 19:32:37 -080060 break;
61 case SECOND:
62 default:
63 timeout = 1000;
64 break;
65 }
66 timeout *= duration.timeInterval;
67 }
68 return timeout;
69 }
70}