Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
72
gaia/apps/settings/js/panels/sound/panel.js
Executable file
72
gaia/apps/settings/js/panels/sound/panel.js
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* Used to show Personalization/Sound panel
|
||||
*/
|
||||
define(function(require) {
|
||||
'use strict';
|
||||
|
||||
var SettingsPanel = require('modules/settings_panel');
|
||||
var VolumeManager = require('panels/sound/volume_manager');
|
||||
var ToneManager = require('panels/sound/tone_manager');
|
||||
var LazyLoader = require('shared/lazy_loader');
|
||||
var NetworkInfo = require('modules/mobile/supported_network_info');
|
||||
|
||||
return function ctor_sound_panel() {
|
||||
var volumeManager = VolumeManager();
|
||||
var toneManager = ToneManager();
|
||||
|
||||
return SettingsPanel({
|
||||
onInit: function(panel) {
|
||||
var _elements = {
|
||||
vibrationSetting: panel.querySelector('.vibration-setting'),
|
||||
toneSelector: panel.querySelector('.touch-tone-selector')
|
||||
};
|
||||
this._customize(_elements);
|
||||
|
||||
var vmElements = {
|
||||
media: panel.querySelector('.volume.media input'),
|
||||
notification: panel.querySelector('.volume.notification input'),
|
||||
alarm: panel.querySelector('.volume.alarm input')
|
||||
};
|
||||
volumeManager.init(vmElements);
|
||||
|
||||
var tmElements = {
|
||||
alertToneSelection: panel.querySelector('.alert-tone-selection'),
|
||||
alertToneSelectionDesc:
|
||||
panel.querySelector('.alert-tone-selection .desc'),
|
||||
ringToneSelection: panel.querySelector('.ring-tone-selection'),
|
||||
ringToneSelectionDesc:
|
||||
panel.querySelector('.ring-tone-selection .desc'),
|
||||
ringer: panel.querySelector('.ringer'),
|
||||
manageTones: panel.querySelector('.manage-tones-button')
|
||||
};
|
||||
toneManager.init(tmElements);
|
||||
},
|
||||
|
||||
/**
|
||||
* Change UI based on conditions
|
||||
*/
|
||||
_customize: function(elements) {
|
||||
// Show/hide 'Vibrate' checkbox according to device-features.json
|
||||
LazyLoader.getJSON('/resources/device-features.json')
|
||||
.then(function(data) {
|
||||
elements.vibrationSetting.hidden = !data.vibration;
|
||||
});
|
||||
|
||||
|
||||
// Show/hide tone selector based on mozMobileConnections
|
||||
if (window.navigator.mozMobileConnections) {
|
||||
var mobileConnections = window.navigator.mozMobileConnections;
|
||||
// Show the touch tone selector if and only if we're on a CDMA network
|
||||
var toneSelector = elements.toneSelector;
|
||||
Array.prototype.forEach.call(mobileConnections,
|
||||
function(mobileConnection) {
|
||||
NetworkInfo.getSupportedNetworkInfo(mobileConnection,
|
||||
function(result) {
|
||||
toneSelector.hidden = toneSelector.hidden && !result.cdma;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
Loading…
Reference in a new issue