Exemplo n.º 1
0
        public async void ChooseImageOnClick(int position)
        {
            var granted = await checkCameraPermission();

            if (!granted)
            {
                return;
            }
            if (ChooseImageClick != null)
            {
                ChooseImageClick(this, position);
            }
            UserProfileActivity.ChangeVisibility();
            Thread backgroundThread = new Thread(new ThreadStart(() =>
            {
                Glide.Get(Application.Context).ClearDiskCache();
            }));

            backgroundThread.IsBackground = true;
            backgroundThread.Start();
            Glide.Get(context).ClearMemory();
            Glide.With(Application.Context)
            .Load(image_url)
            .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                   .SkipMemoryCache(true))
            //.Placeholder(Resource.Drawable.specialization_imageIV)
            .Into(groupHolder.profile_imageIV);
        }
Exemplo n.º 2
0
        public void cargaremulador(int console)
        {
            RunOnUiThread(() => {
                searchview.SetQuery("", true);
                SupportActionBar.Title = miselaneousmethods.consolelistformal[console];
            });
            try
            {
                Glide.Get(this).ClearMemory();
            }
            catch { }
            listaelementos.Clear();

            setdialog("Cargando lista de emuladores", "Por favor espere...");


            foreach (var ax in diccionarioemuladores[miselaneousmethods.consolelist[console]])
            {
                Models.romsinfos modelito = new Models.romsinfos
                {
                    Name     = ax.nombre,
                    InfoLink = ax.link,
                    Portrait = ax.imagen,
                    Region   = ax.compactible
                };

                /*    if (modelito.InfoLink.Contains("https://play.google.com/store/apps/details?id="))
                 *  {*/
                try {
                    if (miselaneousmethods.existepaquete(this, modelito.InfoLink.Split('=')[1]))
                    {
                        modelito.Region += " - instalado";
                    }
                }
                catch (Exception)
                {
                }
                //  }

                listaelementos.Add(modelito);
                modelito = new Models.romsinfos();
            }



            estado = 4;

            idimagen = resourceids[console];
            ///   listaelementos = listaelementos.OrderBy(c => c.nombre).ToList();

            var adaptadolllll = new adaptadorroms(this, listaelementos, resourceids[console]);

            RunOnUiThread(() => {
                listin.Adapter = adaptadolllll;
                dialogoprogreso.Dismiss();
                SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.home);
            });

            GC.Collect(0);
        }
        public void GlideStaticEqualsGlideGet()
        {
            var fromGet = Glide.Get(Platform.DefaultContext);

            var manager    = Glide.With(Platform.DefaultContext);
            var glideField = manager.GetType().GetProperty("Glide", BindingFlags.NonPublic | BindingFlags.Instance);
            var fromField  = glideField.GetValue(manager);

            Assert.Equal(fromGet, fromField);
        }
Exemplo n.º 4
0
        private async Task ClearStorage()
        {
            Utils.RemoveDefaults();
            await ClearBluetoothDevices();
            await ClearMedicationStorages();
            await ClearConversationsStorages();

            await Task.Run(() => { Glide.Get(this).ClearDiskCache(); });

            Glide.Get(this).ClearMemory();
        }
Exemplo n.º 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            try
            {
                SetContentView(Resource.Layout.DisplayPortfolioPhoto);
                activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator);
                activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                removeBn            = FindViewById <Button>(Resource.Id.removeBn);
                backRelativeLayout  = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout);
                back_button         = FindViewById <ImageButton>(Resource.Id.back_button);
                fullIV              = FindViewById <ImageView>(Resource.Id.fullIV);
                removeBn.Visibility = ViewStates.Gone;

                Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf");
                FindViewById <TextView>(Resource.Id.headerTV).SetTypeface(tf, TypefaceStyle.Bold);
                removeBn.SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.textView5).SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.your_city_valueTV).SetTypeface(tf, TypefaceStyle.Normal);

                backRelativeLayout.Click += (s, e) =>
                {
                    OnBackPressed();
                };
                back_button.Click += (s, e) =>
                {
                    OnBackPressed();
                };

                Thread backgroundThread = new Thread(new ThreadStart(() =>
                {
                    Glide.Get(Application.Context).ClearDiskCache();
                }));
                backgroundThread.IsBackground = true;
                backgroundThread.Start();
                Glide.Get(this).ClearMemory();
                if (!string.IsNullOrEmpty(image_url))
                {
                    Glide.With(Application.Context)
                    .Load(image_url)
                    .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                           .SkipMemoryCache(true))
                    //.Placeholder(Resource.Drawable.specialization_imageIV)
                    .Into(fullIV);
                }
                image_url = string.Empty;
            }
            catch
            {
                StartActivity(typeof(MainActivity));
            }
        }
        public adapterlistaremoto(Context context, List <string> nombreses, List <string> linkeses, string linkactuall = null, int placeholderid = 0)
        {
            //List<Android.Graphics.Bitmap> imageneses

            this.context   = context;
            nombres        = nombreses;
            links          = linkeses;
            linkactual     = linkactuall;
            newplaceholder = placeholderid;
            try {
                Glide.Get(context).ClearMemory();
            }
            catch (Exception) {
            }

            //  imagenes = imageneses;
        }
Exemplo n.º 7
0
        public void cargarconsola(int console)
        {
            RunOnUiThread(() => {
                searchview.SetQuery("", true);
                SupportActionBar.Title = miselaneousmethods.consolelistformal[console];
            });
            try
            {
                Glide.Get(this).ClearMemory();
            }
            catch {}
            listaelementos.Clear();

            setdialog("Cargando roms", "Por favor espere...");



            var todo = "";


            todo = listillaxx[console];

            listaelementos = JsonConvert.DeserializeObject <List <Models.romsinfos> >(todo);
            //////0-roms search
            //////1-rom downloads
            //////2-romselection
            estado         = 0;
            todo           = "";
            idimagen       = resourceids[console];
            listaelementos = listaelementos.OrderBy(c => c.Name).ToList();

            var adaptadolllll = new adaptadorroms(this, listaelementos, resourceids[console]);

            RunOnUiThread(() => {
                listin.Adapter = adaptadolllll;
                dialogoprogreso.Dismiss();
                SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.home);
                if (romcounts[selectedconsole] >= 500)
                {
                    Toast.MakeText(this, "Busqueda dinamica deshabilitada. Pulse enter para la busqueda", ToastLength.Long).Show();
                }
            });

            GC.Collect(0);
        }
Exemplo n.º 8
0
    public void GlobalSetup()
    {
        context = MainInstrumentation.Instance !.Context !;

        imageView = new AImageView(context);
        glide     = Glide.Get(context);
        handler   = new Handler(Looper.MainLooper !);

        var imageName = "dotnet_bot.png";
        var cacheDir  = FileSystem.CacheDirectory;

        imageFilename = Path.Combine(cacheDir, imageName);

        using (var s = context !.Assets !.Open(imageName))
            using (var w = File.Create(Path.Combine(cacheDir, imageName)))
            {
                s.CopyTo(w);
            }
    }
        protected override void OnDestroy()
        {
            listaimagen    = new List <VideoImage>();
            nombreses      = new List <string>();
            viddeos        = new List <Video>();
            linkeses       = new List <string>();
            imageneses     = new List <Bitmap>();
            imagenesesblur = new List <Bitmap>();

            listaimagen.Clear();
            try
            {
                Glide.Get(this).ClearMemory();
            }
            catch (Exception)
            {
            }
            MultiHelper.ExecuteGarbageCollection();
            base.OnDestroy();
        }
Exemplo n.º 10
0
        private static void TrimCache(Activity context)
        {
            try
            {
                File dir = context.CacheDir;
                if (dir != null && dir.IsDirectory)
                {
                    DeleteDir(dir);
                }

                context.DeleteDatabase("WoWonderMessenger.db");
                context.DeleteDatabase(SqLiteDatabase.PathCombine);

                Glide.Get(context).ClearDiskCache();
                Glide.Get(context).ClearMemory();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 11
0
        public adapterlistaoffline(Context context, List <string> nombreses, List <string> linkeses, string filtroo, List <string> todosnombres, Dictionary <string, int> dicci, List <string> pathesess)
        {
            //List<Android.Graphics.Bitmap> imageneses
            this.context = context;
            nombres      = nombreses;
            links        = linkeses;
            //  imagenes = imageneses;
            todoslosnombres = todosnombres;
            diccionario     = dicci;
            patheses        = pathesess;

            try
            {
                Glide.Get(context).SetMemoryCategory(MemoryCategory.Low);

                Glide.Get(context).ClearMemory();
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 12
0
        private static void TrimCache(Activity context)
        {
            try
            {
                File dir = context?.CacheDir;
                if (dir != null && dir.IsDirectory)
                {
                    DeleteDir(dir);
                }

                context?.DeleteDatabase("WowonderSocial.db");
                context?.DeleteDatabase(SqLiteDatabase.PathCombine);

                if (context?.IsDestroyed != false)
                {
                    return;
                }

                Glide.Get(context)?.ClearMemory();
                new Thread(() =>
                {
                    try
                    {
                        Glide.Get(context)?.ClearDiskCache();
                    }
                    catch (Exception e)
                    {
                        Methods.DisplayReportResultTrack(e);
                    }
                }).Start();
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemplo n.º 13
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            itemNode = listItems[position];

            if (itemNode.GetItemType() == 0)
            {
                group       = itemNode as UserProfileGroupData;
                groupHolder = holder as UserProfileExpandableGroupHolder;


                if (position == 0)
                {
                    groupHolder.headerRL.Visibility = ViewStates.Visible;
                    groupHolder.itemRL.Visibility   = ViewStates.Gone;
                    //if (image_url != null)
                    //{
                    Thread backgroundThread = new Thread(new ThreadStart(() =>
                    {
                        Glide.Get(Application.Context).ClearDiskCache();
                    }));
                    backgroundThread.IsBackground = true;
                    backgroundThread.Start();
                    Glide.Get(context).ClearMemory();
                    Glide.With(Application.Context)
                    .Load("https://api.iamnearby.net/" + group.avatarUrl)
                    .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                           .SkipMemoryCache(true))
                    //.Placeholder(Resource.Drawable.specialization_imageIV)
                    .Into(groupHolder.profile_imageIV);
                    //}
                    if (uri != null)
                    {
                        groupHolder.profile_imageIV.SetImageURI(uri);
                    }
                    if (bitmap != null)
                    {
                        groupHolder.profile_imageIV.SetImageBitmap(bitmap);
                    }

                    if (group.online)
                    {
                        groupHolder.onlyWithReviewsS.Checked = true;
                        groupHolder.onlineValueTV.Text       = context.GetString(Resource.String.online_text);
                        groupHolder.onlineValueTV.SetTextColor(Color.Green);
                    }
                    else
                    {
                        groupHolder.onlyWithReviewsS.Checked = false;
                        groupHolder.onlineValueTV.Text       = context.GetString(Resource.String.offline_text);
                        groupHolder.onlineValueTV.SetTextColor(Color.Red);
                    }
                    try
                    {
                        char[]   chars = { ' ' };
                        string[] split = group.expert_name.Split(chars);
                        groupHolder.expert_nameTV.Text = split[0];
                    }
                    catch
                    {
                        groupHolder.expert_nameTV.Text = group.expert_name;
                    }
                    try
                    {
                        groupHolder.reviewCountTV.Text  = group.review_count + " отзывов";
                        groupHolder.rating_valueTV.Text = group.rating.ToString();
                        double rating_value = 0;
                        try
                        {
                            rating_value = Convert.ToDouble(group.rating, (CultureInfo.InvariantCulture));
                            if (rating_value >= 1)
                            {
                                groupHolder.star1IV.SetBackgroundResource(Resource.Drawable.active_star);
                                if (rating_value >= 2)
                                {
                                    groupHolder.star2IV.SetBackgroundResource(Resource.Drawable.active_star);
                                    if (rating_value >= 3)
                                    {
                                        groupHolder.star3IV.SetBackgroundResource(Resource.Drawable.active_star);
                                        if (rating_value >= 4)
                                        {
                                            groupHolder.star4IV.SetBackgroundResource(Resource.Drawable.active_star);
                                            if (rating_value >= 5)
                                            {
                                                groupHolder.star5IV.SetBackgroundResource(Resource.Drawable.active_star);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        catch { }
                    }
                    catch { }
                }
                else
                {
                    groupHolder.headerRL.Visibility = ViewStates.Gone;
                    groupHolder.itemRL.Visibility   = ViewStates.Visible;
                }
                groupHolder.skillNameTV.Text = group.skill_name;
                groupHolder.skillNameTV.SetTypeface(tf, TypefaceStyle.Bold);
                groupHolder.expert_nameTV.SetTypeface(tf, TypefaceStyle.Bold);
                groupHolder.reviewCountTV.SetTypeface(tf, TypefaceStyle.Normal);
                groupHolder.rating_valueTV.SetTypeface(tf, TypefaceStyle.Normal);
                groupHolder.expert_nameTV.SetTypeface(tf, TypefaceStyle.Bold);
                groupHolder.onlineValueTV.SetTypeface(tf, TypefaceStyle.Normal);
                groupHolder.dsadas.SetTypeface(tf, TypefaceStyle.Normal);
                groupHolder.sdsddsddddwww.SetTypeface(tf, TypefaceStyle.Normal);
                groupHolder.sdsddsddddwwwwww.SetTypeface(tf, TypefaceStyle.Normal);

                if (position != listItems.Count - 1)
                {
                    groupHolder.bottom_separatorLL.Visibility = ViewStates.Gone;
                }
                else
                {
                    groupHolder.bottom_separatorLL.Visibility = ViewStates.Visible;
                }
            }
            else if (itemNode.GetItemType() == 1)
            {
                entry       = itemNode as UserProfileEntryData;
                holderEntry = holder as UserProfileExpandableItemHolder;

                holderEntry.skillNameTV.SetTypeface(tf, TypefaceStyle.Normal);
                holderEntry.skillNameTV.Text = entry.entryName;
            }
        }
Exemplo n.º 14
0
        protected override async void OnResume()
        {
            base.OnResume();
            try
            {
                ISharedPreferences       expert_feedback_pref = Application.Context.GetSharedPreferences("expert_feedback_pref", FileCreationMode.Private);
                ISharedPreferencesEditor edit_expert_feedback;
                ISharedPreferencesEditor edit = specialization_for_edit_pref.Edit();
                timer          = new System.Timers.Timer();
                timer.Interval = 100;

                if (userMethods.UserExists())
                {
                    SetContentView(Resource.Layout.FullProfile);
                    dialogsTV            = FindViewById <TextView>(Resource.Id.dialogsTV);
                    message_indicatorIV  = FindViewById <ImageView>(Resource.Id.message_indicatorIV);
                    profileLL            = FindViewById <LinearLayout>(Resource.Id.profileLL);
                    dialogsLL            = FindViewById <LinearLayout>(Resource.Id.dialogsLL);
                    specialistsLL        = FindViewById <LinearLayout>(Resource.Id.specialistsLL);
                    go_to_my_reviewsLL   = FindViewById <LinearLayout>(Resource.Id.go_to_my_reviewsLL);
                    singleDataScrollView = FindViewById <ScrollView>(Resource.Id.singleDataScrollView);
                    service_categs_list.Clear();
                    editBn              = FindViewById <Button>(Resource.Id.editBn);
                    profile_image       = FindViewById <ImageView>(Resource.Id.profile_image);
                    choose_photoIV      = FindViewById <ImageView>(Resource.Id.choose_photoIV);
                    add_skillIV         = FindViewById <Button>(Resource.Id.add_skillIV);
                    edit_skillIV        = FindViewById <ImageView>(Resource.Id.edit_skillIV);
                    edit_skillRL        = FindViewById <RelativeLayout>(Resource.Id.edit_skillRL);
                    tintLL              = FindViewById <LinearLayout>(Resource.Id.tintLL);
                    gridLL              = FindViewById <LinearLayout>(Resource.Id.gridLL);
                    recyclerView        = FindViewById <RecyclerView>(Resource.Id.recyclerView);
                    this.mLayoutManager = new LinearLayoutManager(this);
                    this.recyclerView.SetLayoutManager(mLayoutManager);
                    activityIndicator       = FindViewById <ProgressBar>(Resource.Id.activityIndicator);
                    expertNameTV            = FindViewById <TextView>(Resource.Id.expertNameTV);
                    skillNameTV             = FindViewById <TextView>(Resource.Id.skillNameTV);
                    onlineValueTV           = FindViewById <TextView>(Resource.Id.onlineValueTV);
                    rating_valueTV          = FindViewById <TextView>(Resource.Id.rating_valueTV);
                    description_text_dataTV = FindViewById <TextView>(Resource.Id.description_text_dataTV);
                    reviewCountTV           = FindViewById <TextView>(Resource.Id.reviewCountTV);
                    image_activityIndicator = FindViewById <ProgressBar>(Resource.Id.image_activityIndicator);
                    activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                    image_activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                    activityIndicator.Visibility = ViewStates.Visible;
                    ImageRL                     = FindViewById <RelativeLayout>(Resource.Id.ImageRL);
                    feedbackRL                  = FindViewById <RelativeLayout>(Resource.Id.feedbackRL);
                    onlineIV                    = FindViewById <ImageView>(Resource.Id.onlineIV);
                    onlyWithReviewsS            = FindViewById <Switch>(Resource.Id.onlyWithReviewsS);
                    specializationCV            = FindViewById <CardView>(Resource.Id.specializationCV);
                    specializationCV.Visibility = ViewStates.Gone;
                    go_to_my_reviewsLL.Click   += (s, e) =>
                    {
                        StartActivity(typeof(AllReviewsByMeActivity));
                    };

                    Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf");
                    FindViewById <TextView>(Resource.Id.specialistsTV).SetTypeface(tf, TypefaceStyle.Normal);
                    dialogsTV.SetTypeface(tf, TypefaceStyle.Normal);
                    FindViewById <TextView>(Resource.Id.profileTV).SetTypeface(tf, TypefaceStyle.Normal);
                    expertNameTV.SetTypeface(tf, TypefaceStyle.Bold);
                    FindViewById <TextView>(Resource.Id.dsadas).SetTypeface(tf, TypefaceStyle.Bold);
                    onlineValueTV.SetTypeface(tf, TypefaceStyle.Normal);
                    FindViewById <TextView>(Resource.Id.sdsddsddddwww).SetTypeface(tf, TypefaceStyle.Normal);
                    skillNameTV.SetTypeface(tf, TypefaceStyle.Bold);
                    FindViewById <TextView>(Resource.Id.textView1).SetTypeface(tf, TypefaceStyle.Normal);
                    description_text_dataTV.SetTypeface(tf, TypefaceStyle.Normal);
                    reviewCountTV.SetTypeface(tf, TypefaceStyle.Bold);
                    rating_valueTV.SetTypeface(tf, TypefaceStyle.Normal);
                    FindViewById <TextView>(Resource.Id.textsssView1).SetTypeface(tf, TypefaceStyle.Normal);
                    editBn.SetTypeface(tf, TypefaceStyle.Bold);
                    skillNameTV.SetTypeface(tf, TypefaceStyle.Bold);
                    add_skillIV.SetTypeface(tf, TypefaceStyle.Normal);

                    var token     = userMethods.GetUsersAuthToken();
                    var user_data = await profileAndExpertMethodsPCL.UserProfileData(token);

                    edit.PutString("user_data", user_data);
                    edit.Apply();
                    if (user_data == "401")
                    {
                        Toast.MakeText(this, Resource.String.you_not_logined, ToastLength.Long).Show();
                        userMethods.ClearTable();
                        userMethods.ClearUsersDataTable();
                        userMethods.ClearTableNotif();
                        StartActivity(typeof(MainActivity));
                        return;
                    }

                    userMethods.InsertProfileData(user_data);
                    dialogsLL.Click += (s, e) =>
                    {
                        edit_dialog = dialog_data.Edit();
                        edit_dialog.PutString("come_from", "Came directly from bottom");
                        edit_dialog.Apply();
                        StartActivity(typeof(ChatListActivity));
                    };
                    specialistsLL.Click += (s, e) =>
                    {
                        StartActivity(typeof(SpecialistsCategoryActivity));
                    };
                    activityIndicator.Visibility = ViewStates.Gone;
                    try
                    {
                        var deserialized_user_data = JsonConvert.DeserializeObject <UserProfile>(user_data);

                        if (deserialized_user_data.myReviews == "0")
                        {
                            go_to_my_reviewsLL.Visibility = ViewStates.Gone;
                        }

                        if (!String.IsNullOrEmpty(deserialized_user_data.notify_alerts.msg_cnt_new.ToString()) && deserialized_user_data.notify_alerts.msg_cnt_new.ToString() != "0")
                        {
                            message_indicatorIV.Visibility = ViewStates.Visible;
                            dialogsTV.Text = GetString(Resource.String.dialogs) + " (" + deserialized_user_data.notify_alerts.msg_cnt_new + ")";
                        }
                        else
                        {
                            message_indicatorIV.Visibility = ViewStates.Gone;
                            dialogsTV.Text = GetString(Resource.String.dialogs);
                        }

                        this.listItems = new List <IExpertProfileDataType>();
                        listItems.Add(new UserProfileGroupData(
                                          null,
                                          null,
                                          null,
                                          deserialized_user_data.avatarUrl,
                                          deserialized_user_data.reviews,
                                          deserialized_user_data.rating,
                                          deserialized_user_data.id,
                                          deserialized_user_data.aboutExpert,
                                          deserialized_user_data.fullName,
                                          deserialized_user_data.phone,
                                          deserialized_user_data.city.name,
                                          deserialized_user_data.distance,
                                          deserialized_user_data.online));
                        int count = 0;
                        foreach (var item in deserialized_user_data.mainCategories)
                        {
                            count++;
                            var spec_obj = new UserProfileGroupData(count, item.name, item.spec_id, deserialized_user_data.id, deserialized_user_data.avatarUrl, "", "", "");

                            if (item.subcategories != null)
                            {
                                foreach (var subitem in item.subcategories)
                                {
                                    UserProfileEntryData spec_data = new UserProfileEntryData(1, subitem.name, subitem.categoryId, count - 1, subitem.services, subitem.photos /*, item.rating, item.reviews*/, subitem.description);
                                    spec_obj.items.Add(spec_data);
                                }
                            }
                            listItems.Add(spec_obj);
                        }
                        ;
                        userProfileExpandableAdapter             = new UserProfileExpandableAdapter(this, listItems, deserialized_user_data, tf);
                        userProfileExpandableAdapter.GroupClick += OnGroupClick;
                        recyclerView.SetAdapter(userProfileExpandableAdapter);
                        singleDataScrollView.Visibility        = ViewStates.Gone;
                        recyclerView.Visibility                = ViewStates.Visible;
                        UserProfileExpandableAdapter.image_url = "https://api.iamnearby.net" + deserialized_user_data.avatarUrl;
                    }
                    catch
                    {
                        deserialized_user_data_categs_empty = JsonConvert.DeserializeObject <UserProfileServiceCategoriesEmpty>(user_data);
                        if (deserialized_user_data_categs_empty.myReviews == "0")
                        {
                            go_to_my_reviewsLL.Visibility = ViewStates.Gone;
                        }
                        if (!String.IsNullOrEmpty(deserialized_user_data_categs_empty.notify_alerts.msg_cnt_new.ToString()) && deserialized_user_data_categs_empty.notify_alerts.msg_cnt_new.ToString() != "0")
                        {
                            message_indicatorIV.Visibility = ViewStates.Visible;
                            dialogsTV.Text = GetString(Resource.String.dialogs) + " (" + deserialized_user_data_categs_empty.notify_alerts.msg_cnt_new + ")";
                        }
                        else
                        {
                            message_indicatorIV.Visibility = ViewStates.Gone;
                            dialogsTV.Text = GetString(Resource.String.dialogs);
                        }
                        specializationCV.Visibility     = ViewStates.Gone;
                        singleDataScrollView.Visibility = ViewStates.Visible;
                        recyclerView.Visibility         = ViewStates.Gone;
                        /*var d = */
                        Thread backgroundThread = new Thread(new ThreadStart(() =>
                        {
                            Glide.Get(Application.Context).ClearDiskCache();
                        }));
                        backgroundThread.IsBackground = true;
                        backgroundThread.Start();
                        Glide.Get(this).ClearMemory();
                        Glide.With(Application.Context)
                        .Load("https://api.iamnearby.net/" + deserialized_user_data_categs_empty.avatarUrl)
                        .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                               .SkipMemoryCache(true))
                        //.Placeholder(Resource.Drawable.specialization_imageIV)
                        .Into(profile_image);

                        profile_image.Click += (s, e) =>
                        {
                            if (!String.IsNullOrEmpty(deserialized_user_data_categs_empty.avatarUrl))
                            {
                                DisplayMyPhotoActivity.image_url = "https://api.iamnearby.net" + deserialized_user_data_categs_empty.avatarUrl;
                                StartActivity(typeof(DisplayMyPhotoActivity));
                            }
                        };

                        if (deserialized_user_data_categs_empty.online)
                        {
                            onlineValueTV.SetTextColor(Color.Green);
                            onlyWithReviewsS.Checked = true;
                            onlineValueTV.Text       = GetString(Resource.String.online_text);
                        }
                        else
                        {
                            onlyWithReviewsS.Checked = false;
                            onlineValueTV.Text       = GetString(Resource.String.offline_text);
                            onlineValueTV.SetTextColor(Color.Red);
                        }

                        expertNameTV.Text = deserialized_user_data_categs_empty.fullName;
                        try
                        {
                            skillNameTV.Text = deserialized_user_data_categs_empty.serviceCategories[1].ToString();
                        }
                        catch { }
                    }
                    onlyWithReviewsS.CheckedChange += async(s, e) =>
                    {
                        if (onlyWithReviewsS.Checked)
                        {
                            onlineValueTV.Text = GetString(Resource.String.online_text);
                            onlineValueTV.SetTextColor(Color.Green);
                            var res = await profileAndExpertMethods.EditMyOnline(userMethods.GetUsersAuthToken(), true);
                        }
                        else
                        {
                            onlineValueTV.SetTextColor(Color.Red);
                            onlineValueTV.Text = GetString(Resource.String.offline_text);
                            var res = await profileAndExpertMethods.EditMyOnline(userMethods.GetUsersAuthToken(), false);
                        }
                    };

                    var folder = Android.OS.Environment.ExternalStorageDirectory + Java.IO.File.Separator + "DCIM/Camera";
                    if (!Directory.Exists(folder))
                    {
                        Directory.CreateDirectory(folder);
                    }

                    //var filesList
                    List <string> filesList = new List <string>();
                    try
                    {
                        filesList = Directory.GetFiles(folder).ToList <string>();
                    }
                    catch (Exception ex)
                    {
                    }
                    var reverseList = filesList.AsEnumerable().Reverse().ToList <string>();
                    reverseList.Insert(0, Resource.Drawable.open_camera.ToString());
                    reverseList.Insert(1, Resource.Drawable.open_gallery.ToString());

                    var gridview = FindViewById <GridView>(Resource.Id.gridview);
                    gridview.Adapter = new ImageAdapter(this, reverseList, Resources.DisplayMetrics.WidthPixels);

                    gridview.ItemClick += async delegate(object sender, AdapterView.ItemClickEventArgs args)
                    {
                        previous_base64 = "dsaads";

                        if (args.Position > 1)
                        {
                            Glide.With(Application.Context)
                            .Load(reverseList[args.Position])
                            //.Placeholder(Resource.Drawable.specialization_imageIV)
                            .Into(profile_image);
                            new UserProfileExpandableAdapter().LoadImage(reverseList[args.Position], null, null);
                            try { userProfileExpandableAdapter.NotifyDataSetChanged(); } catch { }
                        }
                        else if (args.Position == 0)
                        {
                            if (pictureMethods.IsThereAnAppToTakePictures(this))
                            {
                                PictureMethods.cameraOrGalleryIndicator = "camera";
                                pictureMethods.CreateDirectoryForPictures();
                                pictureMethods.TakeAPicture(this);
                            }
                        }
                        else if (args.Position == 1)
                        {
                            PictureMethods.cameraOrGalleryIndicator = "gallery";
                            var imageIntent = new Intent();
                            imageIntent.SetType("image/*");
                            //imageIntent.SetType("file/*");
                            imageIntent.SetAction(Intent.ActionGetContent);
                            StartActivityForResult(
                                Intent.CreateChooser(imageIntent, "Select photo"), 0);
                        }

                        if (args.Position > 1)
                        {
                            if (!String.IsNullOrEmpty(previous_base64))
                            {
                                try
                                {
                                    chosen_bitmap = ((BitmapDrawable)profile_image.Drawable).Bitmap;
                                    MemoryStream chosen_memStream = new MemoryStream();
                                    chosen_bitmap.Compress(Bitmap.CompressFormat.Png, 0, chosen_memStream);
                                    byte[] chosen_ba = chosen_memStream.ToArray();
                                    chosen_base64 = Base64.EncodeToString(chosen_ba, Base64.Default);
                                }
                                catch { }
                                timer.Elapsed += delegate
                                {
                                    try
                                    {
                                        chosen_bitmap = ((BitmapDrawable)profile_image.Drawable).Bitmap;
                                        MemoryStream chosen_memStream = new MemoryStream();
                                        chosen_bitmap.Compress(Bitmap.CompressFormat.Jpeg, 90, chosen_memStream);
                                        byte[] chosen_ba = chosen_memStream.ToArray();
                                        chosen_base64 = Base64.EncodeToString(chosen_ba, Base64.Default);
                                        if (chosen_base64 != previous_base64)
                                        {
                                            RunOnUiThread(async() =>
                                            {
                                                var res = await upload_avatar();
                                                if (res != null)
                                                {
                                                    timer.Stop();
                                                    var intent = new Intent(this, typeof(UserProfileActivity));
                                                    intent.SetFlags(ActivityFlags.NoHistory);
                                                    intent.SetFlags(ActivityFlags.NewTask);
                                                    StartActivity(intent);
                                                    Finish();
                                                }
                                            });
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                };
                                timer.Start();
                                timer.Enabled = true;
                            }
                        }
                    };

                    tintLL.Click += (s, e) =>
                    {
                        add_skillIV.Visibility = ViewStates.Visible;
                        tintLL.Visibility      = ViewStates.Gone;
                        gridLL.Visibility      = ViewStates.Gone;
                    };
                    add_skillIV.Click += (s, e) =>
                    {
                        StartActivity(typeof(YourSpecializationActivity));
                    };
                    editBn.Click += (s, e) =>
                    {
                        StartActivity(typeof(PersonalDataActivity));
                    };

                    choose_photoIV.Click += async(s, e) =>
                    {
                        var granted = await checkCameraPermission();

                        if (!granted)
                        {
                            return;
                        }
                        if (tintLL.Visibility == ViewStates.Visible)
                        {
                            tintLL.Visibility      = ViewStates.Gone;
                            gridLL.Visibility      = ViewStates.Gone;
                            add_skillIV.Visibility = ViewStates.Visible;
                        }
                        else
                        {
                            tintLL.Visibility      = ViewStates.Visible;
                            gridLL.Visibility      = ViewStates.Visible;
                            add_skillIV.Visibility = ViewStates.Gone;
                        }
                    };
                }
            }
            catch
            {
                StartActivity(typeof(MainActivity));
            }
        }
Exemplo n.º 15
0
 protected override void OnDestroy()
 {
     Glide.Get(this).ClearMemory();
     System.GC.Collect(0);
     base.OnDestroy();
 }
Exemplo n.º 16
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            var    dialogViewHolder     = (DialogViewHolder)holder;
            string message_time         = messages_list_static[position].timestamp.date.Substring(11, 8);
            string current_message_date = messages_list_static[position].timestamp.date.Substring(0, 10);

            dialogViewHolder.dateTV.SetTypeface(tf, TypefaceStyle.Normal);
            dialogViewHolder.message_from_meTV.SetTypeface(tf, TypefaceStyle.Normal);
            dialogViewHolder.file_from_meTV.SetTypeface(tf, TypefaceStyle.Normal);
            dialogViewHolder.time_from_meTV.SetTypeface(tf, TypefaceStyle.Normal);
            dialogViewHolder.date_from_meTV.SetTypeface(tf, TypefaceStyle.Normal);
            dialogViewHolder.message_from_expertTV.SetTypeface(tf, TypefaceStyle.Normal);
            dialogViewHolder.file_from_expertTV.SetTypeface(tf, TypefaceStyle.Normal);
            dialogViewHolder.time_from_expertTV.SetTypeface(tf, TypefaceStyle.Normal);
            dialogViewHolder.date_from_expertTV.SetTypeface(tf, TypefaceStyle.Normal);


            if (messages_list_static[position].in_out == "0")
            {
                dialogViewHolder.dateTV.Visibility                = ViewStates.Gone;
                dialogViewHolder.message_from_meLL.Visibility     = ViewStates.Gone;
                dialogViewHolder.message_from_expertLL.Visibility = ViewStates.Visible;
                dialogViewHolder.date_from_expertTV.Text          = current_message_date;
                dialogViewHolder.time_from_expertTV.Text          = message_time;

                if (messages_list_static[position].message != "message_text_empty")
                {
                    dialogViewHolder.message_from_expertTV.Text = messages_list_static[position].message;
                }
                else
                {
                    dialogViewHolder.message_from_expertTV.Visibility = ViewStates.Gone;
                }
                if (!String.IsNullOrEmpty(messages_list_static[position].file))
                {
                    if (messages_list_static[position].file.ToLower().Contains(".jpg") ||
                        messages_list_static[position].file.Contains(".png") ||
                        messages_list_static[position].file.Contains(".jpeg"))
                    {
                        dialogViewHolder.activityIndicator_from_expert.IndeterminateDrawable.SetColorFilter(_context.Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                        dialogViewHolder.image_from_expertRL.Visibility = ViewStates.Visible;
                        Thread backgroundThread = new Thread(new ThreadStart(() =>
                        {
                            Glide.Get(Application.Context).ClearDiskCache();
                        }));
                        backgroundThread.IsBackground = true;
                        backgroundThread.Start();
                        Glide.Get(_context).ClearMemory();
                        Glide.With(Application.Context)
                        .Load(messages_list_static[position].file_small)
                        .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                               .SkipMemoryCache(true))
                        .Into(dialogViewHolder.imageFromExpertIV);
                    }
                    else
                    {
                        int pos = messages_list_static[position].file.LastIndexOf("/") + 1;
                        dialogViewHolder.file_from_expertTV.PaintFlags  = PaintFlags.UnderlineText;
                        dialogViewHolder.doc_from_expertLL.Visibility   = ViewStates.Visible;
                        dialogViewHolder.image_from_expertRL.Visibility = ViewStates.Gone;

                        if (messages_list_static[position].file.ToLower().Contains(".mp"))
                        {
                            dialogViewHolder.doc_from_expertIV.SetBackgroundResource(Resource.Drawable.voice_attach);
                            dialogViewHolder.file_from_expertTV.Text = _context.GetString(Resource.String.voice_message);
                        }
                        else
                        {
                            dialogViewHolder.doc_from_expertIV.SetBackgroundResource(Resource.Drawable.document_pick);
                            dialogViewHolder.file_from_expertTV.Text = (messages_list_static[position].file.Substring(pos, messages_list_static[position].file.Length - pos));
                        }

                        if (String.IsNullOrEmpty(messages_list_static[position].message))
                        {
                            dialogViewHolder.message_from_expertTV.Visibility = ViewStates.Gone;
                        }
                        else
                        {
                            dialogViewHolder.message_from_expertTV.Visibility = ViewStates.Visible;
                        }
                    }
                }
                else
                {
                    dialogViewHolder.image_from_expertRL.Visibility = ViewStates.Gone;
                    dialogViewHolder.doc_from_expertLL.Visibility   = ViewStates.Gone;
                }
            }
            else if (messages_list_static[position].in_out == "1")
            {
                dialogViewHolder.dateTV.Visibility                = ViewStates.Gone;
                dialogViewHolder.message_from_meLL.Visibility     = ViewStates.Visible;
                dialogViewHolder.message_from_expertLL.Visibility = ViewStates.Gone;
                dialogViewHolder.date_from_meTV.Text              = current_message_date;
                dialogViewHolder.time_from_meTV.Text              = message_time;
                if (messages_list_static[position].message != "message_text_empty")
                {
                    dialogViewHolder.message_from_meTV.Text = messages_list_static[position].message;
                }
                else
                {
                    dialogViewHolder.message_from_meTV.Visibility = ViewStates.Gone;
                }
                if (!String.IsNullOrEmpty(messages_list_static[position].file))
                {
                    if (messages_list_static[position].file.ToLower().Contains(".jpg") ||
                        messages_list_static[position].file.Contains(".png") ||
                        messages_list_static[position].file.Contains(".jpeg"))
                    {
                        dialogViewHolder.activityIndicator_from_me.IndeterminateDrawable.SetColorFilter(_context.Resources.GetColor(Resource.Color.lightLightBlueColor), Android.Graphics.PorterDuff.Mode.Multiply);
                        dialogViewHolder.image_from_meRL.Visibility = ViewStates.Visible;
                        Thread backgroundThread = new Thread(new ThreadStart(() =>
                        {
                            Glide.Get(Application.Context).ClearDiskCache();
                        }));
                        backgroundThread.IsBackground = true;
                        backgroundThread.Start();
                        Glide.Get(_context).ClearMemory();
                        Glide.With(Application.Context)
                        .Load(messages_list_static[position].file_small)
                        .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                               .SkipMemoryCache(true))
                        .Into(dialogViewHolder.imageFromMeIV);
                    }
                    else
                    {
                        int pos = messages_list_static[position].file.LastIndexOf("/") + 1;

                        dialogViewHolder.file_from_meTV.PaintFlags  = PaintFlags.UnderlineText;
                        dialogViewHolder.doc_from_meLL.Visibility   = ViewStates.Visible;
                        dialogViewHolder.image_from_meRL.Visibility = ViewStates.Gone;
                        if (messages_list_static[position].file.ToLower().Contains(".mp"))
                        {
                            dialogViewHolder.doc_from_meIV.SetBackgroundResource(Resource.Drawable.voice_attach);
                            dialogViewHolder.file_from_meTV.Text = _context.GetString(Resource.String.voice_message);
                        }
                        else
                        {
                            dialogViewHolder.doc_from_meIV.SetBackgroundResource(Resource.Drawable.document_pick);
                            dialogViewHolder.file_from_meTV.Text = (messages_list_static[position].file.Substring(pos, messages_list_static[position].file.Length - pos));
                        }
                        if (String.IsNullOrEmpty(messages_list_static[position].message))
                        {
                            dialogViewHolder.message_from_meTV.Visibility = ViewStates.Gone;
                        }
                        else
                        {
                            dialogViewHolder.message_from_meTV.Visibility = ViewStates.Visible;
                        }
                    }
                }
                else
                {
                    dialogViewHolder.image_from_meRL.Visibility = ViewStates.Gone;
                    dialogViewHolder.doc_from_meLL.Visibility   = ViewStates.Gone;
                }
                if (messages_list_static[position].read == "1")
                {
                    dialogViewHolder.read_markIV.Visibility = ViewStates.Visible;
                }
                else
                {
                    dialogViewHolder.read_markIV.Visibility = ViewStates.Gone;
                }
            }
            else if (messages_list_static[position].in_out == "2")
            {
                string message_date_prev = null;
                try { message_date_prev = messages_list_static[position - 1].timestamp.date.Substring(11, 8); }
                catch { message_date_prev = null; }

                if (!String.IsNullOrEmpty(message_date_prev))
                {
                    if (current_message_date == message_date_prev)
                    {
                        dialogViewHolder.dateTV.Visibility = ViewStates.Gone;
                    }
                    else
                    {
                        dialogViewHolder.dateTV.Visibility = ViewStates.Visible;
                    }
                }
                if (current_message_date != date_today)
                {
                    dialogViewHolder.dateTV.Text = current_message_date;
                }
                else
                {
                    dialogViewHolder.dateTV.Text = _context.GetString(Resource.String.today);
                }
            }
            if (position == 0)
            {
                dialogViewHolder.dateTV.Visibility = ViewStates.Visible;
                if (current_message_date != date_today)
                {
                    dialogViewHolder.dateTV.Text = current_message_date;
                }
                else
                {
                    dialogViewHolder.dateTV.Text = _context.GetString(Resource.String.today);
                }
            }
            if (position == messages_list_static.Count - 1)
            {
                dialogViewHolder.dateTV.Visibility = ViewStates.Gone;
            }
            if (messages_list_static[position].in_out != "2")
            {
                if (position > 0)
                {
                    dialogViewHolder.dateTV.Visibility = ViewStates.Gone;
                }
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            try
            {
                SetContentView(Resource.Layout.DisplayPortfolioPhoto);

                activityIndicatorDel = FindViewById <ProgressBar>(Resource.Id.activityIndicatorDel);
                tint_DelLL           = FindViewById <RelativeLayout>(Resource.Id.tint_DelLL);
                noTV              = FindViewById <TextView>(Resource.Id.noTV);
                yesTV             = FindViewById <TextView>(Resource.Id.yesTV);
                activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator);
                activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                activityIndicatorDel.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                removeBn           = FindViewById <Button>(Resource.Id.removeBn);
                backRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout);
                back_button        = FindViewById <ImageButton>(Resource.Id.back_button);
                fullIV             = FindViewById <ImageView>(Resource.Id.fullIV);

                Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf");
                FindViewById <TextView>(Resource.Id.headerTV).SetTypeface(tf, TypefaceStyle.Bold);
                removeBn.SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.textView5).SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.your_city_valueTV).SetTypeface(tf, TypefaceStyle.Normal);
                yesTV.SetTypeface(tf, TypefaceStyle.Normal);
                noTV.SetTypeface(tf, TypefaceStyle.Normal);

                tint_DelLL.Click += (s, e) =>
                {
                    tint_DelLL.Visibility = ViewStates.Gone;
                };
                yesTV.Click += async(s, e) =>
                {
                    activityIndicatorDel.Visibility = ViewStates.Visible;
                    var res = await profileAndExpertMethods.DeletePhoto(userMethods.GetUsersAuthToken(), image_url, specialization_for_edit_pref.GetString("categoryId", String.Empty));

                    var res_reload = await addServiceActivity.ReloadData();

                    activityIndicatorDel.Visibility = ViewStates.Gone;
                    tint_DelLL.Visibility           = ViewStates.Gone;
                    //StartActivity(typeof(UserProfileActivity));
                    OnBackPressed();
                };

                noTV.Click += (s, e) =>
                {
                    tint_DelLL.Visibility = ViewStates.Gone;
                };

                backRelativeLayout.Click += (s, e) =>
                {
                    OnBackPressed();
                };
                back_button.Click += (s, e) =>
                {
                    OnBackPressed();
                };

                Thread backgroundThread = new Thread(new ThreadStart(() =>
                {
                    Glide.Get(Application.Context).ClearDiskCache();
                }));
                backgroundThread.IsBackground = true;
                backgroundThread.Start();
                Glide.Get(this).ClearMemory();
                Glide.With(Application.Context)
                .Load(image_url)
                .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                       .SkipMemoryCache(true))
                //.Placeholder(Resource.Drawable.specialization_imageIV)
                .Into(fullIV);

                removeBn.Click += (s, e) =>
                {
                    tint_DelLL.Visibility = ViewStates.Visible;
                };
                if (!from_expert)
                {
                    removeBn.Visibility = ViewStates.Visible;
                }
                else
                {
                    removeBn.Visibility = ViewStates.Gone;
                }
            }
            catch
            {
                StartActivity(typeof(MainActivity));
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            try
            {
                SetContentView(Resource.Layout.AnswerFeedback);
                back_button          = FindViewById <ImageButton>(Resource.Id.back_button);
                backRelativeLayout   = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout);
                expert_data_layoutRL = FindViewById <RelativeLayout>(Resource.Id.expert_data_layoutRL);
                tintLL            = (RelativeLayout)FindViewById(Resource.Id.tintLL);
                expert_nameTV     = (TextView)FindViewById(Resource.Id.expert_nameTV);
                activityIndicator = (ProgressBar)FindViewById(Resource.Id.activityIndicator);
                activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);

                star1IV        = (ImageView)FindViewById(Resource.Id.star1IV);
                star2IV        = (ImageView)FindViewById(Resource.Id.star2IV);
                star3IV        = (ImageView)FindViewById(Resource.Id.star3IV);
                star4IV        = (ImageView)FindViewById(Resource.Id.star4IV);
                star5IV        = (ImageView)FindViewById(Resource.Id.star5IV);
                onlineIV       = (ImageView)FindViewById(Resource.Id.onlineIV);
                rating_valueTV = (TextView)FindViewById(Resource.Id.rating_value_TV);
                expert_imageIV = (ImageView)FindViewById(Resource.Id.expert_imageIV);
                reviewTextTV   = (TextView)FindViewById(Resource.Id.reviewTextTV);
                dateTV         = (TextView)FindViewById(Resource.Id.dateTV);
                yesTV          = (TextView)FindViewById(Resource.Id.yesTV);
                noTV           = (TextView)FindViewById(Resource.Id.noTV);
                sendBn         = (Button)FindViewById(Resource.Id.sendBn);
                feedbackET     = (EditText)FindViewById(Resource.Id.feedbackET);

                expert_nameTV.Text = Intent.GetStringExtra("review_name");
                star1IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                star2IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                star3IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                star4IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                star5IV.SetBackgroundResource(Resource.Drawable.disabled_star);

                rating_valueTV.Text = Intent.GetStringExtra("review_rating");
                dateTV.Text         = Intent.GetStringExtra("review_date");

                Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf");
                FindViewById <TextView>(Resource.Id.headerTV).SetTypeface(tf, TypefaceStyle.Bold);
                expert_nameTV.SetTypeface(tf, TypefaceStyle.Bold);
                FindViewById <TextView>(Resource.Id.count_specs).SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.rating_value_TV).SetTypeface(tf, TypefaceStyle.Normal);
                dateTV.SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.distanceTV).SetTypeface(tf, TypefaceStyle.Normal);
                reviewTextTV.SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.textVssiew1).SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.textView5).SetTypeface(tf, TypefaceStyle.Normal);
                feedbackET.SetTypeface(tf, TypefaceStyle.Normal);
                sendBn.SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.your_city_valueTV).SetTypeface(tf, TypefaceStyle.Normal);
                yesTV.SetTypeface(tf, TypefaceStyle.Normal);
                noTV.SetTypeface(tf, TypefaceStyle.Normal);


                back_button.Click += (s, e) =>
                {
                    OnBackPressed();
                };
                backRelativeLayout.Click += (s, e) =>
                {
                    OnBackPressed();
                };

                if (Intent.GetStringExtra("review_online") == "true")
                {
                    onlineIV.Visibility = ViewStates.Visible;
                }
                else
                {
                    onlineIV.Visibility = ViewStates.Gone;
                }

                reviewTextTV.Text = Intent.GetStringExtra("review_text");

                Thread backgroundThread = new Thread(new ThreadStart(() =>
                {
                    Glide.Get(Application.Context).ClearDiskCache();
                }));
                backgroundThread.IsBackground = true;
                backgroundThread.Start();
                Glide.Get(this).ClearMemory();
                if (!Intent.GetStringExtra("review_image_url").Contains("iamn"))
                {
                    Glide.With(Application.Context)
                    .Load("https://api.iamnearby.net/" + Intent.GetStringExtra("review_image_url"))
                    .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                           .SkipMemoryCache(true))
                    //.Placeholder(Resource.Drawable.specialization_imageIV)
                    .Into(expert_imageIV);
                }
                else
                {
                    Glide.With(Application.Context)
                    .Load(Intent.GetStringExtra("review_image_url"))
                    .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                           .SkipMemoryCache(true))
                    //.Placeholder(Resource.Drawable.specialization_imageIV)
                    .Into(expert_imageIV);
                }
                double rating_value = 0;
                try
                {
                    rating_value = Convert.ToDouble(Intent.GetStringExtra("review_rating"), (CultureInfo.InvariantCulture));
                    if (rating_value >= 1)
                    {
                        star1IV.SetBackgroundResource(Resource.Drawable.active_star);
                        if (rating_value >= 2)
                        {
                            star2IV.SetBackgroundResource(Resource.Drawable.active_star);
                            if (rating_value >= 3)
                            {
                                star3IV.SetBackgroundResource(Resource.Drawable.active_star);
                                if (rating_value >= 4)
                                {
                                    star4IV.SetBackgroundResource(Resource.Drawable.active_star);
                                    if (rating_value >= 5)
                                    {
                                        star5IV.SetBackgroundResource(Resource.Drawable.active_star);
                                    }
                                }
                            }
                        }
                    }
                }
                catch { }

                sendBn.Click += (s, e) =>
                {
                    if (!String.IsNullOrEmpty(feedbackET.Text))
                    {
                        tintLL.Visibility = ViewStates.Visible;
                    }
                };

                yesTV.Click += async(s, e) =>
                {
                    if (!String.IsNullOrEmpty(feedbackET.Text))
                    {
                        tintLL.Visibility            = ViewStates.Gone;
                        activityIndicator.Visibility = ViewStates.Visible;
                        sendBn.Visibility            = ViewStates.Gone;
                        var res = await feedbacks.ReplyReview(userMethods.GetUsersAuthToken(), Intent.GetStringExtra("review_id"), feedbackET.Text);

                        activityIndicator.Visibility = ViewStates.Gone;
                        sendBn.Visibility            = ViewStates.Visible;
                        if (checkInternetConnection())
                        {
                            StartActivity(typeof(MyReviewsListActivity));
                        }
                        else
                        {
                            Toast.MakeText(this, Resource.String.turn_internet_on, ToastLength.Long).Show();
                        }
                    }
                };
                noTV.Click += (s, e) =>
                {
                    tintLL.Visibility = ViewStates.Gone;
                };
                tintLL.Click += (s, e) =>
                {
                    tintLL.Visibility = ViewStates.Gone;
                };
                expert_data_layoutRL.Click += (s, e) =>
                {
                    edit_expert = expert_data.Edit();
                    edit_expert.PutString("expert_id", Intent.GetStringExtra("expertId"));
                    edit_expert.Apply();
                    StartActivity(typeof(ThreeLevelExpertProfileActivity));
                };
            }
            catch
            {
                StartActivity(typeof(MainActivity));
            }
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            try
            {
                SetContentView(Resource.Layout.Feedback);
                expert_nameTV        = FindViewById <TextView>(Resource.Id.expert_nameTV);
                expert_data_layoutRL = FindViewById <RelativeLayout>(Resource.Id.expert_data_layoutRL);
                phoneTV            = FindViewById <TextView>(Resource.Id.phoneTV);
                specializationTV   = FindViewById <TextView>(Resource.Id.specializationTV);
                expert_imageIV     = FindViewById <ImageView>(Resource.Id.expert_imageIV);
                star1IV            = FindViewById <ImageView>(Resource.Id.star1IV);
                star2IV            = FindViewById <ImageView>(Resource.Id.star2IV);
                star3IV            = FindViewById <ImageView>(Resource.Id.star3IV);
                star4IV            = FindViewById <ImageView>(Resource.Id.star4IV);
                star5IV            = FindViewById <ImageView>(Resource.Id.star5IV);
                onlineIV           = FindViewById <ImageView>(Resource.Id.onlineIV);
                back_button        = FindViewById <ImageButton>(Resource.Id.back_button);
                backRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout);
                feedbackET         = FindViewById <EditText>(Resource.Id.feedbackET);
                InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator);
                activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                sendBn = FindViewById <Button>(Resource.Id.sendBn);
                Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf");
                FindViewById <TextView>(Resource.Id.headerTV).SetTypeface(tf, TypefaceStyle.Bold);
                expert_nameTV.SetTypeface(tf, TypefaceStyle.Bold);
                FindViewById <TextView>(Resource.Id.count_specs).SetTypeface(tf, TypefaceStyle.Normal);
                phoneTV.SetTypeface(tf, TypefaceStyle.Normal);
                specializationTV.SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.distanceTV).SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.textView111).SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.textVwiew1).SetTypeface(tf, TypefaceStyle.Normal);
                feedbackET.SetTypeface(tf, TypefaceStyle.Normal);
                sendBn.SetTypeface(tf, TypefaceStyle.Normal);

                backRelativeLayout.Click += (s, e) =>
                {
                    OnBackPressed();
                };
                back_button.Click += (s, e) =>
                {
                    OnBackPressed();
                };
                string[] name = expert_feedback_pref.GetString("expert_name", String.Empty).Split(new char[] { ' ' });
                expert_nameTV.Text    = name[0];
                phoneTV.Text          = expert_feedback_pref.GetString("expert_phone", String.Empty);
                specializationTV.Text = expert_feedback_pref.GetString("expert_category_name", String.Empty);
                if (expert_feedback_pref.GetBoolean("expert_online", false))
                {
                    onlineIV.Visibility = ViewStates.Visible;
                }
                else
                {
                    onlineIV.Visibility = ViewStates.Gone;
                }
                Thread backgroundThread = new Thread(new ThreadStart(() =>
                {
                    Glide.Get(Application.Context).ClearDiskCache();
                }));
                backgroundThread.IsBackground = true;
                backgroundThread.Start();
                Glide.Get(this).ClearMemory();


                var expert_avatar = expert_feedback_pref.GetString("expert_avatar", String.Empty);
                if (!expert_avatar.Contains("api.iam"))
                {
                    Glide.With(Application.Context)
                    .Load("https://api.iamnearby.net/" + expert_avatar)
                    .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                           .SkipMemoryCache(true))
                    //.Placeholder(Resource.Drawable.specialization_imageIV)
                    .Into(expert_imageIV);
                }
                else
                {
                    Glide.With(Application.Context)
                    .Load(expert_avatar)
                    .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                           .SkipMemoryCache(true))
                    //.Placeholder(Resource.Drawable.specialization_imageIV)
                    .Into(expert_imageIV);
                }

                int mark = 0;

                star1IV.Click += (s, e) =>
                {
                    star1IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star2IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                    star3IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                    star4IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                    star5IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                    mark = 1;
                };
                star2IV.Click += (s, e) =>
                {
                    star1IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star2IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star3IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                    star4IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                    star5IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                    mark = 2;
                };
                star3IV.Click += (s, e) =>
                {
                    star1IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star2IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star3IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star4IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                    star5IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                    mark = 3;
                };
                star4IV.Click += (s, e) =>
                {
                    star1IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star2IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star3IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star4IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star5IV.SetBackgroundResource(Resource.Drawable.disabled_star);
                    mark = 4;
                };
                star5IV.Click += (s, e) =>
                {
                    star1IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star2IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star3IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star4IV.SetBackgroundResource(Resource.Drawable.active_star);
                    star5IV.SetBackgroundResource(Resource.Drawable.active_star);
                    mark = 5;
                };
                feedbackET.EditorAction += (object sender, EditText.EditorActionEventArgs e) =>
                {
                    imm.HideSoftInputFromWindow(feedbackET.WindowToken, 0);
                };
                sendBn.Click += async(s, e) =>
                {
                    if (mark > 0)
                    {
                        if (!String.IsNullOrEmpty(feedbackET.Text))
                        {
                            activityIndicator.Visibility = ViewStates.Visible;
                            sendBn.Visibility            = ViewStates.Gone;

                            var send_new_review = await feedbacks.SendNewReview(userMethods.GetUsersAuthToken(), expert_feedback_pref.GetString("expert_id", String.Empty), feedbackET.Text, expert_feedback_pref.GetString("expert_category_id", String.Empty), mark.ToString());

                            activityIndicator.Visibility = ViewStates.Gone;
                            sendBn.Visibility            = ViewStates.Visible;

                            if (!send_new_review.ToLower().Contains("ельзя оставить от"))
                            {
                                if (checkInternetConnection())
                                {
                                    StartActivity(typeof(FeedbackSentActivity));
                                }
                                else
                                {
                                    Toast.MakeText(this, Resource.String.turn_internet_on, ToastLength.Long).Show();
                                }
                            }
                            else
                            {
                                Toast.MakeText(this, GetString(Resource.String.cannot_leave_feedback_for_me), ToastLength.Short).Show();
                            }
                        }
                    }
                    else
                    {
                        Toast.MakeText(this, GetString(Resource.String.leave_rating_please), ToastLength.Short).Show();
                    }
                };
                expert_data_layoutRL.Click += (s, e) =>
                {
                    edit_expert = expert_data.Edit();
                    edit_expert.PutString("expert_id", expert_feedback_pref.GetString("expert_id", String.Empty));
                    edit_expert.Apply();
                    StartActivity(typeof(ThreeLevelExpertProfileActivity));
                };
            }
            catch
            {
                StartActivity(typeof(MainActivity));
            }
        }
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            IExpertProfileDataType itemNode = listItems[position];

            if (itemNode.GetItemType() == 0)
            {
                ExpertGroupData             group       = itemNode as ExpertGroupData;
                GroupExpertThreeLevelHolder groupHolder = holder as GroupExpertThreeLevelHolder;


                if (position == 0)
                {
                    AboutExpertActivity.InfoText    = group.aboutExpertInfo;
                    groupHolder.headerRL.Visibility = ViewStates.Visible;
                    groupHolder.itemRL.Visibility   = ViewStates.Gone;

                    groupHolder.expertNameTV.SetTypeface(tf, TypefaceStyle.Bold);
                    groupHolder.expertSurnameTV.SetTypeface(tf, TypefaceStyle.Bold);
                    groupHolder.expert_phoneTV.SetTypeface(tf, TypefaceStyle.Normal);
                    groupHolder.aboutExpertTitle.SetTypeface(tf, TypefaceStyle.Bold);
                    groupHolder.aboutExpertInfo.SetTypeface(tf, TypefaceStyle.Normal);
                    groupHolder.writeTV.SetTypeface(tf, TypefaceStyle.Bold);
                    groupHolder.callTV.SetTypeface(tf, TypefaceStyle.Bold);
                    groupHolder.cityTV.SetTypeface(tf, TypefaceStyle.Normal);
                    groupHolder.nowTitle.SetTypeface(tf, TypefaceStyle.Bold);
                    groupHolder.distanceTV.SetTypeface(tf, TypefaceStyle.Normal);
                    groupHolder.rating_valueTV.SetTypeface(tf, TypefaceStyle.Bold);
                    groupHolder.expert_phoneTV.Text = group.expert_phone;

                    char[]   chars = { ' ' };
                    string[] split = group.expertName.Split(chars);
                    try
                    {
                        string name       = split[0];
                        string middlename = split[1];
                        groupHolder.expertNameTV.Text    = name + " " + middlename;
                        groupHolder.expertSurnameTV.Text = split[2];
                    }
                    catch
                    {
                        groupHolder.expertNameTV.Text       = group.expertName;
                        groupHolder.expertNameTV.Visibility = ViewStates.Visible;
                    }
                    Thread backgroundThread = new Thread(new ThreadStart(() =>
                    {
                        Glide.Get(Application.Context).ClearDiskCache();
                    }));
                    backgroundThread.IsBackground = true;
                    backgroundThread.Start();
                    Glide.Get(context).ClearMemory();
                    Glide.With(Application.Context)
                    .Load("https://api.iamnearby.net/" + group.profile_image)
                    .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                           .SkipMemoryCache(true))
                    //.Placeholder(Resource.Drawable.specialization_imageIV)
                    .Into(groupHolder.profile_image);

                    groupHolder.cityTV.Text = group.city;
                    if (group.online)
                    {
                        groupHolder.onlineIV.Visibility = ViewStates.Visible;
                    }
                    else
                    {
                        groupHolder.onlineIV.Visibility = ViewStates.Gone;
                    }
                    double distance_in_km;
                    bool   distance_in_km_parsed = Double.TryParse(group.distance, out distance_in_km);
                    if (distance_in_km > 999)
                    {
                        distance_in_km = distance_in_km / 1000;
                        var final_dist = Math.Round(distance_in_km, 2).ToString().Replace(',', '.');
                        groupHolder.distanceTV.Text = final_dist + " км";
                    }
                    else
                    {
                        groupHolder.distanceTV.Text = group.distance + " м";
                    }
                    if (!String.IsNullOrEmpty(group.aboutExpertInfo))
                    {
                        groupHolder.aboutExpertRL.Visibility = ViewStates.Visible;
                        groupHolder.aboutExpertInfo.Text     = group.aboutExpertInfo;
                    }
                    else
                    {
                        groupHolder.aboutExpertRL.Visibility = ViewStates.Gone;
                    }

                    groupHolder.rating_valueTV.Text = "(" + group.rating_value.ToString() + ")";
                    double rating_value = 0;
                    try
                    {
                        rating_value = Convert.ToDouble(group.rating_value, (CultureInfo.InvariantCulture));
                        if (rating_value >= 1)
                        {
                            groupHolder.star1IV.SetBackgroundResource(Resource.Drawable.active_star);
                            if (rating_value >= 2)
                            {
                                groupHolder.star2IV.SetBackgroundResource(Resource.Drawable.active_star);
                                if (rating_value >= 3)
                                {
                                    groupHolder.star3IV.SetBackgroundResource(Resource.Drawable.active_star);
                                    if (rating_value >= 4)
                                    {
                                        groupHolder.star4IV.SetBackgroundResource(Resource.Drawable.active_star);
                                        if (rating_value >= 5)
                                        {
                                            groupHolder.star5IV.SetBackgroundResource(Resource.Drawable.active_star);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch { }
                }
                else
                {
                    groupHolder.headerRL.Visibility = ViewStates.Gone;
                    groupHolder.itemRL.Visibility   = ViewStates.Visible;
                    groupHolder.skillNameTV.Text    = group.upper_categ;
                    groupHolder.skillNameTV.SetTypeface(tf, TypefaceStyle.Bold);
                }
            }
            else if (itemNode.GetItemType() == 1)
            {
                ExpertEntryData entry = itemNode as ExpertEntryData;
                holderEntry = holder as EntryHolder;

                holderEntry.descriptionTitleTV.SetTypeface(tf, TypefaceStyle.Bold);
                holderEntry.description_text_dataTV.SetTypeface(tf, TypefaceStyle.Normal);
                holderEntry.services_and_pricesTV.SetTypeface(tf, TypefaceStyle.Bold);
                holderEntry.portfolioTitleTV.SetTypeface(tf, TypefaceStyle.Bold);
                if (!String.IsNullOrEmpty(entry.description))
                {
                    holderEntry.description_text_dataTV.Text = entry.description;
                }
                else
                {
                    holderEntry.description_text_dataTV.Text = _context.GetString(Resource.String.no_data);
                }

                holderEntry.layoutManager_services = new LinearLayoutManager(this.context, LinearLayoutManager.Vertical, false);
                holderEntry.recyclerViewServices.SetLayoutManager(holderEntry.layoutManager_services);
                var serv_temp_list = new List <ServiceData>();

                if (entry.services != null)
                {
                    holderEntry.recyclerViewServices.Visibility  = ViewStates.Visible;
                    holderEntry.services_and_pricesTV.Visibility = ViewStates.Visible;
                    foreach (var d in entry.services)
                    {
                        serv_temp_list.Add(new ServiceData()
                        {
                            name = d.name, price = d.price
                        });
                    }
                }
                else
                {
                    holderEntry.recyclerViewServices.Visibility  = ViewStates.Gone;
                    holderEntry.services_and_pricesTV.Visibility = ViewStates.Gone;
                }
                var services_and_pricesAdapter = new ServicesAndPricesForExpertAdapter(serv_temp_list, _context, tf);
                holderEntry.recyclerViewServices.SetAdapter(services_and_pricesAdapter);

                holderEntry.portfolio_layoutManager = new LinearLayoutManager(this.context, LinearLayoutManager.Horizontal, false);
                holderEntry.portfolio_recyclerView.SetLayoutManager(holderEntry.portfolio_layoutManager);
                try
                {
                    var image_list = new List <string>();
                    int count_     = 0;
                    if (entry.photos == null)
                    {
                        count_ = 0;
                    }
                    else
                    {
                        count_ = entry.photos.Count;
                        int i = 0;
                        foreach (var img in entry.photos)
                        {
                            var current_img = JsonConvert.DeserializeObject <CategoryImage>(entry.photos[i].ToString());
                            image_list.Add(current_img.imageUrl);
                            i++;
                            if (i == count_)
                            {
                                break;
                            }
                        }
                    }
                    var portfolioAdapter = new PortfolioExpertAdapter(image_list, _context);
                    holderEntry.portfolio_recyclerView.SetAdapter(portfolioAdapter);
                    if (count_ < 1)
                    {
                        holderEntry.portfolioTitleTV.Visibility       = ViewStates.Gone;
                        holderEntry.portfolio_recyclerView.Visibility = ViewStates.Gone;
                    }
                    else
                    {
                        holderEntry.portfolioTitleTV.Visibility       = ViewStates.Visible;
                        holderEntry.portfolio_recyclerView.Visibility = ViewStates.Visible;
                    }
                }
                catch
                {
                    holderEntry.portfolioTitleTV.Visibility       = ViewStates.Gone;
                    holderEntry.portfolio_recyclerView.Visibility = ViewStates.Gone;
                }
            }
            else if (itemNode.GetItemType() == 2)
            {
                ExpertGroupData2             group2       = itemNode as ExpertGroupData2;
                GroupExpertThreeLevelHolder2 groupHolder2 = holder as GroupExpertThreeLevelHolder2;
                groupHolder2.itemRL.Visibility = ViewStates.Visible;
                groupHolder2.skillNameTV.Text  = group2.subcategory;
                groupHolder2.skillNameTV.SetTypeface(tf, TypefaceStyle.Normal);
            }
        }