diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/main/views/TopToolbarAIR.as b/clients/flash/air-client/src/org/bigbluebutton/air/main/views/TopToolbarAIR.as index 64b691b528..9252334e29 100755 --- a/clients/flash/air-client/src/org/bigbluebutton/air/main/views/TopToolbarAIR.as +++ b/clients/flash/air-client/src/org/bigbluebutton/air/main/views/TopToolbarAIR.as @@ -10,6 +10,8 @@ package org.bigbluebutton.air.main.views { private var _background:Rect; public function TopToolbarAIR() { + super(); + _background = new Rect(); _background.percentHeight = 100; _background.percentWidth = 100; diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/settings/SettingsConfig.as b/clients/flash/air-client/src/org/bigbluebutton/air/settings/SettingsConfig.as index 0631f8e5b7..64462c964a 100644 --- a/clients/flash/air-client/src/org/bigbluebutton/air/settings/SettingsConfig.as +++ b/clients/flash/air-client/src/org/bigbluebutton/air/settings/SettingsConfig.as @@ -2,9 +2,13 @@ package org.bigbluebutton.air.settings { import org.bigbluebutton.air.settings.views.SettingsViewMediatorAIR; import org.bigbluebutton.air.settings.views.TopToolbarMediatorSettings; + import org.bigbluebutton.air.settings.views.TopToolbarMediatorSubSettings; import org.bigbluebutton.air.settings.views.TopToolbarSettings; + import org.bigbluebutton.air.settings.views.TopToolbarSubSettings; + import org.bigbluebutton.air.settings.views.audio.AudioSettingsViewMediatorAIR; import org.bigbluebutton.lib.main.views.TopToolbarBase; import org.bigbluebutton.lib.settings.views.SettingsViewBase; + import org.bigbluebutton.lib.settings.views.audio.AudioSettingsViewBase; import robotlegs.bender.extensions.matching.TypeMatcher; import robotlegs.bender.extensions.mediatorMap.api.IMediatorMap; @@ -28,7 +32,9 @@ package org.bigbluebutton.air.settings { */ private function mediators():void { mediatorMap.map(SettingsViewBase).toMediator(SettingsViewMediatorAIR); + mediatorMap.map(AudioSettingsViewBase).toMediator(AudioSettingsViewMediatorAIR); mediatorMap.mapMatcher(new TypeMatcher().allOf(TopToolbarBase, TopToolbarSettings)).toMediator(TopToolbarMediatorSettings); + mediatorMap.mapMatcher(new TypeMatcher().allOf(TopToolbarBase, TopToolbarSubSettings)).toMediator(TopToolbarMediatorSubSettings); } } } diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/TopToolbarMediatorSubSettings.as b/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/TopToolbarMediatorSubSettings.as new file mode 100644 index 0000000000..bbc59c9ef4 --- /dev/null +++ b/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/TopToolbarMediatorSubSettings.as @@ -0,0 +1,18 @@ +package org.bigbluebutton.air.settings.views { + import flash.events.MouseEvent; + + import org.bigbluebutton.air.common.PageEnum; + import org.bigbluebutton.air.main.views.TopToolbarMediatorAIR; + + public class TopToolbarMediatorSubSettings extends TopToolbarMediatorAIR { + + override protected function leftButtonClickHandler(e:MouseEvent):void { + uiSession.pushPage(PageEnum.SETTINGS); + } + + override protected function rightButtonClickHandler(e:MouseEvent):void { + // @todo: add save logic + uiSession.pushPage(PageEnum.SETTINGS); + } + } +} diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/TopToolbarSubSettings.as b/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/TopToolbarSubSettings.as new file mode 100644 index 0000000000..7ba57ff3bc --- /dev/null +++ b/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/TopToolbarSubSettings.as @@ -0,0 +1,22 @@ +package org.bigbluebutton.air.settings.views { + import mx.core.FlexGlobals; + + import org.bigbluebutton.air.main.views.TopToolbarAIR; + + public class TopToolbarSubSettings extends TopToolbarAIR { + public function TopToolbarSubSettings() { + super(); + + leftButton.styleName = "icon-left-arrow topButton topLeftButton"; + rightButton.styleName = "topButton topRightButton"; + } + + override protected function updateDisplayList(w:Number, h:Number):void { + super.updateDisplayList(w, h); + rightButton.setStyle("iconFont", FlexGlobals.topLevelApplication["getStyle"]("fontFamily")); + rightButton.setStyle("fontFamily", FlexGlobals.topLevelApplication["getStyle"]("fontFamily")); + rightButton.label = "SAVE"; + } + + } +} diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsView.as b/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsView.as index 66750c9609..93e26fc0b7 100644 --- a/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsView.as +++ b/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsView.as @@ -1,41 +1,32 @@ package org.bigbluebutton.air.settings.views.audio { - import spark.components.Button; - import spark.components.HSlider; - import spark.components.ToggleSwitch; - import spark.primitives.Rect; + import spark.layouts.HorizontalAlign; + import spark.layouts.VerticalLayout; - public class AudioSettingsView extends AudioSettingsViewBase implements IAudioSettingsView { + import org.bigbluebutton.air.common.views.NoTabView; + import org.bigbluebutton.air.main.views.TopToolbarAIR; + import org.bigbluebutton.air.settings.views.TopToolbarSubSettings; + import org.bigbluebutton.lib.settings.views.audio.AudioSettingsViewBase; + + public class AudioSettingsView extends NoTabView { + private var _settingsView:AudioSettingsViewBase; - public function dispose():void { + public function AudioSettingsView() { + super(); + + var vLayout:VerticalLayout = new VerticalLayout(); + vLayout.gap = 0; + vLayout.horizontalAlign = HorizontalAlign.CENTER; + layout = vLayout; + + _settingsView = new AudioSettingsViewBase(); + _settingsView.percentHeight = 100; + _settingsView.percentWidth = 100; + addElement(_settingsView); } - public function get enableMic():ToggleSwitch { - return enableMic0; - } - - public function get enableAudio():ToggleSwitch { - return enableAudio0; - } - - public function get enablePushToTalk():ToggleSwitch { - return enablePushToTalk0; - } - - public function get continueBtn():Button { - return continueToMeeting; - } - - public function get gainSlider():HSlider { - return gainSlider0; - } - - public function get micActivity():Rect { - return micActivity0; - } - - public function get micActivityMask():Rect { - return micActivityMask0; + override protected function createToolbar():TopToolbarAIR { + return new TopToolbarSubSettings(); } } } diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsViewBase.mxml b/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsViewBase.mxml deleted file mode 100644 index e147b67ab4..0000000000 --- a/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsViewBase.mxml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsViewMediator.as b/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsViewMediator.as deleted file mode 100755 index f25c5f86fa..0000000000 --- a/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsViewMediator.as +++ /dev/null @@ -1,156 +0,0 @@ -package org.bigbluebutton.air.settings.views.audio { - - import flash.events.Event; - import flash.events.MouseEvent; - import flash.events.TimerEvent; - import flash.utils.Timer; - - import mx.core.FlexGlobals; - import mx.resources.ResourceManager; - - import org.bigbluebutton.air.main.models.IUISession; - import org.bigbluebutton.lib.common.models.ISaveData; - import org.bigbluebutton.lib.main.models.IUserSession; - import org.bigbluebutton.lib.user.models.User; - import org.bigbluebutton.lib.user.models.UserList; - import org.bigbluebutton.lib.voice.commands.ShareMicrophoneSignal; - - import robotlegs.bender.bundles.mvcs.Mediator; - - public class AudioSettingsViewMediator extends Mediator { - - [Inject] - public var view:IAudioSettingsView; - - [Inject] - public var userSession:IUserSession; - - [Inject] - public var userUISession:IUISession; - - [Inject] - public var saveData:ISaveData; - - [Inject] - public var shareMicrophoneSignal:ShareMicrophoneSignal; - - private var micActivityTimer:Timer = null; - - override public function initialize():void { - userSession.userList.userChangeSignal.add(userChangeHandler); - FlexGlobals.topLevelApplication.topActionBar.pageName.text = ResourceManager.getInstance().getString('resources', 'audioSettings.title'); - var userMe:User = userSession.userList.me; - view.continueBtn.addEventListener(MouseEvent.CLICK, onContinueClick); - view.enableAudio.addEventListener(Event.CHANGE, onEnableAudioClick); - view.enableMic.addEventListener(Event.CHANGE, onEnableMicClick); - view.enablePushToTalk.addEventListener(Event.CHANGE, onEnablePushToTalkClick); - view.gainSlider.addEventListener(Event.CHANGE, gainChange); - userSession.lockSettings.disableMicSignal.add(disableMic); - disableMic(userSession.lockSettings.disableMic && userMe.role != User.MODERATOR && !userMe.presenter && userMe.locked); - view.enableAudio.selected = (userMe.voiceJoined || userMe.listenOnly); - view.enablePushToTalk.enabled = view.enableMic.selected = userMe.voiceJoined; - view.enablePushToTalk.selected = (userSession.pushToTalk || userSession.phoneOptions.autoJoin); - FlexGlobals.topLevelApplication.topActionBar.backBtn.visible = true; - FlexGlobals.topLevelApplication.topActionBar.profileBtn.visible = false; - loadMicGain(); - micActivityTimer = new Timer(100); - micActivityTimer.addEventListener(TimerEvent.TIMER, micActivity); - micActivityTimer.start(); - view.continueBtn.visible = userSession.phoneOptions.autoJoin; - } - - private function loadMicGain():void { - var gain:Number = saveData.read("micGain") as Number; - if (!isNaN(gain)) { - view.gainSlider.value = gain / 10; - } - } - - private function setMicGain(gain:Number):void { - if (userSession.voiceStreamManager) { - userSession.voiceStreamManager.setDefaultMicGain(gain); - if (!userSession.pushToTalk && userSession.voiceStreamManager.mic) { - userSession.voiceStreamManager.mic.gain = gain; - } - } - } - - private function gainChange(e:Event):void { - var gain:Number = e.target.value * 10 - saveData.save("micGain", gain); - setMicGain(gain); - } - - private function micActivity(e:TimerEvent):void { - if (userSession.voiceStreamManager && userSession.voiceStreamManager.mic) { - view.micActivityMask.width = view.gainSlider.width - (view.gainSlider.width * userSession.voiceStreamManager.mic.activityLevel / 100); - view.micActivityMask.x = view.micActivity.x + view.micActivity.width - view.micActivityMask.width; - } - } - - private function disableMic(disable:Boolean):void { - if (disable) { - view.enableMic.enabled = false; - view.enableMic.selected = false; - } else { - view.enableMic.enabled = true; - } - } - - private function onContinueClick(event:Event):void { - userUISession.popPage(); - } - - private function onEnableAudioClick(event:Event):void { - if (!view.enableAudio.selected) { - view.enableMic.selected = false; - view.enablePushToTalk.enabled = false; - userSession.pushToTalk = false; - } - var audioOptions:Object = new Object(); - audioOptions.shareMic = userSession.userList.me.voiceJoined = view.enableMic.selected && view.enableAudio.selected; - audioOptions.listenOnly = userSession.userList.me.listenOnly = !view.enableMic.selected && view.enableAudio.selected; - shareMicrophoneSignal.dispatch(audioOptions); - } - - private function onEnableMicClick(event:Event):void { - view.enablePushToTalk.enabled = view.enableMic.selected; - if (view.enableMic.selected) { - view.enableAudio.selected = true; - } - userSession.pushToTalk = (view.enablePushToTalk.selected && view.enablePushToTalk.enabled); - var audioOptions:Object = new Object(); - audioOptions.shareMic = userSession.userList.me.voiceJoined = view.enableMic.selected && view.enableAudio.selected; - audioOptions.listenOnly = userSession.userList.me.listenOnly = !view.enableMic.selected && view.enableAudio.selected; - shareMicrophoneSignal.dispatch(audioOptions); - } - - private function onEnablePushToTalkClick(event:Event):void { - userSession.pushToTalk = view.enablePushToTalk.selected; - } - - private function userChangeHandler(user:User, type:int):void { - if (user.me) { - if (type == UserList.LISTEN_ONLY) { - view.enableAudio.selected = user.voiceJoined || user.listenOnly; - view.enableMic.selected = user.voiceJoined; - } - } - } - - override public function destroy():void { - super.destroy(); - userSession.lockSettings.disableMicSignal.remove(disableMic); - view.continueBtn.removeEventListener(MouseEvent.CLICK, onContinueClick); - view.enableAudio.removeEventListener(Event.CHANGE, onEnableAudioClick); - view.enableMic.removeEventListener(Event.CHANGE, onEnableMicClick); - if (micActivityTimer) { - micActivityTimer.removeEventListener(TimerEvent.TIMER, micActivity); - } - view.enablePushToTalk.removeEventListener(Event.CHANGE, onEnablePushToTalkClick); - view.gainSlider.removeEventListener(Event.CHANGE, gainChange); - userSession.userList.userChangeSignal.remove(userChangeHandler); - userSession.phoneOptions.autoJoin = false; - } - } -} diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsViewMediatorAIR.as b/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsViewMediatorAIR.as new file mode 100644 index 0000000000..e595a71fe6 --- /dev/null +++ b/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/AudioSettingsViewMediatorAIR.as @@ -0,0 +1,145 @@ +package org.bigbluebutton.air.settings.views.audio { + import flash.utils.Timer; + + import org.bigbluebutton.air.main.models.IUISession; + import org.bigbluebutton.lib.common.models.ISaveData; + import org.bigbluebutton.lib.main.models.IUserSession; + import org.bigbluebutton.lib.settings.views.audio.AudioSettingsViewMediator; + import org.bigbluebutton.lib.voice.commands.ShareMicrophoneSignal; + + public class AudioSettingsViewMediatorAIR extends AudioSettingsViewMediator { + + [Inject] + public var userSession:IUserSession; + + [Inject] + public var userUISession:IUISession; + + [Inject] + public var saveData:ISaveData; + + [Inject] + public var shareMicrophoneSignal:ShareMicrophoneSignal; + + private var micActivityTimer:Timer = null; + + override public function initialize():void { + /* userSession.userList.userChangeSignal.add(userChangeHandler); + FlexGlobals.topLevelApplication.topActionBar.pageName.text = ResourceManager.getInstance().getString('resources', 'audioSettings.title'); + var userMe:User = userSession.userList.me; + view.continueBtn.addEventListener(MouseEvent.CLICK, onContinueClick); + view.enableAudio.addEventListener(Event.CHANGE, onEnableAudioClick); + view.enableMic.addEventListener(Event.CHANGE, onEnableMicClick); + view.enablePushToTalk.addEventListener(Event.CHANGE, onEnablePushToTalkClick); + view.gainSlider.addEventListener(Event.CHANGE, gainChange); + userSession.lockSettings.disableMicSignal.add(disableMic); + disableMic(userSession.lockSettings.disableMic && userMe.role != User.MODERATOR && !userMe.presenter && userMe.locked); + view.enableAudio.selected = (userMe.voiceJoined || userMe.listenOnly); + view.enablePushToTalk.enabled = view.enableMic.selected = userMe.voiceJoined; + view.enablePushToTalk.selected = (userSession.pushToTalk || userSession.phoneOptions.autoJoin); + FlexGlobals.topLevelApplication.topActionBar.backBtn.visible = true; + FlexGlobals.topLevelApplication.topActionBar.profileBtn.visible = false; + loadMicGain(); + micActivityTimer = new Timer(100); + micActivityTimer.addEventListener(TimerEvent.TIMER, micActivity); + micActivityTimer.start(); + view.continueBtn.visible = userSession.phoneOptions.autoJoin; + */ + } + /* + private function loadMicGain():void { + var gain:Number = saveData.read("micGain") as Number; + if (!isNaN(gain)) { + view.gainSlider.value = gain / 10; + } + } + + private function setMicGain(gain:Number):void { + if (userSession.voiceStreamManager) { + userSession.voiceStreamManager.setDefaultMicGain(gain); + if (!userSession.pushToTalk && userSession.voiceStreamManager.mic) { + userSession.voiceStreamManager.mic.gain = gain; + } + } + } + + private function gainChange(e:Event):void { + var gain:Number = e.target.value * 10 + saveData.save("micGain", gain); + setMicGain(gain); + } + + private function micActivity(e:TimerEvent):void { + if (userSession.voiceStreamManager && userSession.voiceStreamManager.mic) { + view.micActivityMask.width = view.gainSlider.width - (view.gainSlider.width * userSession.voiceStreamManager.mic.activityLevel / 100); + view.micActivityMask.x = view.micActivity.x + view.micActivity.width - view.micActivityMask.width; + } + } + + private function disableMic(disable:Boolean):void { + if (disable) { + view.enableMic.enabled = false; + view.enableMic.selected = false; + } else { + view.enableMic.enabled = true; + } + } + + private function onContinueClick(event:Event):void { + userUISession.popPage(); + } + + private function onEnableAudioClick(event:Event):void { + if (!view.enableAudio.selected) { + view.enableMic.selected = false; + view.enablePushToTalk.enabled = false; + userSession.pushToTalk = false; + } + var audioOptions:Object = new Object(); + audioOptions.shareMic = userSession.userList.me.voiceJoined = view.enableMic.selected && view.enableAudio.selected; + audioOptions.listenOnly = userSession.userList.me.listenOnly = !view.enableMic.selected && view.enableAudio.selected; + shareMicrophoneSignal.dispatch(audioOptions); + } + + private function onEnableMicClick(event:Event):void { + view.enablePushToTalk.enabled = view.enableMic.selected; + if (view.enableMic.selected) { + view.enableAudio.selected = true; + } + userSession.pushToTalk = (view.enablePushToTalk.selected && view.enablePushToTalk.enabled); + var audioOptions:Object = new Object(); + audioOptions.shareMic = userSession.userList.me.voiceJoined = view.enableMic.selected && view.enableAudio.selected; + audioOptions.listenOnly = userSession.userList.me.listenOnly = !view.enableMic.selected && view.enableAudio.selected; + shareMicrophoneSignal.dispatch(audioOptions); + } + + private function onEnablePushToTalkClick(event:Event):void { + userSession.pushToTalk = view.enablePushToTalk.selected; + } + + private function userChangeHandler(user:User, type:int):void { + if (user.me) { + if (type == UserList.LISTEN_ONLY) { + view.enableAudio.selected = user.voiceJoined || user.listenOnly; + view.enableMic.selected = user.voiceJoined; + } + } + } + + override public function destroy():void { + super.destroy(); + userSession.lockSettings.disableMicSignal.remove(disableMic); + view.continueBtn.removeEventListener(MouseEvent.CLICK, onContinueClick); + view.enableAudio.removeEventListener(Event.CHANGE, onEnableAudioClick); + view.enableMic.removeEventListener(Event.CHANGE, onEnableMicClick); + if (micActivityTimer) { + micActivityTimer.removeEventListener(TimerEvent.TIMER, micActivity); + } + view.enablePushToTalk.removeEventListener(Event.CHANGE, onEnablePushToTalkClick); + view.gainSlider.removeEventListener(Event.CHANGE, gainChange); + userSession.userList.userChangeSignal.remove(userChangeHandler); + userSession.phoneOptions.autoJoin = false; + } + */ + } +} diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/IAudioSettingsView.as b/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/IAudioSettingsView.as deleted file mode 100644 index 6255a6951f..0000000000 --- a/clients/flash/air-client/src/org/bigbluebutton/air/settings/views/audio/IAudioSettingsView.as +++ /dev/null @@ -1,19 +0,0 @@ -package org.bigbluebutton.air.settings.views.audio { - - import org.bigbluebutton.air.common.views.IView; - - import spark.components.Button; - import spark.components.HSlider; - import spark.components.ToggleSwitch; - import spark.primitives.Rect; - - public interface IAudioSettingsView extends IView { - function get enableMic():ToggleSwitch; - function get enableAudio():ToggleSwitch; - function get enablePushToTalk():ToggleSwitch; - function get continueBtn():Button; - function get gainSlider():HSlider; - function get micActivityMask():Rect; - function get micActivity():Rect; - } -} diff --git a/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/settings/views/audio/AudioSettingsViewBase.as b/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/settings/views/audio/AudioSettingsViewBase.as new file mode 100644 index 0000000000..49fce36917 --- /dev/null +++ b/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/settings/views/audio/AudioSettingsViewBase.as @@ -0,0 +1,10 @@ +package org.bigbluebutton.lib.settings.views.audio { + import spark.components.Group; + + public class AudioSettingsViewBase extends Group { + + public function AudioSettingsViewBase() { + super(); + } + } +} diff --git a/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/settings/views/audio/AudioSettingsViewMediator.as b/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/settings/views/audio/AudioSettingsViewMediator.as new file mode 100644 index 0000000000..58da86dd14 --- /dev/null +++ b/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/settings/views/audio/AudioSettingsViewMediator.as @@ -0,0 +1,10 @@ +package org.bigbluebutton.lib.settings.views.audio { + + import robotlegs.bender.bundles.mvcs.Mediator; + + public class AudioSettingsViewMediator extends Mediator { + + [Inject] + public var view:AudioSettingsViewBase; + } +}