javauis/mmapi_akn/baseline/javasrc/com/nokia/microedition/media/control/VolumeControl.java
equal
deleted
inserted
replaced
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 package com.nokia.microedition.media.control; |
19 package com.nokia.microedition.media.control; |
20 |
20 |
|
21 import com.nokia.mj.impl.rt.support.ApplicationInfo; |
|
22 import com.nokia.mj.impl.utils.Tokenizer; |
|
23 import javax.microedition.media.Player; |
|
24 |
21 public class VolumeControl extends ControlImpl |
25 public class VolumeControl extends ControlImpl |
22 implements javax.microedition.media.control.VolumeControl |
26 implements javax.microedition.media.control.VolumeControl |
23 { |
27 { |
24 private static final int MAX_VOLUME = 100; |
28 private static final int MAX_VOLUME = 100; |
25 private static final int UNDEFINED_VOLUME = -1; |
29 private static final int UNDEFINED_VOLUME = -1; |
26 |
30 private static final String SEPARATOR = ","; |
|
31 private static final String ATTRIB_NOKIA_UI_ENHANCEMENT = |
|
32 "Nokia-UI-Enhancement"; |
|
33 private static final String IGNORE_PROFILES_BASED_SOUNDING = |
|
34 "IgnoreProfilesBasedSoundMuting"; |
27 // these constants come from native side |
35 // these constants come from native side |
28 protected static final int NO_ERROR = 0; // native side returns if OK |
36 protected static final int NO_ERROR = 0; // native side returns if OK |
29 |
37 |
30 private int iLevel; |
38 private int iLevel; |
31 private boolean iMuted; |
39 private boolean iMuted; |
37 |
45 |
38 public boolean isMuted() |
46 public boolean isMuted() |
39 { |
47 { |
40 checkState(); |
48 checkState(); |
41 return iMuted; |
49 return iMuted; |
|
50 } |
|
51 |
|
52 /** |
|
53 * Set handles |
|
54 * @param aPlayer Player instance |
|
55 * @param aEventSource Handle to event source |
|
56 * @param aControlHandle Handle Handle to control |
|
57 */ |
|
58 public void setHandles(Player aPlayer, |
|
59 int aEventSource, |
|
60 int aControlHandle) |
|
61 { |
|
62 super.setHandles(aPlayer, aEventSource, aControlHandle); |
|
63 boolean ignoreProfileBasedSoundMuting = false; |
|
64 String attrib = ApplicationInfo.getInstance().getAttribute( |
|
65 ATTRIB_NOKIA_UI_ENHANCEMENT); |
|
66 String[] parsedAttributes = Tokenizer.split( attrib, SEPARATOR); |
|
67 if (parsedAttributes != null) |
|
68 { |
|
69 for (int i = 0; i < parsedAttributes.length; i++) |
|
70 { |
|
71 if (IGNORE_PROFILES_BASED_SOUNDING.equalsIgnoreCase( |
|
72 parsedAttributes[i])) |
|
73 { |
|
74 ignoreProfileBasedSoundMuting = true; |
|
75 break; |
|
76 } |
|
77 } |
|
78 } |
|
79 if (!ignoreProfileBasedSoundMuting) |
|
80 { |
|
81 int err =_setProfilesBasedSoundMuting(aEventSource, aControlHandle); |
|
82 if (err < NO_ERROR) |
|
83 { |
|
84 throw new Error("Setting profile based sound " + |
|
85 "muting failed" + err); |
|
86 } |
|
87 } |
42 } |
88 } |
43 |
89 |
44 public int getLevel() |
90 public int getLevel() |
45 { |
91 { |
46 checkState(); |
92 checkState(); |
115 } |
161 } |
116 |
162 |
117 private static native int _setLevel(int aEventSource, int aControlHandle, |
163 private static native int _setLevel(int aEventSource, int aControlHandle, |
118 int aLevel); |
164 int aLevel); |
119 private static native int _getLevel(int aEventSource, int aControlHandle); |
165 private static native int _getLevel(int aEventSource, int aControlHandle); |
|
166 |
|
167 private static native int _setProfilesBasedSoundMuting(int aEventSource, |
|
168 int aControlHandle); |
120 } |
169 } |