protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); try { SetContentView(Resource.Layout.ListOfSpecialists); dialogsTV = FindViewById <TextView>(Resource.Id.dialogsTV); message_indicatorIV = FindViewById <ImageView>(Resource.Id.message_indicatorIV); inputMethodManager = Application.GetSystemService(Context.InputMethodService) as InputMethodManager; InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); searchET = FindViewById <EditText>(Resource.Id.searchET); expert_data = Application.Context.GetSharedPreferences("experts", FileCreationMode.Private); edit_expert = expert_data.Edit(); loginRegFragment = new LoginRegFragment(); fragmentManager = this.FragmentManager; offset = 100; headerTV = FindViewById <TextView>(Resource.Id.headerTV); typesTV = FindViewById <TextView>(Resource.Id.typesTV); headerTV.Text = expert_data.GetString("spec_name", String.Empty);; typesTV.Text = expert_data.GetString("spec_type", String.Empty); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); recyclerViewDropdown = FindViewById <RecyclerView>(Resource.Id.recyclerViewDropdown); linearLayout7644 = FindViewById <RelativeLayout>(Resource.Id.linearLayout7644); activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); activityIndicatorSearch = FindViewById <ProgressBar>(Resource.Id.activityIndicatorSearch); nothingIV = FindViewById <ImageView>(Resource.Id.nothingIV); backRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout); nothingTV = FindViewById <TextView>(Resource.Id.nothingTV); searchLL = FindViewById <LinearLayout>(Resource.Id.searchLL); search_recyclerView = FindViewById <RecyclerView>(Resource.Id.search_recyclerView); bottomLayout = FindViewById <RelativeLayout>(Resource.Id.bottomLayout); upper_layout = FindViewById <RelativeLayout>(Resource.Id.upper_layout); back_button = FindViewById <ImageButton>(Resource.Id.back_button); dropdownBn = FindViewById <Button>(Resource.Id.dropdownBn); searchBn = FindViewById <Button>(Resource.Id.searchBn); sortBn = FindViewById <Button>(Resource.Id.sortBn); filterBn = FindViewById <Button>(Resource.Id.filterBn); close_searchBn = FindViewById <ImageButton>(Resource.Id.close_searchBn); navbarLL = FindViewById <RelativeLayout>(Resource.Id.navbarLL); tintLL = FindViewById <LinearLayout>(Resource.Id.tintLL); //sorting sortLL = FindViewById <LinearLayout>(Resource.Id.sortLL); by_distanceLL = FindViewById <RelativeLayout>(Resource.Id.by_distanceLL); by_ratingLL = FindViewById <RelativeLayout>(Resource.Id.by_ratingLL); by_distanceIV = FindViewById <ImageView>(Resource.Id.by_distanceIV); by_ratingIV = FindViewById <ImageView>(Resource.Id.by_ratingIV); by_distanceTV = FindViewById <TextView>(Resource.Id.by_distanceTV); by_ratingTV = FindViewById <TextView>(Resource.Id.by_ratingTV); //sorting ENDED show_on_mapBn = FindViewById <Button>(Resource.Id.show_on_mapBn); activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); activityIndicatorSearch.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); layoutManagerDropdown = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); search_layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); recyclerViewDropdown.SetLayoutManager(layoutManagerDropdown); search_recyclerView.SetLayoutManager(search_layoutManager); SpecializationMethods specializationMethods = new SpecializationMethods(); profileLL = FindViewById <LinearLayout>(Resource.Id.profileLL); dialogsLL = FindViewById <LinearLayout>(Resource.Id.dialogsLL); Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf"); headerTV.SetTypeface(tf, TypefaceStyle.Bold); typesTV.SetTypeface(tf, TypefaceStyle.Normal); dropdownBn.SetTypeface(tf, TypefaceStyle.Normal); searchET.SetTypeface(tf, TypefaceStyle.Normal); searchBn.SetTypeface(tf, TypefaceStyle.Normal); show_on_mapBn.SetTypeface(tf, TypefaceStyle.Bold); filterBn.SetTypeface(tf, TypefaceStyle.Normal); sortBn.SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.specialistsTV).SetTypeface(tf, TypefaceStyle.Normal); dialogsTV.SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.profileTV).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textVsiew1).SetTypeface(tf, TypefaceStyle.Normal); by_distanceTV.SetTypeface(tf, TypefaceStyle.Normal); by_ratingTV.SetTypeface(tf, TypefaceStyle.Normal); nothingTV.SetTypeface(tf, TypefaceStyle.Normal); dialogsLL.Click += (s, e) => { if (userMethods.UserExists()) { edit_dialog = dialog_data.Edit(); edit_dialog.PutString("come_from", "Came directly from bottom"); edit_dialog.Apply(); StartActivity(typeof(ChatListActivity)); } else { showFragment(); } }; profileLL.Click += (s, e) => { if (userMethods.UserExists()) { StartActivity(typeof(UserProfileActivity)); } else { showFragment(); } }; searchET.Visibility = ViewStates.Gone; backRelativeLayout.Click += (s, e) => { OnBackPressed(); }; back_button.Click += (s, e) => { OnBackPressed(); }; searchBn.Click += (s, e) => { close_searchBn.Visibility = ViewStates.Visible; searchET.Visibility = ViewStates.Visible; searchBn.Visibility = ViewStates.Gone; dropdownBn.Visibility = ViewStates.Gone; headerTV.Visibility = ViewStates.Gone; typesTV.Visibility = ViewStates.Gone; searchET.RequestFocus(); showKeyboard(); }; sortBn.Click += (s, e) => { tintLL.Visibility = ViewStates.Visible; sortLL.Visibility = ViewStates.Visible; }; by_distanceLL.Click += By_distance_Click; by_distanceIV.Click += By_distance_Click; by_distanceTV.Click += By_distance_Click; by_ratingLL.Click += By_rating_Click; by_ratingIV.Click += By_rating_Click; by_ratingTV.Click += By_rating_Click; if (expert_data.GetInt("sort_meth", 1) == 1) { by_distanceIV.Visibility = ViewStates.Visible; by_ratingIV.Visibility = ViewStates.Gone; } else { by_distanceIV.Visibility = ViewStates.Gone; by_ratingIV.Visibility = ViewStates.Visible; } var sort_type = expert_data.GetInt("sort_meth", 1); var specs = await specializationMethods.ExpertsList( expert_data.GetString("spec_id", String.Empty), pref.GetString("latitude", String.Empty), pref.GetString("longitude", String.Empty), expert_data.GetInt("sort_meth", 1), expert_data.GetString("expert_city_id", String.Empty), expert_data.GetString("distance_radius", String.Empty), expert_data.GetBoolean("has_reviews", false)//, this ); activityIndicator.Visibility = ViewStates.Gone; try { if (specs != "null" && !String.IsNullOrEmpty(specs)) { var deserialized_experts = JsonConvert.DeserializeObject <RootObjectExpert>(specs.ToString()); if (!String.IsNullOrEmpty(deserialized_experts.notify_alerts.msg_cnt_new.ToString()) && deserialized_experts.notify_alerts.msg_cnt_new.ToString() != "0") { message_indicatorIV.Visibility = ViewStates.Visible; dialogsTV.Text = GetString(Resource.String.dialogs) + " (" + deserialized_experts.notify_alerts.msg_cnt_new + ")"; } else { message_indicatorIV.Visibility = ViewStates.Gone; dialogsTV.Text = GetString(Resource.String.dialogs); } listOfSpecialistsAdapter = new ListOfSpecialistsAdapter(deserialized_experts.experts, this, tf); recyclerView.SetAdapter(listOfSpecialistsAdapter); //Toast.MakeText(this, "десериализовано. адаптер задан", ToastLength.Short).Show(); } } catch { } show_on_mapBn.Click += (s, e) => { edit_expert.PutString("latitude", pref.GetString("latitude", String.Empty)); edit_expert.PutString("longitude", pref.GetString("longitude", String.Empty)); edit_expert.PutString("spec_id", expert_data.GetString("spec_id", String.Empty)); edit_expert.PutString("specs", specs); edit_expert.PutString("spec_name", expert_data.GetString("spec_name", String.Empty)); edit_expert.PutString("spec_type", expert_data.GetString("spec_type", String.Empty)); edit_expert.PutBoolean("has_subcategory", expert_data.GetBoolean("has_subcategory", false)); edit_expert.Apply(); StartActivity(typeof(SpecialistsOnMapActivity)); }; dropdown_closed = true; dropdownBn.Click += (s, e) => dropdownClick(); linearLayout7644.Click += (s, e) => { if (dropdownBn.Visibility == ViewStates.Visible) { dropdownClick(); } }; bool types_visible = false; if (typesTV.Visibility == ViewStates.Visible) { types_visible = true; } ScrollDownDetector downDetector = new ScrollDownDetector(); ScrollUpDetector upDetector = new ScrollUpDetector(); var margin_top_value = navbarLL.LayoutParameters.Height; LinearLayout.LayoutParams ll_down = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); LinearLayout.LayoutParams ll_up = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); ll_down.SetMargins(0, 0, 0, 0); ll_up.SetMargins(0, margin_top_value, 0, 0); System.Timers.Timer timer = new System.Timers.Timer(); System.Timers.Timer timer2 = null; downDetector.Action = () => { if (dropdown_closed) { timer = new System.Timers.Timer(); timer.Interval = 500; timer.Start(); timer.Elapsed += (s, e) => { timer.Stop(); timer = null; }; if (timer2 == null) { upper_layout.LayoutParameters = ll_down; } } }; upDetector.Action = () => { timer2 = new System.Timers.Timer(); if (dropdown_closed) { if (timer == null) { timer2.Interval = 500; timer2.Start(); timer2.Elapsed += (s, e) => { timer2.Stop(); timer2 = null; }; upper_layout.LayoutParameters = ll_up; } } }; recyclerView.AddOnScrollListener(downDetector); recyclerView.AddOnScrollListener(upDetector); filterBn.Click += (s, e) => { StartActivity(typeof(FilterActivity)); }; searchET.EditorAction += (object sender, EditText.EditorActionEventArgs e) => { imm.HideSoftInputFromWindow(searchET.WindowToken, 0); }; searchET.TextChanged += async(s, e) => { if (!String.IsNullOrEmpty(searchET.Text)) { nothingIV.Visibility = ViewStates.Gone; nothingTV.Visibility = ViewStates.Gone; searchLL.Visibility = ViewStates.Visible; close_searchBn.Visibility = ViewStates.Visible; activityIndicatorSearch.Visibility = ViewStates.Visible; search_recyclerView.Visibility = ViewStates.Gone; activityIndicatorSearch.Visibility = ViewStates.Visible; var search_content = await specializationMethods.SearchCategory(searchET.Text); if (!search_content.ToLower().Contains("пошло не так".ToLower()) && !search_content.Contains("null")) //try { search_recyclerView.Visibility = ViewStates.Visible; deserialized_search = JsonConvert.DeserializeObject <List <SearchCategory> >(search_content.ToString()); List <SearchDisplaying> searchDisplayings = new List <SearchDisplaying>(); foreach (var item in deserialized_search) { if (item.hasSubcategory) { searchDisplayings.Add(new SearchDisplaying { id = item.id, name = item.name, iconUrl = item.iconUrl, isRoot = true, hasSubcategory = true, rootId = item.id }); if (item.subcategories != null) { foreach (var item1 in item.subcategories) { if (item1.hasSubcategory) { searchDisplayings.Add(new SearchDisplaying { id = item1.id, name = item1.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id }); if (item1.subcategories != null) { foreach (var item2 in item1.subcategories) { if (item2.hasSubcategory) { searchDisplayings.Add(new SearchDisplaying { id = item2.id, name = item2.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id }); if (item2.subcategories != null) { foreach (var item3 in item2.subcategories) { if (item3.subcategories != null) { searchDisplayings.Add(new SearchDisplaying { id = item3.id, name = item3.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id }); foreach (var item4 in item3.subcategories) { searchDisplayings.Add(new SearchDisplaying { id = item4.id, name = item4.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id }); } } else { searchDisplayings.Add(new SearchDisplaying { id = item3.id, name = item3.name, iconUrl = null, isRoot = false, hasSubcategory = false, rootId = item.id }); } } } } else { searchDisplayings.Add(new SearchDisplaying { id = item2.id, name = item2.name, iconUrl = null, isRoot = false, hasSubcategory = false, rootId = item.id }); } } } } else { searchDisplayings.Add(new SearchDisplaying { id = item1.id, name = item1.name, iconUrl = null, isRoot = false, hasSubcategory = false, rootId = item.id }); } } } } else { searchDisplayings.Add(new SearchDisplaying { id = item.id, name = item.name, iconUrl = item.iconUrl, isRoot = true, hasSubcategory = false, rootId = item.id }); } } specialistsCategorySearchAdapter = new SpecialistsCategorySearchAdapter(searchDisplayings, this, tf); specialistsCategorySearchAdapter.NotifyDataSetChanged(); search_recyclerView.SetAdapter(specialistsCategorySearchAdapter); specialistsCategorySearchAdapter.NotifyDataSetChanged(); nothingIV.Visibility = ViewStates.Gone; nothingTV.Visibility = ViewStates.Gone; } else { search_recyclerView.Visibility = ViewStates.Gone; nothingIV.Visibility = ViewStates.Visible; nothingTV.Visibility = ViewStates.Visible; } activityIndicatorSearch.Visibility = ViewStates.Gone; } else { close_searchBn.Visibility = ViewStates.Gone; searchLL.Visibility = ViewStates.Visible; close_searchBn.Visibility = ViewStates.Gone; searchLL.Visibility = ViewStates.Visible; searchLL.Visibility = ViewStates.Gone; } }; tintLL.Click += (s, e) => { tintLL.Visibility = ViewStates.Gone; recyclerViewDropdown.Visibility = ViewStates.Gone; tintLL.Visibility = ViewStates.Gone; dropdown_closed = true; sortLL.Visibility = ViewStates.Gone; dropdownBn.SetBackgroundResource(Resource.Drawable.dropdown); }; refresher = FindViewById <SwipyRefreshLayout>(Resource.Id.refresher); refresher.SetColorScheme(Resource.Color.lightBlueColor, Resource.Color.buttonBackgroundColor); refresher.Direction = SwipyRefreshLayoutDirection.Bottom; refresher.Refresh += async delegate { var specs_updated = await specializationMethods.ExpertsList( expert_data.GetString("spec_id", String.Empty), pref.GetString("latitude", String.Empty), pref.GetString("longitude", String.Empty), expert_data.GetInt("sort_meth", 1), expert_data.GetString("expert_city_id", String.Empty), expert_data.GetString("distance_radius", String.Empty), expert_data.GetBoolean("has_reviews", false),//, this offset ); try { if (!String.IsNullOrEmpty(specs_updated) && specs_updated.Length > 10) { var deserialized_updated_specs = JsonConvert.DeserializeObject <RootObjectExpert>(specs_updated); ListOfSpecialistsAdapter.experts_static.InsertRange(offset, deserialized_updated_specs.experts); if (!String.IsNullOrEmpty(deserialized_updated_specs.notify_alerts.msg_cnt_new.ToString()) && deserialized_updated_specs.notify_alerts.msg_cnt_new.ToString() != "0") { message_indicatorIV.Visibility = ViewStates.Visible; dialogsTV.Text = GetString(Resource.String.dialogs) + " (" + deserialized_updated_specs.notify_alerts.msg_cnt_new + ")"; } else { message_indicatorIV.Visibility = ViewStates.Gone; dialogsTV.Text = GetString(Resource.String.dialogs); } listOfSpecialistsAdapter.NotifyDataSetChanged(); recyclerView.SmoothScrollToPosition(offset); offset += 100; } } catch { } refresher.Refreshing = false; }; //checking if category has subcategories to load them if (expert_data.GetBoolean("has_subcategory", true)) { var sub_categs = await specializationMethods.GetSubCategories(expert_data.GetString("spec_id", String.Empty)); var deserObj = JsonConvert.DeserializeObject <SubCategoryRootObject>(sub_categs.ToString()); if (!String.IsNullOrEmpty(deserObj.notify_alerts.msg_cnt_new.ToString()) && deserObj.notify_alerts.msg_cnt_new.ToString() != "0") { message_indicatorIV.Visibility = ViewStates.Visible; dialogsTV.Text = GetString(Resource.String.dialogs) + " (" + deserObj.notify_alerts.msg_cnt_new + ")"; } else { message_indicatorIV.Visibility = ViewStates.Gone; dialogsTV.Text = GetString(Resource.String.dialogs); } deserialized_sub_categs = deserObj.subcategories; if (deserialized_sub_categs == null) { deserialized_sub_categs = new List <SubCategory>(); } deserialized_sub_categs.Insert(0, new SubCategory { id = "-1", name = GetString(Resource.String.all_subcategs) }); var dropDownSubcategsAdapter = new DropDownSubcategsAdapter(deserialized_sub_categs, this, tf); recyclerViewDropdown.SetAdapter(dropDownSubcategsAdapter); dropdownBn.Visibility = ViewStates.Visible; typesTV.Visibility = ViewStates.Visible; } else { dropdownBn.Visibility = ViewStates.Gone; } bool was_drop_visible = false; if (dropdownBn.Visibility == ViewStates.Visible) { was_drop_visible = true; } close_searchBn.Click += (s, e) => { searchET.Text = null; imm.HideSoftInputFromWindow(searchET.WindowToken, 0); searchLL.Visibility = ViewStates.Gone; if (types_visible) { typesTV.Visibility = ViewStates.Visible; } if (was_drop_visible) { dropdownBn.Visibility = ViewStates.Visible; } headerTV.Visibility = ViewStates.Visible; searchET.Visibility = ViewStates.Gone; close_searchBn.Visibility = ViewStates.Gone; searchBn.Visibility = ViewStates.Visible; }; } catch { StartActivity(typeof(MainActivity)); } }
protected override async void OnResume() { base.OnResume(); try { SetContentView(Resource.Layout.ChatList); InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); var date = DateTime.Now; string day = date.Day.ToString(); if (day.Length < 2) { day = day.Insert(0, "0"); } string month = date.Month.ToString(); if (month.Length < 2) { month = month.Insert(0, "0"); } date_now = day + "." + month + "." + date.Year; activity = this; profileLL = FindViewById <LinearLayout>(Resource.Id.profileLL); dialogsLL = FindViewById <LinearLayout>(Resource.Id.dialogsLL); specialistsLL = FindViewById <LinearLayout>(Resource.Id.specialistsLL); message_indicatorIV = FindViewById <ImageView>(Resource.Id.message_indicatorIV); inputMethodManager = Application.GetSystemService(Context.InputMethodService) as InputMethodManager; dialogsTV = FindViewById <TextView>(Resource.Id.dialogsTV); activityIndicatorSearch = FindViewById <ProgressBar>(Resource.Id.activityIndicatorSearch); activityIndicatorSearch.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); activityIndicatorAccept = FindViewById <ProgressBar>(Resource.Id.activityIndicatorAccept); activityIndicatorAccept.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); bottomLayout = FindViewById <RelativeLayout>(Resource.Id.bottomLayout); title_acceptTV = FindViewById <TextView>(Resource.Id.title_acceptTV); yes_acceptTV = FindViewById <TextView>(Resource.Id.yes_acceptTV); no_acceptTV = FindViewById <TextView>(Resource.Id.no_acceptTV); tint_acceptLL = FindViewById <RelativeLayout>(Resource.Id.tint_acceptLL); search_recyclerView = FindViewById <RecyclerView>(Resource.Id.search_recyclerView); search_layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); searchET = FindViewById <EditText>(Resource.Id.searchET); searchBn = FindViewById <Button>(Resource.Id.searchBn); close_searchBn = FindViewById <ImageButton>(Resource.Id.close_searchBn); searchLL = FindViewById <LinearLayout>(Resource.Id.searchLL); nothingIV = FindViewById <ImageView>(Resource.Id.nothingIV); nothingTV = FindViewById <TextView>(Resource.Id.nothingTV); Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf"); no_acceptTV.Click += (s, e) => { tint_acceptLL.Visibility = ViewStates.Gone; }; tint_acceptLL.Click += (s, e) => { tint_acceptLL.Visibility = ViewStates.Gone; }; searchBn.Click += (s, e) => { close_searchBn.Visibility = ViewStates.Visible; searchET.Visibility = ViewStates.Visible; searchBn.Visibility = ViewStates.Gone; headerTV.Visibility = ViewStates.Gone; searchET.RequestFocus(); showKeyboard(); }; close_searchBn.Click += (s, e) => { searchET.Text = null; imm.HideSoftInputFromWindow(searchET.WindowToken, 0); searchLL.Visibility = ViewStates.Gone; headerTV.Visibility = ViewStates.Visible; searchET.Visibility = ViewStates.Gone; close_searchBn.Visibility = ViewStates.Gone; searchBn.Visibility = ViewStates.Visible; }; search_recyclerView.SetLayoutManager(search_layoutManager); searchET.TextChanged += async(s, e) => { if (!String.IsNullOrEmpty(searchET.Text)) { nothingIV.Visibility = ViewStates.Gone; nothingTV.Visibility = ViewStates.Gone; searchLL.Visibility = ViewStates.Visible; close_searchBn.Visibility = ViewStates.Visible; activityIndicatorSearch.Visibility = ViewStates.Visible; search_recyclerView.Visibility = ViewStates.Gone; activityIndicatorSearch.Visibility = ViewStates.Visible; var search_content = await dialogMethods.SearchChat(userMethods.GetUsersAuthToken(), searchET.Text); if (!search_content.ToLower().Contains("пошло не так".ToLower()) && !search_content.Contains("null")) //try { search_recyclerView.Visibility = ViewStates.Visible; var deserObj = JsonConvert.DeserializeObject <RootObjectChatList>(search_content); deserialized_obj_search = deserObj.chats; if (deserialized_obj_search.Count > 0) { dialogsSearchListAdapter = new DialogsListAdapter(deserialized_obj_search, this, tf, date_now); search_recyclerView.SetAdapter(dialogsSearchListAdapter); dialogsSearchListAdapter.NotifyDataSetChanged(); nothingIV.Visibility = ViewStates.Gone; nothingTV.Visibility = ViewStates.Gone; } else { search_recyclerView.Visibility = ViewStates.Gone; nothingIV.Visibility = ViewStates.Visible; nothingTV.Visibility = ViewStates.Visible; } } //catch else { search_recyclerView.Visibility = ViewStates.Gone; nothingIV.Visibility = ViewStates.Visible; nothingTV.Visibility = ViewStates.Visible; } activityIndicatorSearch.Visibility = ViewStates.Gone; } else { close_searchBn.Visibility = ViewStates.Gone; searchLL.Visibility = ViewStates.Visible; close_searchBn.Visibility = ViewStates.Gone; searchLL.Visibility = ViewStates.Visible; searchLL.Visibility = ViewStates.Gone; } }; specialistsLL.Click += (s, e) => { StartActivity(typeof(SpecialistsCategoryActivity)); }; profileLL.Click += (s, e) => { if (userMethods.UserExists()) { StartActivity(typeof(UserProfileActivity)); } }; activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); activityIndicator.Visibility = ViewStates.Visible; recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); headerTV = FindViewById <TextView>(Resource.Id.headerTV); back_button = FindViewById <ImageButton>(Resource.Id.back_button); backRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout); headerTV.Text = GetString(Resource.String.dialogs); backRelativeLayout.Click += (s, e) => { OnBackPressed(); }; back_button.Click += (s, e) => { OnBackPressed(); }; activityIndicator.Visibility = ViewStates.Visible; emptyRL = FindViewById <RelativeLayout>(Resource.Id.emptyRL); refresher = FindViewById <SwipyRefreshLayout>(Resource.Id.refresher); headerTV.SetTypeface(tf, TypefaceStyle.Bold); FindViewById <EditText>(Resource.Id.searchET).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <Button>(Resource.Id.searchBn).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textView1).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textView122).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.specialistsTV).SetTypeface(tf, TypefaceStyle.Normal); dialogsTV.SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.profileTV).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textView1sdds).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.by_distanceTV).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.by_ratingTV).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.nothingTV).SetTypeface(tf, TypefaceStyle.Normal); var res = await dialogMethods.ChatList(userMethods.GetUsersAuthToken()); activityIndicator.Visibility = ViewStates.Gone; try { var deserObj = JsonConvert.DeserializeObject <RootObjectChatList>(res); if (!String.IsNullOrEmpty(deserObj.notify_alerts.msg_cnt_new.ToString()) && deserObj.notify_alerts.msg_cnt_new.ToString() != "0") { message_indicatorIV.Visibility = ViewStates.Visible; dialogsTV.Text = GetString(Resource.String.dialogs) + " (" + deserObj.notify_alerts.msg_cnt_new + ")"; } else { message_indicatorIV.Visibility = ViewStates.Gone; dialogsTV.Text = GetString(Resource.String.dialogs); } deserialized_obj = deserObj.chats; } catch { emptyRL.Visibility = ViewStates.Visible; refresher.Visibility = ViewStates.Gone; } if (deserialized_obj.Count == 0) { emptyRL.Visibility = ViewStates.Visible; refresher.Visibility = ViewStates.Gone; } else { emptyRL.Visibility = ViewStates.Gone; refresher.Visibility = ViewStates.Visible; recyclerView.Visibility = ViewStates.Visible; } layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); if (deserialized_obj.Count > 0) { var dialogsListAdapter = new DialogsListAdapter(deserialized_obj, this, tf, date_now); recyclerView.SetAdapter(dialogsListAdapter); } refresher.SetColorScheme(Resource.Color.lightBlueColor, Resource.Color.buttonBackgroundColor); refresher.Direction = SwipyRefreshLayoutDirection.Both; refresher.Refresh += async delegate { var res_updated = await dialogMethods.ChatList(userMethods.GetUsersAuthToken()); refresher.Refreshing = false; try { var deserObj = JsonConvert.DeserializeObject <RootObjectChatList>(res_updated); if (!String.IsNullOrEmpty(deserObj.notify_alerts.msg_cnt_new.ToString()) && deserObj.notify_alerts.msg_cnt_new.ToString() != "0") { message_indicatorIV.Visibility = ViewStates.Visible; dialogsTV.Text = GetString(Resource.String.dialogs) + " (" + deserObj.notify_alerts.msg_cnt_new + ")"; } else { message_indicatorIV.Visibility = ViewStates.Gone; dialogsTV.Text = GetString(Resource.String.dialogs); } deserialized_obj_updated = deserObj.chats; } catch { emptyRL.Visibility = ViewStates.Visible; refresher.Visibility = ViewStates.Gone; } if (deserialized_obj_updated != null) { if (deserialized_obj_updated.Count == 0) { emptyRL.Visibility = ViewStates.Visible; refresher.Visibility = ViewStates.Gone; } else { emptyRL.Visibility = ViewStates.Gone; refresher.Visibility = ViewStates.Visible; recyclerView.Visibility = ViewStates.Visible; } if (deserialized_obj_updated.Count > 0) { var dialogsUpdatedAdapter = new DialogsListAdapter(deserialized_obj_updated, this, tf, date_now); recyclerView.SetAdapter(dialogsUpdatedAdapter); } } }; } catch { StartActivity(typeof(MainActivity)); } }