protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); OverridePendingTransition(Resource.Animation.trans_left_in, Resource.Animation.trans_left_out); SetContentView(Resource.Layout.StatusActivity); View toolbarLayout = FindViewById(Resource.Id.toolbarLayout); TextView TitleTextView = ((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)); TitleTextView.Text = "Timed Post"; TitleTextView.SetTextColor(Android.Graphics.Color.White); ImageView toolbarImageFarLeft = (ImageView)toolbarLayout.FindViewById(Resource.Id.toolbar_imageFarLeft); toolbarImageFarLeft.Visibility = ViewStates.Visible; toolbarImageFarLeft.SetImageResource(Android.Resource.Drawable.IcMenuCloseClearCancel); toolbarImageFarLeft.Click += (sender, e) => { OnBackPressed(); }; NotificationFragment = new NotificationFeedFragment(); NotificationFragment.Target = FeedTypeEnum.FeedType.StatusFeed; NotificationFragment.EmptyTableString = Strings.no_active_posts; SupportFragmentManager.BeginTransaction().Add(Resource.Id.fragment_container, NotificationFragment).Commit(); }
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); ((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Text = "Notifications"; toolbarImageFarLeft = (ImageView)toolbarLayout.FindViewById(Resource.Id.toolbar_imageFarLeft); toolbarImageFarLeft.Visibility = ViewStates.Visible; Drawable trash = Context.Resources.GetDrawable(Resource.Drawable.delete); trash.SetColorFilter(Resources.GetColor(Resource.Color.tenBlue), PorterDuff.Mode.SrcAtop); toolbarImageFarLeft.SetImageDrawable(trash); toolbarImageFarLeft.Click += (sender, e) => { Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(Context); alert.SetTitle(Strings.clear_notificaitons); alert.SetMessage(Strings.clear_notificaions_confirm); alert.SetPositiveButton(Strings.yes, (senderAlert, args) => { DeleteAllNotifications(); }); alert.SetNeutralButton(Strings.no, (senderAlert, args) => { }); alert.Show(); }; NotificationFragment = new NotificationFeedFragment(); NotificationFragment.Master = this; NotificationFragment.Target = FeedTypeEnum.FeedType.NotificationFeed; NotificationFragment.EmptyTableString = Strings.no_notifications; NotificationFragment.NewPageContainerID = Resource.Id.search_container; NotificationFragment.NoTableData += () => { toolbarImageFarLeft.Visibility = ViewStates.Invisible; }; NotificationFragment.HasTableData += () => { toolbarImageFarLeft.Visibility = ViewStates.Visible; }; FragmentManager.BeginTransaction().Add(Resource.Id.fragment_container, NotificationFragment).Commit(); return view; }
public void BindDataToView(NotificationFeedFragment master, int containerId, Notification notification) { TimeElapsedTextView.Text = StringUtils.GetPrettyDateAbs(notification.datestamp); CaptionTextView.TextFormatted = NativeStringUtils.ParseStringForKeywords(master.FragmentManager, containerId, notification.message); CaptionTextView.MovementMethod = new LinkMovementMethod(); if (master.Master == null)//status { CaptionTextView.SetTextColor(Android.Graphics.Color.LightGray); } SetCommentImage(notification, CommentTypeImageView); SetTimeRemaining(master, containerId, notification, TimeRemainingTextView, ClockImageView); SetPostUserImageAndUsername(master, containerId, notification, UserImage, UsernameTextView); SetUserAction(master, containerId, notification, RepostTextView); SetPostImage(notification, PostImage); }
private void SetTimeRemaining(NotificationFeedFragment master, int containerId, Notification notification, TextView timeRemainingTextView, ImageView clockImageView) { if ( notification.type == Strings.notification_type_post_expired || notification.type == Strings.notification_type_following || notification.type == Strings.notification_type_follow || notification.type == Strings.notification_type_friend_request) { clockImageView.Visibility = ViewStates.Invisible; timeRemainingTextView.Visibility = ViewStates.Invisible; } else { clockImageView.Visibility = ViewStates.Visible; timeRemainingTextView.Visibility = ViewStates.Visible; if (notification.post != null) { if (notification.post.IsExpired()) { string timeRemaining = StringUtils.GetTopTime(notification.post); timeRemainingTextView.Text = timeRemaining; timeRemainingTextView.SetTextColor(Color.White); timeRemainingTextView.SetBackgroundResource(Resource.Drawable.RoundedCorners5Black); clockImageView.Visibility = ViewStates.Invisible; } else { string timeRemaining = StringUtils.GetPrettyDateAbs(notification.post.expiration); timeRemainingTextView.Text = timeRemaining; Color timeRemainingColor = ViewUtils.GetTimeRemainingColor(notification.post.expiration); timeRemainingTextView.SetTextColor(timeRemainingColor); timeRemainingTextView.SetBackgroundColor(Color.Transparent); clockImageView.Visibility = ViewStates.Visible; } } if (!clockImageView.HasOnClickListeners) { clockImageView.Click += (sender, e) => { TenServiceHelper.GoToListOf(master.FragmentManager, containerId, notification.post.idPost, FeedTypeEnum.FeedType.LikersListOfFeed); }; } if (!timeRemainingTextView.HasOnClickListeners) { timeRemainingTextView.Click += (sender, e) => { TenServiceHelper.GoToListOf(master.FragmentManager, containerId, notification.post.idPost, FeedTypeEnum.FeedType.LikersListOfFeed); }; } } }
private void SetUserAction(NotificationFeedFragment Master, int containerId, Notification notification, TextView repostLabel) { if (Master.Target == FeedTypeEnum.FeedType.StatusFeed) { repostLabel.Visibility = ViewStates.Invisible; if (notification.user.IsMe()) { repostLabel.Text = "by you"; } else { repostLabel.Text = "by " + notification.user.username; } if (!repostLabel.HasOnClickListeners) { repostLabel.Click += (sender, e) => { TenServiceHelper.GoToGuestProfile(Master.FragmentManager, containerId, notification.user); }; } } else { repostLabel.Visibility = ViewStates.Visible; } }
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); }; } }