protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); try { SetContentView(Resource.Layout.FeedbackCategory); 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); back_button = FindViewById <ImageButton>(Resource.Id.back_button); backRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); activityIndicator.Visibility = ViewStates.Visible; recyclerView.Visibility = ViewStates.Visible; Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf"); FindViewById <TextView>(Resource.Id.headerTV).SetTypeface(tf, TypefaceStyle.Bold); backRelativeLayout.Click += (s, e) => { OnBackPressed(); }; back_button.Click += (s, e) => { OnBackPressed(); }; var expert_categ_id = expert_feedback_pref.GetString("expert_category_id", String.Empty); var expert_id = expert_feedback_pref.GetString("expert_id", String.Empty); var expert_json = await profileAndExpertMethodsPCL.ExpertProfile(expert_id, loc_pref.GetString("latitude", String.Empty), loc_pref.GetString("longitude", String.Empty)); try { deserialized_expert_profile = JsonConvert.DeserializeObject <ExpertProfile>(expert_json); foreach (var item in deserialized_expert_profile.serviceCategories) { categoriesList.Add(new City { id = item.categoryId, name = item.name }); activityIndicator.Visibility = ViewStates.Gone; } layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); var feedbackCategoryAdapter = new FeedbackCategoryAdapter(categoriesList, this, tf); recyclerView.SetAdapter(feedbackCategoryAdapter); } catch { Toast.MakeText(this, GetString(Resource.String.cannot_leave_feedback), ToastLength.Long).Show(); OnBackPressed(); } } catch { StartActivity(typeof(MainActivity)); } }
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)); } }