Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
bdbb22bb
Commit
bdbb22bb
authored
13 years ago
by
Jean Chalard
Browse files
Options
Downloads
Patches
Plain Diff
Simplification of sound settings (A4)
Change-Id: I0c6e207bae1e08c45a95b3479e1d67228d696792
parent
2651b17f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java
+8
-12
8 additions, 12 deletions
...roid/inputmethod/latin/AudioAndHapticFeedbackManager.java
with
8 additions
and
12 deletions
java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java
+
8
−
12
View file @
bdbb22bb
...
...
@@ -46,10 +46,9 @@ public class AudioAndHapticFeedbackManager extends BroadcastReceiver {
mLatinIme
=
latinIme
;
mSettingsValues
=
settingsValues
;
mKeyboardSwitcher
=
keyboardSwitcher
;
mSoundOn
=
false
;
mVibrator
=
VibratorCompatWrapper
.
getInstance
(
mLatinIme
);
mAudioManager
=
(
AudioManager
)
mLatinIme
.
getSystemService
(
Context
.
AUDIO_SERVICE
);
updateRingerMode
();
mSoundOn
=
reevaluateIfSoundIsOn
();
}
public
void
hapticAndAudioFeedback
(
final
int
primaryCode
)
{
...
...
@@ -57,23 +56,18 @@ public class AudioAndHapticFeedbackManager extends BroadcastReceiver {
playKeyClick
(
primaryCode
);
}
private
boolean
isSoundOn
()
{
return
mSettingsValues
.
mSoundOn
&&
mSoundOn
;
}
// update flags for silent mode
private
void
updateRingerMode
()
{
private
boolean
reevaluateIfSoundIsOn
()
{
if
(!
mSettingsValues
.
mSoundOn
||
mAudioManager
==
null
)
{
mSoundOn
=
false
;
return
false
;
}
else
{
mSoundOn
=
(
mAudioManager
.
getRingerMode
()
==
AudioManager
.
RINGER_MODE_NORMAL
)
;
return
mAudioManager
.
getRingerMode
()
==
AudioManager
.
RINGER_MODE_NORMAL
;
}
}
private
void
playKeyClick
(
int
primaryCode
)
{
// if mAudioManager is null, we can't play a sound anyway, so return
if
(
mAudioManager
==
null
)
return
;
if
(
is
SoundOn
()
)
{
if
(
m
SoundOn
)
{
final
int
sound
;
switch
(
primaryCode
)
{
case
Keyboard
.
CODE_DELETE
:
...
...
@@ -114,8 +108,10 @@ public class AudioAndHapticFeedbackManager extends BroadcastReceiver {
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
final
String
action
=
intent
.
getAction
();
// The following test is supposedly useless since we only listen for the ringer event.
// Still, it's a good safety measure.
if
(
action
.
equals
(
AudioManager
.
RINGER_MODE_CHANGED_ACTION
))
{
updateRingerMode
();
mSoundOn
=
reevaluateIfSoundIsOn
();
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment