Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mate="http://mate.asfusion.com/"
- xmlns:views="org.bigbluebutton.main.views.*"
- actionBarVisible="false"
- creationComplete="init()"
- addedToStage="addedToStage()">
- <fx:Declarations>
- <mate:Listener type="{ModuleLoadEvent.ALL_MODULES_LOADED}"
- method="handleAllModulesLoadedEvent"/>
- <mate:Listener type="{OpenWindowEvent.OPEN_WINDOW_EVENT}"
- method="handleOpenWindowEvent"/>
- <mate:Listener type="{CloseWindowEvent.CLOSE_WINDOW_EVENT}"
- method="handleCloseWindowEvent"/>
- <mate:Listener type="{ListenersEvent.SET_LOCAL_MODERATOR_STATUS}"
- method="setModerator"/>
- <mate:Listener type="{BBBEvent.END_MEETING_EVENT}"
- method="handleEndMeetingEvent"/>
- <mate:Listener type="{SettingsEvent.SETTINGS_OPTION_EXIT}"
- method="handleSettingMenuExit"/>
- <mate:Listener type="{SettingsEvent.OPEN_SETTINGS_PANEL}"
- method="handleSettingsOpen"/>
- <mate:Listener type="{LogoutEvent.CANCEL_LOGOUT}"
- method="handleCancelLogoutEvent"/>
- <mate:Listener type="{LogoutEvent.USER_LOGGED_OUT}"
- method="handleUserLogoutEvent"/>
- <mate:Listener type="{SettingsEvent.SETTINGS_LOGOUT_WINDOW_OPEN}"
- method="handleLogoutWindowOpenEvent"/>
- <mate:Listener type="{SettingsEvent.SETTINGS_SNAPSHOT_WINDOW_OPEN}"
- method="handleSnapshotWindowOpenEvent"/>
- <mate:Listener type="{LocaleChangeEvent.LOCALE_CHANGED}"
- method="localeChanged"/>
- <mate:Listener type="{BackButtonEvent.BACK_BUTTON_EVENT}"
- method="handleBackButton"/>
- <mate:Listener type="{MobilePresentationEvent.PRESENTATION_WINDOW_READY}"
- method="whiteboardHandler"/>
- <mate:Listener type="{AddUIComponentToMainCanvas.ADD_COMPONENT}"
- method="addComponentToCanvas"/>
- <mate:Listener type="{ConfigEvent.CONFIG_EVENT}"
- method="gotConfigParameters"/>
- <mate:Listener type="{SettingsEvent.SETTINGS_CAMERA_RESOLUTION_OFF_SETTINGS}"
- method="openSettingResolutionOnlyWindow"/>
- </fx:Declarations>
- <s:states>
- <s:State name="landscape"/>
- <s:State name="portrait"/>
- </s:states>
- <fx:Script>
- <![CDATA[
- import com.asfusion.mate.events.Dispatcher;
- import com.codecatalyst.promise.Deferred;
- import mx.collections.ArrayCollection;
- import mx.core.FlexGlobals;
- import mx.core.mx_internal;
- import spark.components.View;
- import org.bigbluebutton.common.Images;
- import org.bigbluebutton.common.LogUtil;
- import org.bigbluebutton.common.events.AddUIComponentToMainCanvas;
- import org.bigbluebutton.common.events.CloseWindowEvent;
- import org.bigbluebutton.common.events.LocaleChangeEvent;
- import org.bigbluebutton.common.events.OpenWindowEvent;
- import org.bigbluebutton.core.managers.UserManager;
- import org.bigbluebutton.main.events.BBBEvent;
- import org.bigbluebutton.main.events.BackButtonEvent;
- import org.bigbluebutton.main.events.ConfigEvent;
- import org.bigbluebutton.main.events.LogoutEvent;
- import org.bigbluebutton.main.events.MobileWaitingEvent;
- import org.bigbluebutton.main.events.ModuleLoadEvent;
- import org.bigbluebutton.main.events.PauseApp;
- import org.bigbluebutton.main.events.SettingsEvent;
- import org.bigbluebutton.modules.listeners.events.ListenersCommand;
- import org.bigbluebutton.modules.listeners.events.ListenersEvent;
- import org.bigbluebutton.modules.present.events.MobilePresentationEvent;
- import org.bigbluebutton.modules.present.ui.views.PresentationWindow;
- import org.bigbluebutton.modules.videoconf.events.ClosePublishWindowEvent;
- import org.bigbluebutton.modules.videoconf.events.OpenPublishWindowEvent;
- import org.bigbluebutton.modules.videoconf.events.WebcamOptionsEvent;
- import org.bigbluebutton.modules.videoconf.model.MobileCamera;
- import org.bigbluebutton.modules.videodock.views.MobileVideoView;
- import org.bigbluebutton.modules.viewers.events.ViewersWindowEvent;
- import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
- import org.bigbluebutton.util.i18n.ResourceUtil;
- import org.bigbluebutton.util.logging.Logger;
- use namespace mx_internal;
- private var images:Images=new Images();
- private static const PANEL_SIZE:Number=8;
- private static const VIEW_SIZE:Number=100 - PANEL_SIZE;
- private static const MIN_PANEL_SIZE:Number=130;
- private var logs:Logger=new Logger();
- private var globalDispatcher:Dispatcher=new Dispatcher();
- private var _micOff:Boolean=false;
- private var version:String;
- private var operatingSystem:String;
- [Bindable]
- private var application:Object=FlexGlobals.topLevelApplication;
- private var radioButtonDown:MainToolButton;
- private var _backRadioButton:MainToolButton; // for devices's "back" button
- [Bindable]
- public var moderator:Boolean;
- [Bindable]
- private var _screenHeight:int; // for bug in scrolling Lists to unstick them from top
- private var videoView:MobileVideoView;
- private var defaultOrientation:String;
- private var whiteboardView:PresentationWindow;
- private var initDeferred:Deferred=new Deferred();
- private function init():void
- {
- var mobileWaitStart:MobileWaitingEvent=new MobileWaitingEvent(MobileWaitingEvent.MOBILE_WAITING_MANUAL_ON);
- globalDispatcher.dispatchEvent(mobileWaitStart);
- _screenHeight=FlexGlobals.topLevelApplication.height;
- toolbar.radioButtonClicked=radioButtonClicked;
- initDeferred.resolve("Mobile Application inited");
- }
- // great place to load data from config files
- private function gotConfigParameters(e:ConfigEvent):void
- {
- initDeferred.promise.then(function():void
- {
- toolbar.loadButtons(e);
- }, errorHandler);
- }
- private static function errorHandler(e:Object):void
- {
- LogUtil.error(e.toString());
- }
- // stage object available here
- private function addedToStage():void
- {
- defaultOrientation=stage.orientation;
- stage.setOrientation(defaultOrientation);
- stage.autoOrients=false;
- this.currentState="landscape";
- }
- public function activateScreen():void
- {
- if (stage)
- stage.setOrientation(defaultOrientation);
- activateApp();
- }
- // app loses focus or put in background
- public function handleDeactivateEvent():void
- {
- initDeferred.promise.then(function():void
- {
- LogUtil.info(" Deactivate App");
- UserManager.getInstance().getConference().appPaused=true;
- muteUser(true);
- // turn off cameras
- if (videoView)
- videoView.deactivate();
- var pauseApp:PauseApp=new PauseApp(PauseApp.PAUSE_APP);
- globalDispatcher.dispatchEvent(pauseApp);
- logs.save();
- }, errorHandler);
- }
- // manage radio button states
- public function radioButtonClicked(butt:MainToolButton):void
- {
- // if user clicked the same button again
- if (butt == radioButtonDown)
- {
- return;
- }
- if (butt.radioButton)
- {
- butt.lockRadio();
- closePrevRadioButton();
- radioButtonDown=butt;
- }
- else
- {
- // Case for that the user clicked "setting" immediately after he had clicked the button "chat".
- var buttonChat:MainToolButton=toolbar.getButtonByName("chat");
- var buttonSetting:MainToolButton=toolbar.getButtonByName("setting");
- if ((butt == buttonSetting) && (radioButtonDown == buttonChat))
- {
- // close chat textbox
- radioButtonDown.deactivate();
- }
- }
- butt.activate();
- var activateBtn:Object={chatBtn: emptyFunction, videoBtn: activateVideoBtn, whiteboardBtn: activateWhiteboardBtn, logoutBtn: activateLogoutBtn, micBtn: activateMicBtn, moreBtn: activateMoreBtn, settingBtn: activateSettingBtn, snapshotBtn: snapshotClicked};
- activateBtn[butt.buttonName]();
- }
- private function emptyFunction():void
- {
- }
- // loading/startup finished, so OK to auto start a view
- private function handleAllModulesLoadedEvent(event:ModuleLoadEvent):void
- {
- initDeferred.promise.then(function():void
- {
- var firstBtn:MainToolButton=toolbar.getFirstButton();
- radioButtonClicked(firstBtn); // auto start video view
- _backRadioButton=firstBtn;
- var mobileWaitStop:MobileWaitingEvent=new MobileWaitingEvent(MobileWaitingEvent.MOBILE_WAITING_MANUAL_OFF);
- globalDispatcher.dispatchEvent(mobileWaitStop);
- loadMenusItems();
- }, errorHandler);
- }
- private function loadMenusItems():void
- {
- setLogoutDataProvider(moderator);
- setWebcamDataProvider();
- }
- private function activateApp():void
- {
- initDeferred.promise.then(function():void
- {
- LogUtil.info(" Activate App");
- UserManager.getInstance().getConference().appPaused=false;
- var activateApp:PauseApp=new PauseApp(PauseApp.ACTIVATE_APP);
- globalDispatcher.dispatchEvent(activateApp);
- if (videoView)
- videoView.reactivate();
- if (!_micOff)
- muteUser(false);
- }, errorHandler);
- }
- private function muteUser(mute:Boolean):void
- {
- var lce:ListenersCommand=new ListenersCommand(ListenersCommand.MUTE_USER);
- lce.userid=UserManager.getInstance().getConference().getMyVoiceUserId();
- lce.mute=mute;
- globalDispatcher.dispatchEvent(lce);
- }
- private function handleBackButton(event:Event):void
- {
- if (setting.visible)
- {
- setting.handleBackButton();
- }
- else
- {
- radioButtonDown.popupNow();
- radioButtonClicked(_backRadioButton);
- }
- }
- private function handleOpenWindowEvent(event:OpenWindowEvent):void
- {
- hideWindow();
- if (event.view)
- {
- var view:View=event.view;
- centerstage.addElement(view);
- }
- }
- private function handleCloseWindowEvent(event:CloseWindowEvent):void
- {
- if (event.view)
- {
- var view:View=event.view;
- if (centerstage.containsElement(view))
- centerstage.removeElement(view);
- }
- }
- private function setModerator(e:ListenersEvent):void
- {
- moderator=e.moderator;
- }
- private function closePrevRadioButton():void
- {
- if (radioButtonDown)
- {
- _backRadioButton=radioButtonDown;
- radioButtonDown.releaseRadio();
- // ==== close previous window ====
- radioButtonDown.deactivate();
- if (radioButtonDown.buttonName == "videoBtn")
- {
- closeWatchvideo();
- }
- else if (radioButtonDown.buttonName == "whiteboardBtn")
- {
- closeWhiteboard();
- }
- toolbar.hideMoreOptions();
- radioButtonDown=null;
- }
- }
- private function activateMicBtn():void
- {
- _micOff=!_micOff;
- }
- private function activateMoreBtn():void
- {
- toolbar.activateMoreBtn();
- }
- private function activateSettingBtn():void
- {
- toolbar.hideMoreOptions();
- setting.visible=true;
- }
- private function activateLogoutBtn():void
- {
- toolbar.hideMoreOptions();
- logoutView.visible=true;
- }
- private function openWebcam():void
- {
- var we:OpenPublishWindowEvent=new OpenPublishWindowEvent(OpenPublishWindowEvent.OPEN_PUBLISH_WINDOW);
- globalDispatcher.dispatchEvent(we);
- }
- private function openSettingResolutionOnlyWindow(event:Event):void
- {
- var button:MainToolButton=toolbar.getButtonByName("setting");
- radioButtonClicked(button);
- setting.setResolutionOnly();
- }
- private function activateVideoBtn():void
- {
- if (videoView)
- {
- videoView.visible=true;
- }
- else
- {
- videoView=new MobileVideoView();
- centerstage.addElement(videoView);
- }
- }
- private function activateWhiteboardBtn():void
- {
- whiteboardView.visible=true;
- }
- private function closeWatchvideo():void
- {
- videoView.visible=false;
- }
- private function handleEndMeetingEvent(event:BBBEvent):void
- {
- dispatchEvent(new LogoutEvent(LogoutEvent.MEETING_ENDED));
- }
- private function snapshotClicked():void
- {
- toolbar.hideMoreOptions();
- }
- private function closeWhiteboard():void
- {
- globalDispatcher.dispatchEvent(new WhiteboardButtonEvent(WhiteboardButtonEvent.DISABLE_WHITEBOARD));
- whiteboardView.visible=false;
- }
- private function openUsers():void
- {
- dispatchEvent(new ViewersWindowEvent(ViewersWindowEvent.VIEWERS_WINDOW_OPEN_EVENT));
- }
- // used for non-MDI windows
- // TODO make all windows non-MDI
- private function showWindow():void
- {
- if (radioButtonDown && radioButtonDown.buttonName == "snapshotBtn")
- {
- radioButtonDown.activate();
- }
- }
- // close all the Settings sub windows
- private function hideWindow():void
- {
- webcamOptions.visible=false;
- logoutView.visible=false;
- }
- private function handleSettingMenuExit(event:SettingsEvent):void
- {
- setting.visible=false;
- // Case for that the user clicked "setting" immediately after he had clicked "chat".
- var buttonChat:MainToolButton=toolbar.getButtonByName("chat");
- if (radioButtonDown == buttonChat)
- {
- // open chat textbox
- radioButtonDown.activate();
- }
- }
- private function handleSettingsOpen(event:SettingsEvent):void
- {
- radioButtonClicked(radioButtonDown);
- }
- private function handleLogoutWindowOpenEvent(event:SettingsEvent):void
- {
- radioButtonClicked(radioButtonDown);
- }
- private function handleSnapshotWindowOpenEvent(event:SettingsEvent):void
- {
- radioButtonClicked(_backRadioButton);
- radioButtonDown.activate();
- }
- // logout cancel
- private function handleCancelLogoutEvent(e:LogoutEvent):void
- {
- logoutView.visible=false;
- }
- // handle logout clicked
- private function handleUserLogoutEvent(e:LogoutEvent):void
- {
- if (videoView) {
- videoView.remove();
- }
- if (MobileCamera.getInstance()._camera)
- {
- MobileCamera.getInstance().stopCamera();
- }
- logoutView.visible=false;
- }
- // language changed
- private function localeChanged(e:LocaleChangeEvent):void
- {
- initDeferred.promise.then(function():void
- {
- setLogoutDataProvider(UserManager.getInstance().getConference().amIModerator());
- setWebcamDataProvider();
- }, errorHandler);
- }
- private function setLogoutDataProvider(_moderator:Boolean):void
- {
- var mainOptions:Array;
- var restOptions:Array = [
- {label: ResourceUtil.getInstance().getString('bbb.fileupload.okCancelBtn'), event: LogoutEvent.CANCEL_LOGOUT, icon: images.cancel_red}
- ];
- if(_moderator)
- {
- mainOptions = [
- {label: ResourceUtil.getInstance().getString('bbb.logoutOption.leave'), event: LogoutEvent.USER_LOGGED_OUT},
- {label: ResourceUtil.getInstance().getString('bbb.logoutOption.endClass'), event: LogoutEvent.END_MEETING}
- ];
- }
- else
- {
- mainOptions = [
- {label: ResourceUtil.getInstance().getString('bbb.mainshell.logoutQuestion')},
- {label: ResourceUtil.getInstance().getString('bbb.mainToolbar.logoutBtn'), event: LogoutEvent.USER_LOGGED_OUT, icon: images.ok_green}
- ];
- }
- logoutView.dataProvider=new ArrayCollection(mainOptions.concat(restOptions));
- }
- private function openWebcamOptions():void
- {
- if (webcamOptions.visible)
- {
- webcamOptions.visible=false;
- }
- else
- {
- webcamOptions.visible=true;
- }
- }
- private function setWebcamDataProvider():void
- {
- webcamOptions.dataProvider=null;
- webcamOptions.dataProvider=new ArrayCollection([{label: ' ', event: SettingsEvent.OPEN_SETTINGS_PANEL, icon: images.logoBackIcon}, {label: ResourceUtil.getInstance().getString('bbb.publishVideo.webcam.stop'), event: ClosePublishWindowEvent.REMOTE_CLOSE_PUBLISH_WINDOW}, {label: ResourceUtil.getInstance().getString('bbb.publishVideo.webcam.change.cam'), event: WebcamOptionsEvent.CHANGE_CAMERA_EVENT}, {label: ResourceUtil.getInstance().getString('bbb.publishVideo.webcam.change.res'), event: WebcamOptionsEvent.CHANGE_RESOLUTION_EVENT},]);
- }
- private function whiteboardHandler(e:MobilePresentationEvent):void
- {
- whiteboardView=e.window as PresentationWindow;
- centerstage.addElement(whiteboardView);
- whiteboardView.visible=false;
- }
- private function keepMinimumPanelSize():void
- {
- if (toolbar.width < MIN_PANEL_SIZE)
- {
- toolbar.width=MIN_PANEL_SIZE;
- centerstage.width=allgroup.width - toolbar.width;
- }
- if (toolbar.height < MIN_PANEL_SIZE)
- {
- toolbar.height=MIN_PANEL_SIZE;
- centerstage.height=allgroup.height - toolbar.height;
- }
- }
- private function addComponentToCanvas(e:AddUIComponentToMainCanvas):void
- {
- centerstage.addElement(e.component);
- }
- ]]>
- </fx:Script>
- <!-- ====================== 3 columns: left toolbar, center stage, right toolbar ============================= -->
- <s:Group id="fullscreen"
- height="100%"
- width="100%">
- <s:Group id="allgroup"
- width="{application.width}"
- height="{application.height}">
- <s:layout.landscape>
- <s:HorizontalLayout gap="0"/>
- </s:layout.landscape>
- <s:layout.portrait>
- <s:VerticalLayout gap="0"/>
- </s:layout.portrait>
- <!-- ======================================= Center stage ====================================== -->
- <s:Group id="centerstage"
- width.landscape="{allgroup.width * VIEW_SIZE / 100}"
- height.landscape="{allgroup.height}"
- width.portrait="{allgroup.width}"
- height.portrait="{allgroup.height * VIEW_SIZE / 100}">
- </s:Group>
- <!-- ================================== Right or Bottom Toolbar =================================== -->
- <views:MainToolbar id="toolbar"
- height.portrait="{PANEL_SIZE}%"
- width.portrait="100%"
- height.landscape="100%"
- width.landscape="{PANEL_SIZE}%"
- resize="keepMinimumPanelSize()"/>
- </s:Group>
- <views:MainApplicationShell id="mainShell"
- width="100%"
- height="100%"/>
- <s:List id="webcamOptions"
- itemRenderer="org.bigbluebutton.modules.videoconf.views.WebcamControlRenderer"
- height="360"
- width="240"
- x="{centerstage.width-webcamOptions.width}"
- click="openWebcamOptions()"
- y="{centerstage.height-webcamOptions.height}"
- visible="false"
- borderVisible="true"
- borderColor="0x000000"/>
- <s:List id="logoutView"
- itemRenderer="org.bigbluebutton.main.views.LogoutRenderer"
- height="360"
- width="240"
- x="{centerstage.width-logoutView.width}"
- y="{centerstage.height - logoutView.height}"
- visible="false"
- borderVisible="true"
- borderColor="0x000000"/>
- <views:SettingWindow id="setting"
- width="100%"
- height="{_screenHeight}"
- visible="false"/>
- </s:Group>
- </s:View>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement