Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.AddNewGroup);
            userGroups = listContacts();
            group      = new AppCore.User();
            listGroups = LegionUtils.getGroupsTempToList(AppPreferences.GROUPS_TEMP, appPreferences);

            var toolbar = loadToolBar(Resource.String.newGroup);

            toolbar.SetNavigationIcon(Resource.Drawable.back);

            txvNameGroup = (TextView)FindViewById(Resource.Id.groupName);
            imvAvatar    = (ImageView)FindViewById(Resource.Id.avatar);
            imvAvatar.SetBackgroundResource(Resource.Drawable.avatar_upload);

            mRecyclerView  = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            mLayoutManager = new LinearLayoutManager(this);
            mRecyclerView.SetLayoutManager(mLayoutManager);
            NewGroupAdapter userAdapter = new NewGroupAdapter(userGroups, this);

            mRecyclerView.SetAdapter(userAdapter);

            imvAvatar.Click += delegate
            {
                var imageIntent = new Intent();
                imageIntent.SetType("image/*");
                imageIntent.SetAction(Intent.ActionGetContent);
                StartActivityForResult(
                    Intent.CreateChooser(imageIntent, "Select photo"), 0);
            };
        }
Пример #2
0
 public void updateIndexUserRecentMensages(MessageEventArgs e)
 {
     if (user.users.Any(u => u.Jid.Split('@')[0].Equals(e.From.Split('@')[0])))
     {
         setRecentUser(user.users, e);
     }
     else
     {
         List <AppCore.User> userGroups = LegionUtils.getGroupsTempToList(AppPreferences.GROUPS_TEMP, appPreferences);
         setRecentUser(userGroups, e);
     }
 }
Пример #3
0
        public void setNameFromGroup(string groupName, string From)
        {
            List <AppCore.User> groups = LegionUtils.getGroupsTempToList(AppPreferences.GROUPS_TEMP, appPreferences);
            var index = groups.FindIndex(c => c.Jid.Split('@')[0] == From.Split('@')[0]);

            groups[index].username = groupName;
            groups[index].Nick     = groupName;

            LegionUtils.saveFoundGroups(groups, appPreferences, AppPreferences.GROUPS_TEMP);

            if (context.GetType() == typeof(SessionActivity))
            {
                SessionActivity o = (SessionActivity)context;
                o.updateUIListGroupsUsers(groups);
            }
        }
Пример #4
0
        public void init(Context context)
        {
            App                 = App.Instance;
            this.context        = context;
            connectivityManager = (ConnectivityManager)
                                  context.GetSystemService(Context.ConnectivityService);

            if (appPreferences == null)
            {
                appPreferences = new AppPreferences(Application.Context);
            }
            if (userService == null)
            {
                userService = new UserService(appPreferences);
            }
            userRecentsAndGroups = LegionUtils.getGroupsTempToList(AppPreferences.GROUPS_TEMP, appPreferences);

            if (Username != null && Password != null)
            {
                if (IsOnline())
                {
                    if (IS_TRY_CONNECT)
                    {
                        if (App.Xmpp != null)
                        {
                            App.Xmpp.Connect();
                        }
                        else
                        {
                            loadXmppConnect();
                        }
                    }
                    else
                    {
                        loadXmppConnect();
                    }
                }
                else
                {
                    BaseAppCompatActivity o = (BaseAppCompatActivity)context;
                    o.Alert("You are Offline!");
                }
            }

            StartSignalling();
        }
Пример #5
0
        public void Xmpp_OnJoinGroup(object sender, string roomJid)
        {
            Messaging.Log.Info("joined a room " + roomJid);
            if (roomJid != null)
            {
                List <AppCore.User> userGroups = LegionUtils.getGroupsTempToList(AppPreferences.GROUPS_TEMP, appPreferences);
                AppCore.User        group      = new AppCore.User();
                group.Jid     = roomJid + "@" + AppCore.Utils._MUS_SERVER;
                group.isGroup = true;

                if (userGroups.Any(x => x.Jid != (group.Jid)))
                {
                    userGroups.Add(group);
                    if (context != null)
                    {
                        BaseAppCompatActivity o = (BaseAppCompatActivity)context;
                        o.saveSeachGroups(userGroups);
                    }
                }
            }
        }
Пример #6
0
 public List <AppCore.User> getGroupsTempToList(string APP_PREF)
 {
     return(LegionUtils.getGroupsTempToList(APP_PREF, appPreferences));
 }