public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { loginRegFragment = new LoginRegFragment(); fragmentManager = context.FragmentManager; if (viewType == 0) { View entryView = inflater.Inflate(Resource.Layout.UserProfileRow, parent, false); return(new UserProfileExpandableGroupHolder(entryView, GroupOnClick, SettingsOnClick, editOnClick, ChooseImageOnClick, OnImageClick, FeedbackOnClick, GoToReviewsClick, AboutMeClick, context)); } else if (viewType == 1) { View sectionView = inflater.Inflate(Resource.Layout.user_profile_subcategory_entry, parent, false); return(new UserProfileExpandableItemHolder(sectionView, EditSkillOnClick)); } else { return(null); } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); try { SetContentView(Resource.Layout.ThreeLevelUserProfile); dialogsTV = FindViewById <TextView>(Resource.Id.dialogsTV); message_indicatorIV = FindViewById <ImageView>(Resource.Id.message_indicatorIV); loginRegFragment = new LoginRegFragment(); fragmentManager = this.FragmentManager; loc_pref = Application.Context.GetSharedPreferences("coordinates", FileCreationMode.Private); activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); ProfileAndExpertMethods profileAndExpertMethods = new ProfileAndExpertMethods(); PCL.HttpMethods.ProfileAndExpertMethods profileAndExpertMethodsPCL = new PCL.HttpMethods.ProfileAndExpertMethods(); expert_data = Application.Context.GetSharedPreferences("experts", FileCreationMode.Private); edit_expert = expert_data.Edit(); profileLL = FindViewById <LinearLayout>(Resource.Id.profileLL); dialogsLL = FindViewById <LinearLayout>(Resource.Id.dialogsLL); profileLL.Click += (s, e) => { if (userMethods.UserExists()) { StartActivity(typeof(UserProfileActivity)); } else { try { loginRegFragment.Show(fragmentManager, "fragmentManager"); } catch { Toast.MakeText(this, GetString(Resource.String.you_not_logined), ToastLength.Short).Show(); StartActivity(typeof(MainActivity)); } } }; 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 { try { loginRegFragment.Show(fragmentManager, "fragmentManager"); } catch { Toast.MakeText(this, GetString(Resource.String.you_not_logined), ToastLength.Short).Show(); StartActivity(typeof(MainActivity)); } } }; initWidget(); activityIndicator.Visibility = ViewStates.Visible; recyclerView.Visibility = ViewStates.Gone; var expert_json = await profileAndExpertMethodsPCL.ExpertProfile(expert_data.GetString("expert_id", String.Empty), loc_pref.GetString("latitude", String.Empty), loc_pref.GetString("longitude", String.Empty)); activityIndicator.Visibility = Android.Views.ViewStates.Gone; recyclerView.Visibility = ViewStates.Visible; deserialized_expert_profile = JsonConvert.DeserializeObject <ExpertProfile>(expert_json); edit_expert_feedback = expert_feedback_pref.Edit(); edit_expert_feedback.PutString("expert_id", deserialized_expert_profile.id); edit_expert_feedback.PutString("expert_name", deserialized_expert_profile.fullName); edit_expert_feedback.PutString("expert_phone", deserialized_expert_profile.phone); edit_expert_feedback.PutBoolean("expert_online", deserialized_expert_profile.online); edit_expert_feedback.PutString("expert_avatar", deserialized_expert_profile.avatarUrl); try { edit_expert_feedback.PutString("expert_category_id", deserialized_expert_profile.serviceCategories[0].categoryId); } catch { } edit_expert_feedback.Apply(); initData(); } catch (Exception ex) { StartActivity(typeof(MainActivity)); } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); try { SetContentView(Resource.Layout.Specialists); dialogsTV = FindViewById <TextView>(Resource.Id.dialogsTV); message_indicatorIV = FindViewById <ImageView>(Resource.Id.message_indicatorIV); loginRegFragment = new LoginRegFragment(); fragmentManager = this.FragmentManager; InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); searchET = FindViewById <EditText>(Resource.Id.searchET); close_searchBn = FindViewById <ImageButton>(Resource.Id.close_searchBn); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); activityIndicatorSearch = FindViewById <ProgressBar>(Resource.Id.activityIndicatorSearch); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); search_recyclerView = FindViewById <RecyclerView>(Resource.Id.search_recyclerView); searchLL = FindViewById <LinearLayout>(Resource.Id.searchLL); nothingIV = FindViewById <ImageView>(Resource.Id.nothingIV); searchIV = FindViewById <ImageView>(Resource.Id.searchIV); backIV = FindViewById <ImageView>(Resource.Id.backIV); nothingTV = FindViewById <TextView>(Resource.Id.nothingTV); bottomLayout = FindViewById <RelativeLayout>(Resource.Id.bottomLayout); 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); search_layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); 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"); searchET.SetTypeface(tf, TypefaceStyle.Normal); nothingTV.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); profileLL.Click += (s, e) => { if (userMethods.UserExists()) { StartActivity(typeof(UserProfileActivity)); } else { try { loginRegFragment.Show(fragmentManager, "fragmentManager"); } catch { Toast.MakeText(this, GetString(Resource.String.you_not_logined), ToastLength.Short).Show(); StartActivity(typeof(MainActivity)); } } }; 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 { try { loginRegFragment.Show(fragmentManager, "fragmentManager"); } catch { Toast.MakeText(this, GetString(Resource.String.you_not_logined), ToastLength.Short).Show(); StartActivity(typeof(MainActivity)); } } }; var specs = await specializationMethods.GetUpperSpecializations(); var deserialized_specs = JsonConvert.DeserializeObject <UpperSpecializationsRootObject>(specs.ToString()); if (!String.IsNullOrEmpty(deserialized_specs.notify_alerts.msg_cnt_new.ToString()) && deserialized_specs.notify_alerts.msg_cnt_new.ToString() != "0") { message_indicatorIV.Visibility = ViewStates.Visible; dialogsTV.Text = GetString(Resource.String.dialogs) + " (" + deserialized_specs.notify_alerts.msg_cnt_new + ")"; } else { message_indicatorIV.Visibility = ViewStates.Gone; dialogsTV.Text = GetString(Resource.String.dialogs); } var upperSpecializationAdapter = new LookingForSpecialistsAdapter(deserialized_specs.categories, this, tf); upperSpecializationAdapter.NotifyDataSetChanged(); recyclerView.SetAdapter(upperSpecializationAdapter); activityIndicator.Visibility = ViewStates.Gone; backIV.Click += (s, e) => { OnBackPressed(); }; searchET.TextChanged += async(s, e) => { if (!String.IsNullOrEmpty(searchET.Text)) { backIV.Visibility = ViewStates.Visible; searchIV.Visibility = ViewStates.Gone; 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; var search_content = await specializationMethods.SearchCategory(searchET.Text); if (!search_content.ToLower().Contains("пошло не так".ToLower()) && !search_content.Contains("null")) { 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 { backIV.Visibility = ViewStates.Gone; searchIV.Visibility = ViewStates.Visible; close_searchBn.Visibility = ViewStates.Gone; searchLL.Visibility = ViewStates.Visible; searchLL.Visibility = ViewStates.Gone; } }; close_searchBn.Click += (s, e) => { searchET.Text = null; imm.HideSoftInputFromWindow(searchET.WindowToken, 0); searchLL.Visibility = ViewStates.Gone; }; searchET.EditorAction += (object sender, EditText.EditorActionEventArgs e) => { imm.HideSoftInputFromWindow(searchET.WindowToken, 0); }; } catch { StartActivity(typeof(MainActivity)); } }
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 OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); try { SetContentView(Resource.Layout.ReviewsList); Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf"); activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); back_button = FindViewById <ImageButton>(Resource.Id.back_button); leave_feedbackBn = FindViewById <Button>(Resource.Id.leave_feedbackBn); backRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); activityIndicator.Visibility = ViewStates.Visible; recyclerView.Visibility = ViewStates.Gone; FindViewById <TextView>(Resource.Id.headerTV).SetTypeface(tf, TypefaceStyle.Bold); leave_feedbackBn.SetTypeface(tf, TypefaceStyle.Normal); leave_feedbackBn.Visibility = ViewStates.Gone; loginRegFragment = new LoginRegFragment(); fragmentManager = this.FragmentManager; string reviewJson; if (!userMethods.UserExists()) { reviewJson = await feedbacks.ReviewList(expert_feedback_pref.GetString("expert_id", String.Empty) /*, expert_feedback_pref.GetString("expert_category_id", String.Empty)*/); } else { reviewJson = await feedbacks.ReviewList(expert_feedback_pref.GetString("expert_id", String.Empty), /*expert_feedback_pref.GetString("expert_category_id", String.Empty),*/ userMethods.GetUsersAuthToken()); } try { deserialized_review_list = JsonConvert.DeserializeObject <List <ReviewsList> >(reviewJson); } catch { deserialized_review_list = null; } activityIndicator.Visibility = ViewStates.Gone; recyclerView.Visibility = ViewStates.Visible; leave_feedbackBn.Visibility = ViewStates.Visible; leave_feedbackBn.Visibility = ViewStates.Gone; backRelativeLayout.Click += (s, e) => { OnBackPressed(); }; back_button.Click += (s, e) => { OnBackPressed(); }; if (deserialized_review_list != null) { reverse_list = Enumerable.Reverse(deserialized_review_list); reviewListAdapter = new ReviewListAdapter(reverse_list.ToList(), this, tf); layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); recyclerView.SetAdapter(reviewListAdapter); } leave_feedbackBn.Click += (s, e) => { if (userMethods.UserExists()) { StartActivity(typeof(FeedbackChooseCategoryActivity)); } else { try { loginRegFragment.Show(fragmentManager, "fragmentManager"); } catch { Toast.MakeText(this, GetString(Resource.String.you_not_logined), ToastLength.Short).Show(); StartActivity(typeof(MainActivity)); } } }; } catch { StartActivity(typeof(MainActivity)); } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.main); PCL.HttpMethods.ProfileAndExpertMethods ksg = new PCL.HttpMethods.ProfileAndExpertMethods(); loginRegFragment = new LoginRegFragment(); fragmentManager = this.FragmentManager; edit_dialog = dialog_data.Edit(); if (Intent.Extras != null) { string type = ""; foreach (var key in Intent.Extras.KeySet()) { var value = Intent.Extras.GetString(key); Log.Debug(TAG, "Key: {0} Value: {1}", key, value); if (key == "message_from") { edit_dialog.PutString("expert_id", value); } if (key == "name") { edit_dialog.PutString("expert_name", value); } if (key == "avatar") { edit_dialog.PutString("expert_avatar", value); } if (key == "type") { type = value; } // //break; } edit_dialog.Apply(); from_push = true; if (type == "message") { StartActivity(typeof(DialogActivity)); } else { string review_id = ""; string reviewText = ""; string reviewAnswer = ""; string companionId = ""; string companionFullName = ""; string companionAvatar = ""; string myFullName = ""; string myId = ""; string myAvatar = ""; string is_online = ""; string timestamp = ""; string rating = ""; string categoryId = ""; string msg_cnt_new = ""; foreach (var key in Intent.Extras.KeySet()) { var value = Intent.Extras.GetString(key); if (key == "review_id") { review_id = value; } if (key == "reviewText") { reviewText = value; } if (key == "reviewAnswer") { reviewAnswer = value; } if (key == "companionId") { companionId = value; } if (key == "companionFullName") { companionFullName = value; } if (key == "companionAvatar") { companionAvatar = value; } if (key == "myFullName") { myFullName = value; } if (key == "myAvatar") { myAvatar = value; } if (key == "is_online") { is_online = value; } if (key == "timestamp") { timestamp = value; } if (key == "rating") { rating = value; } if (key == "categoryId") { categoryId = value; } if (key == "myId") { myId = value; } if (key == "msg_cnt_new") { msg_cnt_new = value; } } var activity2 = new Intent(this, typeof(ReviewFromPushActivity)); activity2.PutExtra("type", type); activity2.PutExtra("review_id", review_id); activity2.PutExtra("reviewText", reviewText); activity2.PutExtra("companionId", companionId); activity2.PutExtra("companionFullName", companionFullName); activity2.PutExtra("companionAvatar", companionAvatar); activity2.PutExtra("myFullName", myFullName); activity2.PutExtra("myAvatar", myAvatar); activity2.PutExtra("reviewAnswer", reviewAnswer); activity2.PutExtra("review_rating", rating); activity2.PutExtra("review_date", timestamp); activity2.PutExtra("review_online", is_online); activity2.PutExtra("categoryId", categoryId); activity2.PutExtra("myId", myId); activity2.PutExtra("msg_cnt_new", msg_cnt_new); StartActivity(activity2); } } else { from_push = false; } IsPlayServicesAvailable(); CreateNotificationChannel(); AppCenter.Start("0a86243f-1b34-4bca-bc65-133580015fc1", typeof(Analytics), typeof(Crashes)); var context = Application.Context; String androidOS = Build.VERSION.Release; String androidId = Settings.Secure.GetString(context.ContentResolver, Settings.Secure.AndroidId); var VersionNumber = context.PackageManager.GetPackageInfo(context.PackageName, PackageInfoFlags.MetaData).VersionName; var package_name = context.PackageName; var device_obj = new PCL.Models.Device { platform = "Android", deviceToken = androidId, osVersion = androidOS, appVersion = VersionNumber, packageName = package_name, }; var device_Json = JsonConvert.SerializeObject(device_obj); device_info_prefs = Application.Context.GetSharedPreferences("device_info", FileCreationMode.Private); edit_device_info_prefs = device_info_prefs.Edit(); edit_device_info_prefs.PutString("device_json", device_Json); new MyFirebaseIIDService().OnTokenRefresh(); var tokenFirebase = await GetToken(); edit_device_info_prefs.PutString("firebase_token", tokenFirebase); edit_device_info_prefs.Apply(); loc_pref = Application.Context.GetSharedPreferences("coordinates", FileCreationMode.Private); edit = loc_pref.Edit(); i_need_help_LL = FindViewById <RelativeLayout>(Resource.Id.i_need_help_LL); i_want_to_help_LL = FindViewById <RelativeLayout>(Resource.Id.i_want_to_help_LL); LogoRL = FindViewById <RelativeLayout>(Resource.Id.LogoRL); mainRL = FindViewById <RelativeLayout>(Resource.Id.mainRL); tintLL = FindViewById <RelativeLayout>(Resource.Id.tintLL); EnterMyAccTV = FindViewById <TextView>(Resource.Id.EnterMyAccTV); your_city_valueTV = FindViewById <TextView>(Resource.Id.your_city_valueTV); getting_positionTV = FindViewById <TextView>(Resource.Id.getting_positionTV); noTV = FindViewById <TextView>(Resource.Id.noTV); yesTV = FindViewById <TextView>(Resource.Id.yesTV); restartBn = FindViewById <Button>(Resource.Id.restartBn); activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf"); EnterMyAccTV.SetTypeface(tf, TypefaceStyle.Normal); your_city_valueTV.SetTypeface(tf, TypefaceStyle.Normal); getting_positionTV.SetTypeface(tf, TypefaceStyle.Normal); noTV.SetTypeface(tf, TypefaceStyle.Normal); yesTV.SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textView5).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textView4).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textView3).SetTypeface(tf, TypefaceStyle.Bold); FindViewById <TextView>(Resource.Id.textView2).SetTypeface(tf, TypefaceStyle.Bold); restartBn.SetTypeface(tf, TypefaceStyle.Normal); restartBn.Visibility = ViewStates.Gone; i_need_help_LL.Click += (s, e) => { if (tintLL.Visibility != ViewStates.Visible) { StartActivity(typeof(SpecialistsCategoryActivity)); } }; i_want_to_help_LL.Click += (s, e) => { if (tintLL.Visibility != ViewStates.Visible) { try { if (!userMethods.UserExists()) { loginRegFragment.Show(fragmentManager, "fragmentManager"); } else { StartActivity(typeof(UserProfileActivity)); } } catch { Toast.MakeText(this, GetString(Resource.String.you_not_logined), ToastLength.Short).Show(); StartActivity(typeof(MainActivity)); } } }; EnterMyAccTV.Click += (s, e) => { if (tintLL.Visibility != ViewStates.Visible) { StartActivity(typeof(AuthorizationActivity)); } }; if (userMethods.UserExists()) { EnterMyAccTV.Visibility = ViewStates.Gone; } if (checkInternetConnection()) { //checking if GPS is enabled if (IsGeolocationEnabled()) { activityIndicator.Visibility = ViewStates.Visible; await Geolocation(); } else { turnGPSon(); } } else { restartBn.Visibility = ViewStates.Visible; activityIndicator.Visibility = ViewStates.Gone; getting_positionTV.Visibility = ViewStates.Gone; Toast.MakeText(this, Resource.String.turn_internet_on, ToastLength.Long).Show(); } restartBn.Click += (s, e) => { StartActivity(typeof(MainActivity)); }; var granted = await checkLocPermission(); if (!granted) { checkLocPermission(); } if (checkInternetConnection() && IsGeolocationEnabled()) { if (userMethods.UserExists()) { if (!from_push) { StartActivity(typeof(UserProfileActivity)); } } } }