[AIR] improve participants list responsiveness

This commit is contained in:
Chad Pilkey 2018-04-03 16:25:24 -07:00
parent 21455d1461
commit f595da0869
5 changed files with 21 additions and 81 deletions

View File

@ -1,17 +0,0 @@
package org.bigbluebutton.air.chat.events {
import flash.events.Event;
import org.bigbluebutton.air.chat.models.GroupChat;
public class ChatRoomItemSelectedEvent extends Event {
public static var SELECTED:String = "CHAT_ROOM_ITEM_SELECTED_EVENT";
public var chatRoom:GroupChat;
public function ChatRoomItemSelectedEvent(c:GroupChat) {
super(SELECTED, true, false);
chatRoom = c;
}
}
}

View File

@ -5,9 +5,7 @@
xmlns:common="org.bigbluebutton.air.common.views.*"
xmlns:views="org.bigbluebutton.air.chat.views.*"
width="100%"
styleName="chatRoomItem"
click="onClick()"
keyUp="onKeyUp()">
styleName="chatRoomItem">
<s:states>
<s:State name="normal" />
@ -17,24 +15,9 @@
<fx:Script>
<![CDATA[
import org.bigbluebutton.air.chat.events.ChatRoomItemSelectedEvent;
import org.bigbluebutton.air.chat.models.GroupChat;
import org.bigbluebutton.air.user.utils.UserUtils;
private function onClick():void {
sendSelectedEvent();
}
private function onKeyUp():void {
sendSelectedEvent();
}
private function sendSelectedEvent():void {
if (currentState == "selected") {
dispatchEvent(new ChatRoomItemSelectedEvent(data as GroupChat));
}
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
publicChatIcon.text = publicChatIcon.getStyle("icon");

View File

@ -1,7 +1,7 @@
package org.bigbluebutton.air.participants.views {
import mx.collections.ArrayCollection;
import mx.events.IndexChangedEvent;
import org.bigbluebutton.air.chat.events.ChatRoomItemSelectedEvent;
import org.bigbluebutton.air.chat.models.GroupChat;
import org.bigbluebutton.air.chat.models.GroupChatChangeEnum;
import org.bigbluebutton.air.chat.models.IChatMessagesSession;
@ -12,7 +12,6 @@ package org.bigbluebutton.air.participants.views {
import org.bigbluebutton.air.participants.models.CollectionActionResult;
import org.bigbluebutton.air.participants.models.CollectionUpdateAction;
import org.bigbluebutton.air.participants.models.ParticipantsCollection;
import org.bigbluebutton.air.user.events.UserItemSelectedEvent;
import org.bigbluebutton.air.user.models.User2x;
import org.bigbluebutton.air.user.models.UserChangeEnum;
import org.bigbluebutton.air.user.views.models.UserVM;
@ -24,6 +23,8 @@ package org.bigbluebutton.air.participants.views {
import robotlegs.bender.bundles.mvcs.Mediator;
import spark.events.IndexChangeEvent;
public class ParticipantsMediator extends Mediator {
[Inject]
@ -44,8 +45,6 @@ package org.bigbluebutton.air.participants.views {
[Bindable]
private var _participantsCollection:ParticipantsCollection;
protected var dataProvider:ArrayCollection;
override public function initialize():void {
initializeParticipantsCollection();
@ -56,8 +55,7 @@ package org.bigbluebutton.air.participants.views {
chatMessagesSession.groupChatChangeSignal.add(onGroupChatChange)
view.participantsList.addEventListener(UserItemSelectedEvent.SELECTED, onUserItemSelected);
view.participantsList.addEventListener(ChatRoomItemSelectedEvent.SELECTED, onChatItemSelected);
view.participantsList.addEventListener(IndexChangeEvent.CHANGE, onItemSelected);
}
private function initializeParticipantsCollection():void {
@ -153,12 +151,23 @@ package org.bigbluebutton.air.participants.views {
_userCollection.setRoomLockState(newLockSettings.isRoomLocked());
}
protected function onUserItemSelected(e:UserItemSelectedEvent):void {
uiSession.pushPage(PageEnum.USER_DETAILS, e.user.intId);
private function onItemSelected(e:IndexChangeEvent):void {
var selectedObject:Object = _participantsCollection.getItemAt(e.newIndex);
if (selectedObject != null) {
if (selectedObject is UserVM) {
onUserItemSelected(selectedObject as UserVM);
} else if (selectedObject is GroupChat) {
onChatItemSelected(selectedObject as GroupChat);
}
}
}
private function onChatItemSelected(e:ChatRoomItemSelectedEvent):void {
uiSession.pushPage(PageEnum.CHAT, {chatId: e.chatRoom.chatId});
protected function onUserItemSelected(u:UserVM):void {
uiSession.pushPage(PageEnum.USER_DETAILS, u.intId);
}
private function onChatItemSelected(gc:GroupChat):void {
uiSession.pushPage(PageEnum.CHAT, {chatId: gc.chatId});
}
override public function destroy():void {
@ -169,8 +178,7 @@ package org.bigbluebutton.air.participants.views {
chatMessagesSession.groupChatChangeSignal.remove(onGroupChatChange)
view.participantsList.removeEventListener(UserItemSelectedEvent.SELECTED, onUserItemSelected);
view.participantsList.removeEventListener(ChatRoomItemSelectedEvent.SELECTED, onChatItemSelected);
view.participantsList.removeEventListener(IndexChangeEvent.CHANGE, onItemSelected);
super.destroy();
view = null;

View File

@ -1,17 +0,0 @@
package org.bigbluebutton.air.user.events {
import flash.events.Event;
import org.bigbluebutton.air.user.views.models.UserVM;
public class UserItemSelectedEvent extends Event {
public static var SELECTED:String = "USER_ITEM_SELECTED_EVENT";
public var user:UserVM;
public function UserItemSelectedEvent(u:UserVM) {
super(SELECTED, true, false);
user = u;
}
}
}

View File

@ -3,8 +3,6 @@
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:common="org.bigbluebutton.air.common.views.*"
width="100%"
click="onClick()"
keyUp="onKeyUp()"
styleName="participantItem">
<s:states>
<s:State name="normal" />
@ -18,26 +16,11 @@
<fx:Script>
<![CDATA[
import org.bigbluebutton.air.user.events.UserItemSelectedEvent;
import org.bigbluebutton.air.user.models.EmojiStatus;
import org.bigbluebutton.air.user.models.UserRole;
import org.bigbluebutton.air.user.utils.UserUtils;
import org.bigbluebutton.air.user.views.models.UserVM;
private function onClick():void {
sendSelectedEvent();
}
private function onKeyUp():void {
sendSelectedEvent();
}
private function sendSelectedEvent():void {
if (currentState == "selected") {
dispatchEvent(new UserItemSelectedEvent(data as UserVM));
}
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
wrapperGroup.padding = getStyle("padding");
wrapperGroup.gap = getStyle("padding") / 4;