2 * Copyright (C) 2008 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.
20 * Constants to be used to play sound effects via {@link View#playSoundEffect(int)}
22 public class SoundEffectConstants {
24 private SoundEffectConstants() {}
26 public static final int CLICK = 0;
28 public static final int NAVIGATION_LEFT = 1;
29 public static final int NAVIGATION_UP = 2;
30 public static final int NAVIGATION_RIGHT = 3;
31 public static final int NAVIGATION_DOWN = 4;
34 * Get the sonification constant for the focus directions.
35 * @param direction One of {@link View#FOCUS_UP}, {@link View#FOCUS_DOWN},
36 * {@link View#FOCUS_LEFT}, {@link View#FOCUS_RIGHT}, {@link View#FOCUS_FORWARD}
37 * or {@link View#FOCUS_BACKWARD}
39 * @return The appropriate sonification constant.
41 public static int getContantForFocusDirection(int direction) {
43 case View.FOCUS_RIGHT:
44 return SoundEffectConstants.NAVIGATION_RIGHT;
45 case View.FOCUS_FORWARD:
47 return SoundEffectConstants.NAVIGATION_DOWN;
49 return SoundEffectConstants.NAVIGATION_LEFT;
50 case View.FOCUS_BACKWARD:
52 return SoundEffectConstants.NAVIGATION_UP;
54 throw new IllegalArgumentException("direction must be one of "
55 + "{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, FOCUS_BACKWARD}.");