The Android Open Source Project | 9d9730a | 2009-03-03 19:32:37 -0800 | [diff] [blame] | 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 | |
| 17 | package com.android.stk; |
| 18 | |
| 19 | import android.app.Application; |
| 20 | |
Alex Yakavenka | d41f1d9 | 2010-07-12 14:13:13 -0700 | [diff] [blame] | 21 | import com.android.internal.telephony.cat.Duration; |
The Android Open Source Project | 9d9730a | 2009-03-03 19:32:37 -0800 | [diff] [blame] | 22 | |
| 23 | /** |
| 24 | * Top-level Application class for STK app. |
| 25 | */ |
| 26 | abstract 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.Posselwhite | 1772c04 | 2012-11-22 12:15:54 +0100 | [diff] [blame] | 35 | // 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 Project | 9d9730a | 2009-03-03 19:32:37 -0800 | [diff] [blame] | 41 | |
| 42 | // Tone default timeout - 2 seconds |
Srikanth Chintala | 8dbe385 | 2014-03-14 16:26:57 +0530 | [diff] [blame] | 43 | static final int TONE_DEFAULT_TIMEOUT = (2 * 1000); |
The Android Open Source Project | 9d9730a | 2009-03-03 19:32:37 -0800 | [diff] [blame] | 44 | |
| 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 Frojd | c2400df | 2010-10-05 17:57:33 +0200 | [diff] [blame] | 59 | timeout = 1000 / 10; |
The Android Open Source Project | 9d9730a | 2009-03-03 19:32:37 -0800 | [diff] [blame] | 60 | break; |
| 61 | case SECOND: |
| 62 | default: |
| 63 | timeout = 1000; |
| 64 | break; |
| 65 | } |
| 66 | timeout *= duration.timeInterval; |
| 67 | } |
| 68 | return timeout; |
| 69 | } |
| 70 | } |