Пример #1
0
        private async Task RefreshAdapter()
        {
            var adapter = new DiseasesAdapter(this);

            if (personalData != null)
            {
                adapter = new DiseasesAdapter(this, personalData.listOfPersonalDiseases);
            }

            FindViewById <TextView>(Resource.Id.tv_empty).Visibility = personalData.listOfPersonalDiseases.Count == 0
                ? ViewStates.Visible
                : ViewStates.Gone;

            rv.SetAdapter(adapter);
            adapter.NotifyDataSetChanged();
        }
Пример #2
0
        public async void LoadModel(bool updated)
        {
            var dialog = new ProgressBarDialog("Asteptati", "Se incarca datele...", this, false);

            dialog.Show();
            PersonView person = await CallServerToGetData();

            var adapter = new DiseasesAdapter(this);

            if (person != null)
            {
                LoadModelInView(person.Avatar, person.Name, person.Email, person.Gender, person.Birthdate, updated);
                adapter = new DiseasesAdapter(this, person.ListOfPersonalDiseases);
            }
            else
            {
                personalData = await ProfileStorage.GetInstance().read();

                if (personalData == null)
                {
                    Log.Error("ProfileActivity", "data from db is null");
                    Toast.MakeText(this, "Nu există date despre profilul dumneavoastră. Incercați să vă reautentificați.", ToastLength.Long);
                }
                else
                {
                    LoadModelInView(Utils.GetDefaults("Avatar"), Utils.GetDefaults("Name"), Utils.GetDefaults("Email"), personalData.Gender, personalData.DateOfBirth, updated);
                    adapter = new DiseasesAdapter(this, personalData.listOfPersonalDiseases);
                }
            }

            FindViewById <TextView>(Resource.Id.tv_empty).Visibility = adapter.ItemCount == 0
                ? ViewStates.Visible
                : ViewStates.Gone;

            rv.SetAdapter(adapter);
            adapter.NotifyDataSetChanged();



            RunOnUiThread(() => dialog.Dismiss());
        }