Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            appPreferences = new AppPreferences(Android.App.Application.Context);
            Username       = appPreferences.getValueKey(AppPreferences.USERNAME);
            Password       = appPreferences.getValueKey(AppPreferences.PASSWORD);
            inputManager   = (InputMethodManager)this.GetSystemService(Context.InputMethodService);
        }
Exemplo n.º 2
0
 protected void OnCreateInit()
 {
     App            = App.Instance;
     appPreferences = new AppPreferences(Application.Context);
     Username       = appPreferences.getValueKey(AppPreferences.USERNAME);
     Password       = appPreferences.getValueKey(AppPreferences.PASSWORD);
     //inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService);
     myActivity       = null;
     JidsFromServer   = listJidsRoster();
     usersRecents     = getGroupsTempToList(AppPreferences.GROUPS_TEMP);
     userLastContacts = listContacts();
     //if (AppUtils.JIdsOnline == null) {
     //	AppUtils.JIdsOnline = new List<string>();
     //}
 }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            appPreferences = new AppPreferences(Application.Context);
            Username       = appPreferences.getValueKey(AppPreferences.USERNAME);
            loadNewActivity();
        }
Exemplo n.º 4
0
        private void loadUser(AppPreferences appPref)
        {
            string userJson = appPref.getValueKey(AppPreferences.USER);

            if (userJson != null)
            {
                var userObj = Newtonsoft.Json.Linq.JObject.Parse(userJson);

                userName.Text  = (string)userObj["username"] == "" ? appPref.getValueKey(AppPreferences.USERNAME) : (string)userObj["username"];
                password.Text  = (string)userObj["password"];
                firstName.Text = (string)userObj["firstname"];
                lastName.Text  = (string)userObj["lastname"];
                phone.Text     = (string)userObj["phone"];

                if (appPref.getValueKey(AppPreferences.ENABLE) != null)
                {
                    if (appPref.getValueKey(AppPreferences.ENABLE).Equals("false"))
                    {
                        enable.Checked = false;
                    }
                    else
                    {
                        enable.Checked = true;
                    }
                }

                if ((string)userObj["avatar"] != "")
                {
                    Bitmap bitmap = Base64ToBitmap((string)userObj["avatar"]);
                    var    d      = new CircleDrawable(bitmap);
                    imgAvatar.SetBackgroundDrawable(d);
                    avatarBase64String = (string)userObj["avatar"];
                }
                else
                {
                    imgAvatar.SetBackgroundResource(Resource.Drawable.avatar_upload);
                }

                VisibleProgress(Resource.Id.pbHeaderProgress, INVISIBLE);
            }
            else
            {
                imgAvatar.SetBackgroundResource(Resource.Drawable.avatar_upload);
                loadMyVCard();
            }
        }
Exemplo n.º 5
0
        public Matrix.Xmpp.Vcard.Vcard saveVCard(User user, AppPreferences appPref)
        {
            var vCard = new Matrix.Xmpp.Vcard.Vcard();

            vCard.SetElementValue("First", user.First);
            vCard.SetElementValue("Last", user.Last);
            vCard.Fullname     = user.First + " " + user.Last;
            vCard.Nickname     = user.username;
            vCard.Photo        = new Matrix.Xmpp.Vcard.Photo();
            vCard.Photo.Binval = ByteBufferFromImage(Base64ToBitmap(appPref.getValueKey(AppPreferences.AVATAR)));
            vCard.SetElementValue("Phone", user.Phone);
            return(vCard);
        }
Exemplo n.º 6
0
        private void loadUser(AppPreferences appPref)
        {
            string userJson = appPref.getValueKey(AppPreferences.USER);

            if (isExistUser())
            {
                var userObj = Newtonsoft.Json.Linq.JObject.Parse(userJson);

                userName.Text = (string)userObj["username"];
                email.Text    = (string)userObj["email"];
                password.Text = (string)userObj["password"];
            }
        }
Exemplo n.º 7
0
        public Dictionary <string, AppCore.Message> getRecentUsers(AppPreferences appPreferences)
        {
            Dictionary <string, AppCore.Message> recentConversationsUserName =
                LegionUtils.getMenssagesByUserName(appPreferences.getValueKey(AppPreferences.CONVERSA_BY_JID));

            if (recentConversationsUserName == null)
            {
                return(new Dictionary <string, AppCore.Message>());
            }
            else
            {
                return(recentConversationsUserName);
            }
        }
Exemplo n.º 8
0
        public static List <AppCore.User> getGroupsTempToList(string APP_PREF, AppPreferences appPref)
        {
            string jsonGroup = appPref.getValueKey(APP_PREF);
            List <AppCore.User> usersGroups = null;

            if (jsonGroup != null || jsonGroup != "")
            {
                usersGroups = LegionUtils.getListJson(jsonGroup);
            }
            else
            {
                usersGroups = new List <User>();
            }
            return(usersGroups);
        }