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.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)); } }
public static void showFragment() { try { loginRegFragment.Show(fragmentManager, "fragmentManager"); } catch { } }
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)); } } } }