Пример #1
0
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View view = inflater.Inflate(Resource.Layout.HomeActivity, container, false);

			toolbarLayout = view.FindViewById(Resource.Id.toolbarLayout);

			//string guestString = Intent.GetStringExtra("user");
			//if (!String.IsNullOrEmpty(guestString))
			//{
			//	Guest = JsonConvert.DeserializeObject<User>(guestString);
			//}


			PostFeedFragment = new PostFeedFragment();
			PostFeedFragment.Master = this;
			PostFeedFragment.EmptyTableString = Strings.no_active_posts;
			PostFeedFragment.NewPageContainerID = Resource.Id.search_container;

			if (Guest != null)
			{
				((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Text = Guest.username;
				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();
				};

				PostFeedFragment.Target = FeedTypeEnum.FeedType.GuestProfileFeed;
				PostFeedFragment.User = Guest;

				ChildFragmentManager.BeginTransaction().Add(Resource.Id.fragment_container, PostFeedFragment).Commit();
			}
			else {
				((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Text = Globe.SharedInstance.User.username;
				ImageView toolbarImageFarRight = (ImageView)toolbarLayout.FindViewById(Resource.Id.toolbar_imageFarRight);
				toolbarImageFarRight.Visibility = ViewStates.Visible;
				toolbarImageFarRight.SetImageResource(Resource.Drawable.settings);
				toolbarImageFarRight.Click += (sender, e) =>
				{
					SettingsFragment SettingsFragment = new SettingsFragment();
					PostFeedFragment.Master = this;
					PostFeedFragment.EmptyTableString = Strings.no_active_posts;
					FragmentManager.BeginTransaction().Add(Resource.Id.fragment_container_page, SettingsFragment).AddToBackStack(null).Commit();

				};

				PostFeedFragment.Target = FeedTypeEnum.FeedType.MyProfileFeed;
				PostFeedFragment.User = Globe.SharedInstance.User;

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


			return view;

		}
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			SetContentView (Resource.Layout.EmptyActivity);


			newFragment = new PostFeedFragment ();
			newFragment.EmptyTableString = Strings.no_active_posts;
			//newFragment.Master = this;
			newFragment.Target = FeedTypeEnum.FeedType.SearchHashFeed;
			SupportFragmentManager.BeginTransaction ().Add (Resource.Id.fragment_container, newFragment).Commit ();
		}
Пример #3
0
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View view = inflater.Inflate(Resource.Layout.SearchActivity, container, false);

			View toolbarLayout = view.FindViewById(Resource.Id.toolbarLayout);
			((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Text = "Search";
			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) =>
			{
				ViewUtils.HideKeyboard(Activity, searchField);
				FragmentManager.PopBackStack();
			};

			usersButton = (Button)view.FindViewById(Resource.Id.users);
			usersButton.Click += delegate
			{
				usersButton.SetTypeface(null, TypefaceStyle.Bold);
				tagsButton.SetTypeface(null, TypefaceStyle.Normal);
				searchType = "user";
				FragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container_search, ListOfFeedFragment).Commit();
			};

			tagsButton = (Button)view.FindViewById(Resource.Id.tags);
			tagsButton.Click += delegate
			{
				tagsButton.SetTypeface(null, TypefaceStyle.Bold);
				usersButton.SetTypeface(null, TypefaceStyle.Normal);
				searchType = "post";
				FragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container_search, PostFeedFragment).Commit();
			};

			PostFeedFragment = new PostFeedFragment();
			PostFeedFragment.EmptyTableString = Strings.no_active_posts;
			PostFeedFragment.Master = this;
			PostFeedFragment.Target = FeedTypeEnum.FeedType.SearchHashFeed;

			ListOfFeedFragment = new ListOfFeedFragment();
			ListOfFeedFragment.EmptyTableString = Strings.no_users_found;
			ListOfFeedFragment.Master = this;
			ListOfFeedFragment.Target = FeedTypeEnum.FeedType.SearchListOfFeed;

			usersButton.CallOnClick();


			searchField = (EditText)view.FindViewById(Resource.Id.searchfield);
			searchField.TextChanged += delegate
			{
				SearchButtonClicked();
			};



			string searchString = StringUtils.RemoveAllHashTags(StringUtils.TrimWhiteSpaceAndNewLine(IncommingTagForSearch));
			if (!string.IsNullOrEmpty(searchString))
			{
				tagsButton.CallOnClick();
				searchField.Text = searchString;
				SearchButtonClicked();
			}

			return view;
		}
Пример #4
0
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View view = inflater.Inflate(Resource.Layout.PopularActivity, container, false);


			Scope = "Local";
			Type = "Timed";

			TopTimedGlobalPostFeedFragment = new PostFeedFragment();
			TopTimedGlobalPostFeedFragment.EmptyTableString = Strings.no_active_posts;
			TopTimedGlobalPostFeedFragment.Master = this;
			TopTimedGlobalPostFeedFragment.Target = FeedTypeEnum.FeedType.PopularGlobalTimedFeed;
			TopTimedGlobalPostFeedFragment.NewPageContainerID = Resource.Id.fragment_container_page;

			TopTimedLocalFeedFragment = new PostFeedFragment();
			TopTimedLocalFeedFragment.EmptyTableString = Strings.no_active_posts;
			TopTimedLocalFeedFragment.Master = this;
			TopTimedLocalFeedFragment.Target = FeedTypeEnum.FeedType.PopularLocalTimedFeed;
			TopTimedLocalFeedFragment.NewPageContainerID = Resource.Id.fragment_container_page;

			TopTimersGlobalUserFeedFragment = new UserFeedFragment();
			TopTimersGlobalUserFeedFragment.EmptyTableString = Strings.no_users_found;
			TopTimersGlobalUserFeedFragment.Master = this;
			TopTimersGlobalUserFeedFragment.Target = FeedTypeEnum.FeedType.PopularGlobalTimersFeed;

			TopTimersLocalUserFeedFragment = new UserFeedFragment();
			TopTimersLocalUserFeedFragment.EmptyTableString = Strings.no_users_found;
			TopTimersLocalUserFeedFragment.Master = this;
			TopTimersLocalUserFeedFragment.Target = FeedTypeEnum.FeedType.PopularLocalTimersFeed;

			View toolbarLayout = view.FindViewById(Resource.Id.toolbarLayout);
			((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Text = "Popular";


			timersButton = (Button)view.FindViewById(Resource.Id.timers);
			timersButton.Click += delegate
			{
				timedButton.SetBackgroundResource(Resource.Drawable.LeftSegmentedControl);
				timedButton.SetTextColor(Android.Graphics.Color.ParseColor("#338a9e"));
				timersButton.SetBackgroundResource(Resource.Drawable.RightSegmentedControlSelected);
				timersButton.SetTextColor(Android.Graphics.Color.White);
				Type = "Timers";
				ShowCorrectPage();
			};

			timedButton = (Button)view.FindViewById(Resource.Id.timed);
			timedButton.Click += delegate
			{
				timedButton.SetBackgroundResource(Resource.Drawable.LeftSegmentedControlSelected);
				timedButton.SetTextColor(Android.Graphics.Color.White);
				timersButton.SetBackgroundResource(Resource.Drawable.RightSegmentedControl);
				timersButton.SetTextColor(Android.Graphics.Color.ParseColor("#338a9e"));
				Type = "Timed";
				ShowCorrectPage();
			};


			localButton = (ImageButton)view.FindViewById(Resource.Id.local);
			localButton.Click += delegate
			{
				localButton.SetImageResource(Resource.Drawable.localselected);
				globalButton.SetImageResource(Resource.Drawable.global);
				Scope = "Local";
				ShowCorrectPage();
			};

			globalButton = (ImageButton)view.FindViewById(Resource.Id.global);
			globalButton.Click += delegate
			{
				localButton.SetImageResource(Resource.Drawable.local);
				globalButton.SetImageResource(Resource.Drawable.globalselected);
				Scope = "Global";
				ShowCorrectPage();
			};

			timedButton.CallOnClick();
			localButton.CallOnClick();

			return view;

		}
Пример #5
0
		public void BindDataToView(PostFeedFragment Master, int containerId, Post post)
		{

			UserImage.BindDataToView(Master.FragmentManager, containerId, post.userPoster, true, false, null);

			UsernameTextView.Text = post.userPoster.username;
			if (!UsernameTextView.HasOnClickListeners)
			{
				UsernameTextView.Click += (sender, e) =>
				{
					TenServiceHelper.GoToGuestProfile(Master.FragmentManager, containerId, post.userPoster);
				};
			}


			CaptionTextView.TextFormatted = NativeStringUtils.ParseStringForKeywords(Master.FragmentManager, containerId, post.text);
			CaptionTextView.MovementMethod = LinkMovementMethod.Instance;


			TimeElapasedTextView.Text = StringUtils.GetPrettyDateAbs(post.datestamp);

			if (!TimeRemainingTextView.HasOnClickListeners)
			{
				TimeRemainingTextView.Click += (sender, e) =>
				{
					TenServiceHelper.GoToListOf(Master.FragmentManager, containerId, post.idPost, FeedTypeEnum.FeedType.LikersListOfFeed);
				};
			}

			if (!ClockImageView.HasOnClickListeners)
			{
				ClockImageView.Click += (sender, e) =>
				{
					TenServiceHelper.GoToListOf(Master.FragmentManager, containerId, post.idPost, FeedTypeEnum.FeedType.LikersListOfFeed);
				};
			}
			ViewUtils.SetTimeRemaining(post, TimeRemainingTextView, ClockImageView);

			if (post.userReposter != null)
			{
				RepostedTextView.Visibility = ViewStates.Visible;
				if (post.userReposter.idUser == Globe.SharedInstance.User.idUser)
				{
					RepostedTextView.Text = "by you";
				}
				else {
					RepostedTextView.Text = "by " + post.userReposter.username;
				}
			}
			else {
				RepostedTextView.Visibility = ViewStates.Invisible;
				RepostedTextView.Text = "";
			}
			if (!RepostedTextView.HasOnClickListeners)
			{
				RepostedTextView.Click += (sender, e) =>
				{
					if (post.userReposter.IsMe())
					{
						return;
					}
					TenServiceHelper.GoToGuestProfile(Master.FragmentManager, containerId, post.userReposter);
				};
			}

			if (post.isReposted)
			{
				RepostImage.SetImageResource(Resource.Drawable.repostSelected);
			}
			else {
				RepostImage.SetImageResource(Resource.Drawable.repost);
			}
			if (!RepostImage.HasOnClickListeners)
			{
				RepostImage.Click += (object sender, EventArgs e) =>
				{
					if (post.isReposted)
					{
						return;
					}

					new AlertDialog.Builder(Master.Activity).SetTitle(Strings.repost_confirm).SetPositiveButton(Strings.yes, async delegate
					{
						RepostImage.SetImageResource(Resource.Drawable.refresh);
						post.isReposted = await TenServices.RepostPost(post);
						if (!post.isReposted)
						{
							RepostImage.SetImageResource(Resource.Drawable.repost);
						}
					}).SetNegativeButton(Strings.no, delegate { }).Show();
				};
			}

			if (post.userPoster.isprivate)
			{
				RepostImage.Enabled = false;
			}
			else {
				RepostImage.Enabled = true;
			}

			if (post.liked)
			{
				LikeImage.SetImageResource(Resource.Drawable.likeselected);
			}
			else {
				LikeImage.SetImageResource(Resource.Drawable.like);
			}
			if (!LikeImage.HasOnClickListeners)
			{
				LikeImage.Click += async (object sender, EventArgs e) =>
				{
					await TenServiceHelper.LikePost(post, LikeImage);
				};
			}

			CommentImage.Clickable = false;
			if (post.commented)
			{
				CommentImage.SetImageResource(Resource.Drawable.commentselected);
			}
			else {
				CommentImage.SetImageResource(Resource.Drawable.comment);
			}

			if (post.userPoster.IsMe())
			{
				LikeImage.Visibility = ViewStates.Invisible;
				RepostImage.Visibility = ViewStates.Invisible;
			}
			else {
				LikeImage.Visibility = ViewStates.Visible;
				RepostImage.Visibility = ViewStates.Visible;
			}
			if (post.hasImage)
			{
				ProgressBar.Visibility = ViewStates.Visible;
				PostImage.Visibility = ViewStates.Visible;
				PostImage.BindDataToView(post, true, ProgressBar);
			}
			else {
				ProgressBar.Visibility = ViewStates.Gone;
				PostImage.Visibility = ViewStates.Gone;
			}
		}
Пример #6
0
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View view = inflater.Inflate(Resource.Layout.HomeActivity, container, false);

			View toolbarLayout = view.FindViewById(Resource.Id.toolbarLayout);
			toolbarLayout.Click += (sender, e) =>
			{
				Console.WriteLine("S");
			};

			((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Visibility = ViewStates.Gone;
			ImageView toolbarImageCenter = (ImageView)toolbarLayout.FindViewById(Resource.Id.toolbar_imageCenter);
			toolbarImageCenter.SetImageResource(Resource.Drawable.ten);
			toolbarImageCenter.Visibility = ViewStates.Visible;
			ImageView toolbarImageFarLeft = (ImageView)toolbarLayout.FindViewById(Resource.Id.toolbar_imageFarLeft);
			toolbarImageFarLeft.Visibility = ViewStates.Visible;
			toolbarImageFarLeft.SetImageResource(Resource.Drawable.status);
			toolbarImageFarLeft.BringToFront();
			toolbarImageFarLeft.Click += (sender, e) =>
			{
				Context.StartActivity(typeof(StatusActivity));
			};
			ImageView toolbarImageFarRight = (ImageView)toolbarLayout.FindViewById(Resource.Id.toolbar_imageFarRight);
			toolbarImageFarRight.Visibility = ViewStates.Visible;
			toolbarImageFarRight.SetImageResource(Resource.Drawable.search);
			toolbarImageFarRight.Click += (sender, e) =>
			{
				FragmentManager.BeginTransaction().Add(Resource.Id.search_container, new SearchFragment()).AddToBackStack(null).CommitAllowingStateLoss();
			};
			ImageView toolbarImageRight = (ImageView)toolbarLayout.FindViewById(Resource.Id.toolbar_imageRight);
			toolbarImageRight.Visibility = ViewStates.Visible;
			toolbarImageRight.SetImageResource(Resource.Drawable.refresh);
			toolbarImageRight.Click += async (sender, e) =>
			{
				PostFeedFragment.SwipeRefreshLayout.Refreshing = true;
				await PostFeedFragment.FetchTableData();
			};


			UserBadgeFragment = new UserBadgeFragment();

			PostFeedFragment = new PostFeedFragment();
			PostFeedFragment.Master = this;
			PostFeedFragment.Target = FeedTypeEnum.FeedType.HomeFeed;
			PostFeedFragment.EmptyTableString = Strings.no_users_found;
			PostFeedFragment.NewPageContainerID = Resource.Id.search_container;
			PostFeedFragment.NoTableData += delegate
			{
				UpdateUserBadge();
			};
			PostFeedFragment.HasTableData += delegate
			{
				if (UserBadgeFragment.IsAdded)
				{
					FragmentManager.BeginTransaction().Remove(UserBadgeFragment).CommitAllowingStateLoss();
				}
			};

			FragmentManager.BeginTransaction().Add(Resource.Id.fragment_container, PostFeedFragment).CommitAllowingStateLoss();

			return view;
		}