protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            appPreferences = new AppPreferences(Application.Context);
            Username       = appPreferences.getValueKey(AppPreferences.USERNAME);
            loadNewActivity();
        }
Exemple #2
0
 private void loadUser(AppPreferences appPref)
 {
     if (isExistUser())
     {
         UsernameEdit.Text = Username;
         PasswordEdit.Text = Password;
     }
 }
Exemple #3
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);
        }
Exemple #4
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);
        }
Exemple #5
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"];
            }
        }
Exemple #6
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);
            }
        }
Exemple #7
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);
        }
Exemple #8
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>();
     //}
 }
Exemple #9
0
        public Matrix.Xmpp.Vcard.Vcard saveVCard(User user, AppPreferences appPref, string avatar)
        {
            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();
            if (avatar != null)
            {
                vCard.Photo.Binval = ByteBufferFromImage(Base64ToBitmap(avatar));
            }
            vCard.SetElementValue("Phone", user.Phone);
            return(vCard);
        }
Exemple #10
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();
        }
Exemple #11
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();
            }
        }
Exemple #12
0
        public static void saveFoundJidsServer(List <string> contacts, AppPreferences appPref, string KEY)
        {
            string json = LegionUtils.parceToGson(contacts);

            appPref.saveKey(KEY, json);
        }
Exemple #13
0
        public static void saveFoundGroups(List <AppCore.User> groups, AppPreferences appPref, string KEY)
        {
            string json = LegionUtils.parceToGson(groups);

            appPref.saveKey(KEY, json);
        }
Exemple #14
0
        public void saveFoundVcards(List <User> contacts, AppPreferences appPref)
        {
            String json = LegionUtils.parceToGson(contacts);

            appPref.saveKey(AppPreferences.CONTACTS_VCARDS, json);
        }
Exemple #15
0
 public UserAdapter(User user, Activity activity)
 {
     this.user      = user;
     this.activity  = activity;
     appPreferences = new AppPreferences(activity.Application.ApplicationContext);
 }
Exemple #16
0
 public UserService(AppPreferences appPref)
 {
     this.appPreferences = appPref;
 }