Exemplo n.º 1
0
		public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Bundle savedInstanceState)
		{
			var view = inflater.Inflate(Resource.Layout.UserBadgeActivity, container, false);

			usernameTextView = (TextView)view.FindViewById(Resource.Id.username);
			topTimeTextView = (TextView)view.FindViewById(Resource.Id.toptime);
			userImage = (WebImage)view.FindViewById(Resource.Id.userimage);
			progress = (ProgressBar)view.FindViewById(Resource.Id.progress);


			return view;
		}
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View view = inflater.Inflate(Resource.Layout.EditProfileActivity, container, false);

			View toolbarLayout = view.FindViewById(Resource.Id.toolbarLayout);
			((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Text = "Edit Profile";
			ImageView toolbarImageFarLeft = (ImageView)toolbarLayout.FindViewById(Resource.Id.toolbar_imageFarLeft);
			toolbarImageFarLeft.Visibility = ViewStates.Visible;
			Drawable backArrow = Context.Resources.GetDrawable(Resource.Drawable.abc_ic_ab_back_mtrl_am_alpha);
			backArrow.SetColorFilter(Resources.GetColor(Resource.Color.tenBlue), PorterDuff.Mode.SrcAtop);
			toolbarImageFarLeft.SetImageDrawable(backArrow);
			toolbarImageFarLeft.Click += (sender, e) =>
			{
				FragmentManager.PopBackStack();
			};
			TextView toolbarTextFarRight = (TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_textFarRight);
			toolbarTextFarRight.Visibility = ViewStates.Visible;
			toolbarTextFarRight.Text = "Save";
			toolbarTextFarRight.Click += (sender, e) =>
			{
				SaveButtonClicked();
			};

			UsernameLabel = view.FindViewById<TextView>(Resource.Id.usernameLabel);
			BioTextView = view.FindViewById<EditText>(Resource.Id.bioEditText);
			WebsiteTextField = view.FindViewById<EditText>(Resource.Id.websitedittext);

			PrivateToggleButton = view.FindViewById<ToggleButton>(Resource.Id.privacyToggle);
			PrivateToggleButton.CheckedChange += (sender, e) =>
			{
				newPrivacy = PrivateToggleButton.Checked;
			};

			view.FindViewById<TextView>(Resource.Id.usernameLabel).Text = Globe.SharedInstance.User.username;


			UserImageButton = view.FindViewById<WebImage>(Resource.Id.userimagebutton);

			SetPageVariables();

			return view;
		}
		public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Bundle savedInstanceState)
		{
			View view = inflater.Inflate(Resource.Layout.ProfileHeader, container, false);

			PostCountLabel = view.FindViewById<TextView>(Resource.Id.postscount);
			BioTextView = view.FindViewById<BioTextView>(Resource.Id.bio);
			TopTimeLabel = view.FindViewById<TextView>(Resource.Id.toptimecount);
			UserImage = view.FindViewById<WebImage>(Resource.Id.userimage);

			FollowButton = view.FindViewById<FollowButton>(Resource.Id.action);
			FollowButton.BindDataToView(User, async () =>
			{
				await FetchHeaderData();
			});

			FollowersCountButton = view.FindViewById<TextView>(Resource.Id.followerscount);
			FollowersCountButton.Click += (sender, e) =>
			{
				TenServiceHelper.GoToListOf(Master.Master.FragmentManager, Resource.Id.fragment_container_page, User.idUser, FeedTypeEnum.FeedType.FollowersListOfFeed);
			};
			FollowersLabelButton = view.FindViewById<TextView>(Resource.Id.followerslabel);
			FollowersLabelButton.Click += (sender, e) =>
			{
				TenServiceHelper.GoToListOf(Master.Master.FragmentManager, Resource.Id.fragment_container_page, User.idUser, FeedTypeEnum.FeedType.FollowersListOfFeed);
			};

			FollowingCountButton = view.FindViewById<TextView>(Resource.Id.followingcount);
			FollowingCountButton.Click += (sender, e) =>
			{
				TenServiceHelper.GoToListOf(Master.Master.FragmentManager, Resource.Id.fragment_container_page, User.idUser, FeedTypeEnum.FeedType.FollowingListOfFeed);
			};
			FollowingLabelButton = view.FindViewById<TextView>(Resource.Id.followinglabel);
			FollowingLabelButton.Click += (sender, e) =>
			{
				TenServiceHelper.GoToListOf(Master.Master.FragmentManager, Resource.Id.fragment_container_page, User.idUser, FeedTypeEnum.FeedType.FollowingListOfFeed);
			};

			EditButton = view.FindViewById<Button>(Resource.Id.edit);
			if (User == null || User.IsMe())
			{
				FollowButton.Visibility = ViewStates.Invisible;
				EditButton.Visibility = ViewStates.Visible;
				EditButton.Click += (sender, e) =>
				{
					Master.Master.FragmentManager.BeginTransaction().Add(Resource.Id.fragment_container_page, new EditProfileFragment()).AddToBackStack(null).Commit();
				};
			}
			else {
				EditButton.Visibility = ViewStates.Invisible;
				FollowButton.Visibility = ViewStates.Visible;
			}


			ProfileTopTimersFragment = new UserFeedFragment();
			ProfileTopTimersFragment.Master = Master;
			ProfileTopTimersFragment.Target = FeedTypeEnum.FeedType.MyProfileFeed;
			ProfileTopTimersFragment.EmptyTableString = Strings.no_users_found;
			ProfileTopTimersFragment.User = User;
			if (User.IsMe())
			{
				ProfileTopTimersFragment.Target = FeedTypeEnum.FeedType.MyProfileFeed;
			}
			else {
				ProfileTopTimersFragment.Target = FeedTypeEnum.FeedType.GuestProfileFeed;
			}

			FragmentManager.BeginTransaction().Add(Resource.Id.fragment_container, ProfileTopTimersFragment).Commit();

			return view;
		}
Exemplo n.º 4
0
		private void SetPostImage(Notification notification, WebImage postImage)
		{
			if (notification.post == null || !notification.post.hasImage)
			{
				postImage.Visibility = ViewStates.Gone;
			}
			else {
				postImage.Visibility = ViewStates.Visible;
				postImage.BindDataToView(notification.post);
			}
		}
Exemplo n.º 5
0
		private void SetPostUserImageAndUsername(NotificationFeedFragment Master, int containerId, Notification notification, WebImage userImage, TextView username)
		{
			if (notification.type == Strings.following)
			{
				userImage.BindDataToView(Master.FragmentManager, Resource.Id.fragment_container_page, notification.post.userPoster, true, false, null);
			}
			else {
				userImage.BindDataToView(Master.FragmentManager, Resource.Id.fragment_container_page, notification.user, true, false, null);
			}
			username.Text = notification.user.username;

			if (!username.HasOnClickListeners)
			{
				username.Click += (sender, e) =>
				{
					TenServiceHelper.GoToGuestProfile(Master.FragmentManager, containerId, notification.user);
				};
			}
		}
Exemplo n.º 6
0
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			RelativeLayout view = (RelativeLayout)inflater.Inflate(Resource.Layout.PostActivity, container, false);
			view.Click += (sender, e) =>
			{
				ViewUtils.HideKeyboard(Activity, CaptionTextView);
				TabHostActivity.GetTabHost().ShowTabs();
			};

			Suggestions = view.FindViewById<SuggestionsLayout>(Resource.Id.suggestionsLayout);
			Suggestions.InitView();
			Suggestions.UserSelected += (User obj) =>
			{
				CaptionTextView.AddUsername(obj.username);
			};

			CharacterCountTextView = view.FindViewById<TextView>(Resource.Id.characterCount);

			CaptionTextView = view.FindViewById<CharacterLimitedSuggestionEditText>(Resource.Id.caption);
			CaptionTextView.BindDataToView(CharacterCountTextView, DealWithPostButton, Activity, Suggestions);

			PostButton = view.FindViewById<ImageButton>(Resource.Id.postbutton);
			PostButton.Click += async (object sender, EventArgs e) =>
			{
				string postText = StringUtils.TrimWhiteSpaceAndNewLine(CaptionTextView.Text);
				if (SelectedImage != null || (!String.IsNullOrEmpty(postText) && CaptionTextView.Text != Strings.add_a_caption_placeholder))
				{


					ProgressDialog progress = new ProgressDialog(Context);
					progress.Indeterminate = true;
					progress.SetProgressStyle(ProgressDialogStyle.Spinner);
					progress.SetMessage(Strings.posting);
					progress.SetCancelable(false);
					progress.Show();


					try
					{
						Byte[] myByteArray = null;
						if (SelectedImage != null)
						{
							MemoryStream stream = new MemoryStream();
							SelectedImage = ImageUtils.ReduceSizeIfNeededByWidth(SelectedImage, 1000);
							SelectedImage.Compress(Bitmap.CompressFormat.Jpeg, 80, stream);
							myByteArray = stream.ToArray();
						}
						Post result = await TenServices.Post(postText, myByteArray);

						progress.Dismiss();

						if (result != null)
						{
							FeedUtils.PassPostToAllFeedsIfExistsWithInclude(result, FeedTypeEnum.FeedType.HomeFeed);
							TabHostActivity.GetTabHost().tabHost.CurrentTab = 0;
							ViewUtils.HideKeyboard(TabHostActivity.GetTabHost(), CaptionTextView);
							ResetPage();
							ResetPostImageConstraints();
							TabHostActivity.GetTabHost().StartTickNotification();
						}
					}
					catch (RESTError error)
					{
						progress.Dismiss();
						Console.WriteLine(error.Message);
					}
				}
			};

			DeleteButton = view.FindViewById<ImageButton>(Resource.Id.delete);
			DeleteButton.BringToFront();
			DeleteButton.Click += (sender, e) =>
			{
				ResetPage();
			};

			ImageImageView = view.FindViewById<ImageView>(Resource.Id.image);


			LibraryButton = view.FindViewById<ImageButton>(Resource.Id.library);
			LibraryButton.Click += (sender, e) =>
			{
				Intent intent = new Intent();
				intent.SetType("image/*");
				intent.PutExtra(Intent.ExtraAllowMultiple, true);
				intent.SetAction(Intent.ActionGetContent);
				StartActivityForResult(Intent.CreateChooser(intent, "Select Picture"), 1);
			};
			CameraButton = view.FindViewById<ImageButton>(Resource.Id.camera);
			CameraButton.Click += (sender, e) =>
			{
				Android.Content.PM.PackageManager pm = Activity.PackageManager;
				if (pm.HasSystemFeature(Android.Content.PM.PackageManager.FeatureCamera))
				{
					TabHostActivity.GetTabHost().StopTickNotification();
					Intent intent = new Intent(Activity, typeof(CameraActivity));
					StartActivityForResult(intent, 2);
				}
				else {
					Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(Context);
					alert.SetTitle(Strings.error);
					alert.SetMessage("No Camera Found");
					alert.SetPositiveButton(Strings.ok, (senderAlert, args) => {});
					alert.Show();
				}
			};

			UsernameTextView = view.FindViewById<TextView>(Resource.Id.username);
			UserImageWebImage = view.FindViewById<WebImage>(Resource.Id.userimage);

			return view;
		}