示例#1
0
 private void MAdapterOnItemClick(object sender, LastActivitiesAdapterClickEventArgs e)
 {
     try
     {
         var position = e.Position;
         if (position >= 0)
         {
             var item = MAdapter.GetItem(position);
             if (item != null)
             {
                 if (item.ActivityType == "following" || item.ActivityType == "friend")
                 {
                     WoWonderTools.OpenProfile(this, item.UserId, item.Activator);
                 }
                 else
                 {
                     var intent = new Intent(this, typeof(ViewFullPostActivity));
                     intent.PutExtra("Id", item.PostId);
                     intent.PutExtra("DataItem", JsonConvert.SerializeObject(item.PostData));
                     StartActivity(intent);
                 }
             }
         }
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
 //Event Click Item last Activities and Open ViewFullPostActivity Or Profile
 private void LastActivitiesAdapterOnItemClick(object sender, LastActivitiesAdapterClickEventArgs adapterClickEvents)
 {
     try
     {
         var position = adapterClickEvents.Position;
         if (position >= 0)
         {
             var item = MAdapter.GetItem(position);
             if (item != null)
             {
                 if (item.ActivityType == "following" || item.ActivityType == "friend")
                 {
                     WoWonderTools.OpenProfile(Activity, item.UserId, item.Activator);
                 }
                 else
                 {
                     var intent = new Intent(Activity, typeof(ViewFullPostActivity));
                     intent.PutExtra("Id", item.PostId);
                     //intent.PutExtra("DataItem", JsonConvert.SerializeObject(item.PostData));
                     Activity.StartActivity(intent);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
示例#3
0
 // Event Show all Friend Request
 private void ProUsersAdapterOnItemClick(object sender, ProUsersAdapterClickEventArgs adapterClickEvents)
 {
     try
     {
         var position = adapterClickEvents.Position;
         if (position >= 0)
         {
             var item = GlobalContext.ProUsersAdapter.GetItem(position);
             if (item != null)
             {
                 if (item.Type == "Your")
                 {
                     var intent = new Intent(Activity, typeof(GoProActivity));
                     Activity.StartActivity(intent);
                 }
                 else
                 {
                     WoWonderTools.OpenProfile(Activity, item.UserId, item);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Methods.DisplayReportResultTrack(ex);
     }
 }
示例#4
0
 private void UserImageAvatarOnClick(object sender, EventArgs e)
 {
     try
     {
         WoWonderTools.OpenProfile(this, DataObject.UserData.UserId, DataObject.UserData);
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
 public void ProfilePostClick(ProfileClickEventArgs e)
 {
     try
     {
         WoWonderTools.OpenProfile(MainContext, e.CommentClass.UserId, e.CommentClass.Publisher);
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
 private void UserImageAvatarOnClick(object sender, EventArgs e)
 {
     try
     {
         WoWonderTools.OpenProfile(this, DataObject.UserData.UserId, DataObject.UserData);
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
示例#7
0
 public void ProfilePostClick(ProfileClickEventArgs e)
 {
     try
     {
         WoWonderTools.OpenProfile(MainContext, e.CommentClass.UserId, e.CommentClass.Publisher);
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
示例#8
0
 public void ProfileClick(CommentReplyMoviesClickEventArgs e)
 {
     try
     {
         WoWonderTools.OpenProfile(MainContext, e.CommentObject.UserData.UserId, e.CommentObject.UserData);
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
 public void ProfileClick(CommentReplyArticlesClickEventArgs e)
 {
     try
     {
         WoWonderTools.OpenProfile(MainContext, e.CommentObject.UserData.UserId, e.CommentObject.UserData);
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
示例#10
0
        private void Initialize(ArticlesAdapterViewHolder holder, ArticleDataObject item)
        {
            try
            {
                var colorImage = Color.ParseColor(Methods.FunString.RandomColor());

                Glide.With(ActivityContext)
                .Load(item.Thumbnail)
                .Apply(RequestOptions.CenterCropTransform().Placeholder(new ColorDrawable(colorImage)).Fallback(new ColorDrawable(colorImage)).SetPriority(Priority.High))
                .Into(holder.Image);

                Glide.With(ActivityContext)
                .Load(item.Author.Avatar)
                .Apply(RequestOptions.CircleCropTransform())
                .Into(holder.UserImageProfile);

                holder.Category.SetBackgroundColor(colorImage);

                CategoriesController cat = new CategoriesController();
                string id = item.CategoryLink.Split('/').Last();
                holder.Category.Text = cat.Get_Translate_Categories_Communities(id, item.CategoryName);

                holder.Description.Text = Methods.FunString.DecodeString(item.Description);
                holder.Title.Text       = Methods.FunString.DecodeString(item.Title);
                holder.Username.Text    = WoWonderTools.GetNameFinal(item.Author);
                holder.ViewMore.Text    = ActivityContext.GetText(Resource.String.Lbl_ReadMore) + " >"; //READ MORE >
                holder.Time.Text        = item.Posted;

                if (!holder.UserItem.HasOnClickListeners)
                {
                    holder.UserItem.Click += (sender, args) =>
                    {
                        try
                        {
                            WoWonderTools.OpenProfile(ActivityContext, item.Author.UserId, item.Author);
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }
                    }
                }
                ;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 private void MAdapterOnItemClick(object sender, ContactsAdapterClickEventArgs e)
 {
     try
     {
         var item = MAdapter.GetItem(e.Position);
         if (item != null)
         {
             WoWonderTools.OpenProfile(this, item.UserId, item);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
示例#12
0
 private void MAdapterOnItemClick(object sender, ContactsAdapterClickEventArgs e)
 {
     try
     {
         var item = MAdapter.GetItem(e.Position);
         if (item != null)
         {
             WoWonderTools.OpenProfile(this, item.UserId, item);
         }
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
 //Open profile
 private void MAdapterOnItemClick(object sender, InvitationLinksAdapterClickEventArgs e)
 {
     try
     {
         var position = e.Position;
         if (position > -1)
         {
             var item = MAdapter.GetItem(position);
             if (item?.UserData?.UserDataClass != null)
             {
                 WoWonderTools.OpenProfile(this, item.UserData.Value.UserDataClass.UserId, item.UserData.Value.UserDataClass);
             }
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
示例#14
0
        private void MAdapterOnItemClick(object sender, LastActivitiesAdapterClickEventArgs e)
        {
            try
            {
                var position = e.Position;
                switch (position)
                {
                case >= 0:
                {
                    var item = MAdapter.GetItem(position);
                    if (item != null)
                    {
                        switch (item.ActivityType)
                        {
                        case "following":
                        case "friend":
                            WoWonderTools.OpenProfile(this, item.FollowId, item.FollowData);
                            break;

                        default:
                        {
                            var intent = new Intent(this, typeof(ViewFullPostActivity));
                            intent.PutExtra("Id", item.PostId);
                            intent.PutExtra("DataItem", JsonConvert.SerializeObject(item.PostData));
                            StartActivity(intent);
                            break;
                        }
                        }
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
示例#15
0
        private void AdapterFollowersOnItemClick(object sender, ContactsAdapterClickEventArgs e)
        {
            try
            {
                switch (MAdapter)
                {
                case ContactsAdapter adapter:
                {
                    var item = adapter.GetItem(e.Position);
                    if (item != null)
                    {
                        WoWonderTools.OpenProfile(this, item.UserId, item);
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
示例#16
0
        //Open profile
        private void MAdapterOnItemClick(object sender, InvitationLinksAdapterClickEventArgs e)
        {
            try
            {
                var position = e.Position;
                switch (position)
                {
                case > -1:
                {
                    var item = MAdapter.GetItem(position);
                    if (item?.UserData?.UserDataClass != null)
                    {
                        WoWonderTools.OpenProfile(this, item.UserData.Value.UserDataClass.UserId, item.UserData.Value.UserDataClass);
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
示例#17
0
        public void EventClickNotification(Activity activity, NotificationObject item)
        {
            try
            {
                switch (item.Type)
                {
                case "following":
                case "visited_profile":
                case "accepted_request":
                    WoWonderTools.OpenProfile(Activity, item.Notifier.UserId, item.Notifier);
                    break;

                case "liked_page":
                case "invited_page":
                case "accepted_invite":
                {
                    var intent = new Intent(Activity, typeof(PageProfileActivity));
                    //intent.PutExtra("PageObject", JsonConvert.SerializeObject(item));
                    intent.PutExtra("PageId", item.PageId);
                    activity.StartActivity(intent);
                    break;
                }

                case "joined_group":
                case "accepted_join_request":
                case "added_you_to_group":
                {
                    var intent = new Intent(activity, typeof(GroupProfileActivity));
                    //intent.PutExtra("GroupObject", JsonConvert.SerializeObject(item));
                    intent.PutExtra("GroupId", item.GroupId);
                    activity.StartActivity(intent);
                    break;
                }

                case "comment":
                case "wondered_post":
                case "wondered_comment":
                case "reaction":
                case "wondered_reply_comment":
                case "comment_mention":
                case "comment_reply_mention":
                case "liked_post":
                case "liked_comment":
                case "liked_reply_comment":
                case "post_mention":
                case "share_post":
                case "shared_your_post":
                case "comment_reply":
                case "also_replied":
                case "profile_wall_post":
                {
                    var intent = new Intent(activity, typeof(ViewFullPostActivity));
                    intent.PutExtra("Id", item.PostId);
                    // intent.PutExtra("DataItem", JsonConvert.SerializeObject(item));
                    activity.StartActivity(intent);
                    break;
                }

                case "going_event":
                {
                    var intent = new Intent(activity, typeof(EventViewActivity));
                    intent.PutExtra("EventId", item.EventId);
                    if (item.Event != null)
                    {
                        intent.PutExtra("EventView", JsonConvert.SerializeObject(item.Event));
                    }
                    activity.StartActivity(intent);
                    break;
                }

                case "viewed_story":
                {
                    //"url": "https:\/\/demo.wowonder.com\/timeline&u=Matan&story=true&story_id=1946",
                    //var id = item.Url.Split("/").Last().Split("&story_id=").Last();

                    StoryDataObject dataMyStory = GlobalContext?.NewsFeedTab?.PostFeedAdapter?.HolderStory?.StoryAdapter?.StoryList?.FirstOrDefault(o => o.UserId == UserDetails.UserId);
                    if (dataMyStory != null)
                    {
                        Intent intent = new Intent(activity, typeof(ViewStoryActivity));
                        intent.PutExtra("UserId", dataMyStory.UserId);
                        intent.PutExtra("DataItem", JsonConvert.SerializeObject(dataMyStory));
                        activity.StartActivity(intent);
                    }

                    break;
                }

                case "requested_to_join_group":
                {
                    var intent = new Intent(activity, typeof(JoinRequestActivity));
                    intent.PutExtra("GroupId", item.GroupId);
                    activity.StartActivity(intent);
                    break;
                }

                case "memory":
                {
                    var intent = new Intent(activity, typeof(MemoriesActivity));
                    activity.StartActivity(intent);
                    break;
                }

                case "gift":
                {
                    var ajaxUrl  = item.AjaxUrl.Split(new[] { "&", "gift_img=" }, StringSplitOptions.None);
                    var urlImage = WoWonderTools.GetTheFinalLink(ajaxUrl?[3]?.Replace("%2F", "/"));

                    var intent = new Intent(Activity, typeof(UserProfileActivity));
                    intent.PutExtra("UserObject", JsonConvert.SerializeObject(item.Notifier));
                    intent.PutExtra("UserId", item.Notifier.UserId);
                    intent.PutExtra("GifLink", urlImage);
                    Activity.StartActivity(intent);
                    break;
                }

                default:
                    WoWonderTools.OpenProfile(Activity, item.Notifier.UserId, item.Notifier);
                    break;
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
示例#18
0
        public void AutoLinkTextClick(StTools.XAutoLinkMode p0, string p1, Dictionary <string, string> userData)
        {
            try
            {
                var typeText = Methods.FunString.Check_Regex(p1.Replace(" ", ""));
                if (typeText == "Email")
                {
                    Methods.App.SendEmail(this, p1.Replace(" ", ""));
                }
                else if (typeText == "Website")
                {
                    string url = p1.Replace(" ", "");
                    if (!p1.Contains("http"))
                    {
                        url = "http://" + p1.Replace(" ", "");
                    }

                    //var intent = new Intent(this, typeof(LocalWebViewActivity));
                    //intent.PutExtra("URL", url.Replace(" ", ""));
                    //intent.PutExtra("Type", url.Replace(" ", ""));
                    //this.StartActivity(intent);
                    new IntentController(this).OpenBrowserFromApp(url);
                }
                else if (typeText == "Hashtag")
                {
                    var intent = new Intent(this, typeof(HashTagPostsActivity));
                    intent.PutExtra("Id", p1.Replace(" ", ""));
                    intent.PutExtra("Tag", p1.Replace(" ", ""));
                    StartActivity(intent);
                }
                else if (typeText == "Mention")
                {
                    var    dataUSer = ListUtils.MyProfileList?.FirstOrDefault();
                    string name     = p1.Replace("@", "").Replace(" ", "");

                    var sqlEntity = new SqLiteDatabase();
                    var user      = sqlEntity.Get_DataOneUser(name);


                    if (user != null)
                    {
                        WoWonderTools.OpenProfile(this, user.UserId, user);
                    }
                    else if (userData?.Count > 0)
                    {
                        var data = userData.FirstOrDefault(a => a.Value == name);
                        if (data.Key != null && data.Key == UserDetails.UserId)
                        {
                            if (PostClickListener.OpenMyProfile)
                            {
                                return;
                            }
                            var intent = new Intent(this, typeof(MyProfileActivity));
                            StartActivity(intent);
                        }
                        else if (data.Key != null)
                        {
                            var intent = new Intent(this, typeof(UserProfileActivity));
                            //intent.PutExtra("UserObject", JsonConvert.SerializeObject(item));
                            intent.PutExtra("UserId", data.Key);
                            StartActivity(intent);
                        }
                    }
                    else
                    {
                        if (name == dataUSer?.Name || name == dataUSer?.Username)
                        {
                            if (PostClickListener.OpenMyProfile)
                            {
                                return;
                            }
                            var intent = new Intent(this, typeof(MyProfileActivity));
                            StartActivity(intent);
                        }
                        else
                        {
                            var intent = new Intent(this, typeof(UserProfileActivity));
                            //intent.PutExtra("UserObject", JsonConvert.SerializeObject(item));
                            intent.PutExtra("name", name);
                            StartActivity(intent);
                        }
                    }
                }
                else if (typeText == "Number")
                {
                    Methods.App.SaveContacts(this, p1.Replace(" ", ""), "", "2");
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
示例#19
0
        public async void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                if (itemString.ToString() == Context.GetText(Resource.String.Lbl_View_Profile))
                {
                    WoWonderTools.OpenProfile(Activity, DataUserChat.UserId, DataUserChat);
                }
                else if (itemString.ToString() == Context.GetText(Resource.String.Lbl_Block))
                {
                    if (Methods.CheckConnectivity())
                    {
                        (int apiStatus, var respond) = await RequestsAsync.Global.Block_User(DataUserChat.UserId, true); //true >> "block"

                        if (apiStatus == 200)
                        {
                            Console.WriteLine(respond);

                            var dbDatabase = new SqLiteDatabase();
                            dbDatabase.Delete_UsersContact(DataUserChat.UserId);
                            dbDatabase.Dispose();

                            Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_Blocked_successfully), ToastLength.Short).Show();
                        }
                    }
                    else
                    {
                        Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                    }
                }
                else if (itemString.ToString() == Context.GetText(Resource.String.Lbl_Voice_call))
                {
                    string timeNow       = DateTime.Now.ToString("hh:mm");
                    var    unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
                    string time          = Convert.ToString(unixTimestamp);

                    Intent intentVideoCall = new Intent(Context, typeof(TwilioVideoCallActivity));
                    if (AppSettings.UseAgoraLibrary && AppSettings.UseTwilioLibrary == false)
                    {
                        intentVideoCall = new Intent(Context, typeof(AgoraAudioCallActivity));
                        intentVideoCall.PutExtra("type", "Agora_audio_calling_start");
                    }
                    else if (AppSettings.UseAgoraLibrary == false && AppSettings.UseTwilioLibrary)
                    {
                        intentVideoCall = new Intent(Context, typeof(TwilioAudioCallActivity));
                        intentVideoCall.PutExtra("type", "Twilio_audio_calling_start");
                    }

                    intentVideoCall.PutExtra("UserID", DataUserChat.UserId);
                    intentVideoCall.PutExtra("avatar", DataUserChat.Avatar);
                    intentVideoCall.PutExtra("name", DataUserChat.Name);
                    intentVideoCall.PutExtra("time", timeNow);
                    intentVideoCall.PutExtra("CallID", time);
                    StartActivity(intentVideoCall);
                }
                else if (itemString.ToString() == Context.GetText(Resource.String.Lbl_Video_call))
                {
                    string timeNow       = DateTime.Now.ToString("hh:mm");
                    var    unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
                    string time          = Convert.ToString(unixTimestamp);

                    Intent intentVideoCall = new Intent(Context, typeof(TwilioVideoCallActivity));
                    if (AppSettings.UseAgoraLibrary && AppSettings.UseTwilioLibrary == false)
                    {
                        intentVideoCall = new Intent(Context, typeof(AgoraVideoCallActivity));
                        intentVideoCall.PutExtra("type", "Agora_video_calling_start");
                    }
                    else if (AppSettings.UseAgoraLibrary == false && AppSettings.UseTwilioLibrary)
                    {
                        intentVideoCall = new Intent(Context, typeof(TwilioVideoCallActivity));
                        intentVideoCall.PutExtra("type", "Twilio_video_calling_start");
                    }

                    intentVideoCall.PutExtra("UserID", DataUserChat.UserId);
                    intentVideoCall.PutExtra("avatar", DataUserChat.Avatar);
                    intentVideoCall.PutExtra("name", DataUserChat.Name);
                    intentVideoCall.PutExtra("time", timeNow);
                    intentVideoCall.PutExtra("CallID", time);
                    intentVideoCall.PutExtra("access_token", "YOUR_TOKEN");
                    intentVideoCall.PutExtra("access_token_2", "YOUR_TOKEN");
                    intentVideoCall.PutExtra("from_id", "0");
                    intentVideoCall.PutExtra("active", "0");
                    intentVideoCall.PutExtra("status", "0");
                    intentVideoCall.PutExtra("room_name", "TestRoom");
                    StartActivity(intentVideoCall);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        //Open user profile
        private void MAdapterOnItemClick(object sender, NotificationsAdapterClickEventArgs e)
        {
            try
            {
                if (e.Position > -1)
                {
                    var item = MAdapter.GetItem(e.Position);
                    if (item != null)
                    {
                        if (item.Type == "following" || item.Type == "visited_profile" || item.Type == "accepted_request")
                        {
                            WoWonderTools.OpenProfile(Activity, item.Notifier.UserId, item.Notifier);
                        }
                        else if (item.Type == "liked_page" || item.Type == "invited_page" || item.Type == "accepted_invite")
                        {
                            var intent = new Intent(Context, typeof(PageProfileActivity));
                            //intent.PutExtra("PageObject", JsonConvert.SerializeObject(item));
                            intent.PutExtra("PageId", item.PageId);
                            Context.StartActivity(intent);
                        }
                        else if (item.Type == "joined_group" || item.Type == "accepted_join_request" || item.Type == "added_you_to_group")
                        {
                            var intent = new Intent(Context, typeof(GroupProfileActivity));
                            //intent.PutExtra("GroupObject", JsonConvert.SerializeObject(item));
                            intent.PutExtra("GroupId", item.GroupId);
                            Context.StartActivity(intent);
                        }
                        else if (item.Type == "comment" || item.Type == "wondered_post" ||
                                 item.Type == "wondered_comment" || item.Type == "reaction" ||
                                 item.Type == "wondered_reply_comment" || item.Type == "comment_mention" ||
                                 item.Type == "comment_reply_mention" ||
                                 item.Type == "liked_post" || item.Type == "liked_comment" ||
                                 item.Type == "liked_reply_comment" || item.Type == "post_mention" ||
                                 item.Type == "share_post" || item.Type == "shared_your_post" || item.Type == "comment_reply" ||
                                 item.Type == "also_replied" || item.Type == "profile_wall_post")
                        {
                            var intent = new Intent(Context, typeof(ViewFullPostActivity));
                            intent.PutExtra("Id", item.PostId);
                            // intent.PutExtra("DataItem", JsonConvert.SerializeObject(item));
                            Context.StartActivity(intent);
                        }
                        else if (item.Type == "going_event")
                        {
                            var intent = new Intent(Context, typeof(EventViewActivity));
                            intent.PutExtra("EventView", JsonConvert.SerializeObject(item.Event));
                            intent.PutExtra("Id", item.EventId);
                            Context.StartActivity(intent);
                        }
                        else if (item.Type == "viewed_story")
                        {
                            //"url": "https:\/\/demo.wowonder.com\/timeline&u=Matan&story=true&story_id=1946",
                            //var id = item.Url.Split("/").Last().Split("&story_id=").Last();

                            GetUserStoriesObject.StoryObject dataMyStory = GlobalContext?.NewsFeedTab?.PostFeedAdapter?.HolderStory?.StoryAdapter?.StoryList?.FirstOrDefault(o => o.UserId == UserDetails.UserId);
                            if (dataMyStory != null)
                            {
                                Intent intent = new Intent(Context, typeof(ViewStoryActivity));
                                intent.PutExtra("UserId", dataMyStory.UserId);
                                intent.PutExtra("DataItem", JsonConvert.SerializeObject(dataMyStory));
                                Context.StartActivity(intent);
                            }
                        }
                        else if (item.Type == "requested_to_join_group")
                        {
                            var intent = new Intent(Context, typeof(JoinRequestActivity));
                            intent.PutExtra("GroupId", item.GroupId);
                            Context.StartActivity(intent);
                        }
                        else if (item.Type == "memory")
                        {
                            var intent = new Intent(Context, typeof(MemoriesActivity));
                            Context.StartActivity(intent);
                        }
                        else
                        {
                            WoWonderTools.OpenProfile(Activity, item.Notifier.UserId, item.Notifier);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        private void MAdapterOnItemClick(object sender, TrendingAdapterClickEventArgs e)
        {
            try
            {
                var item = MAdapter.GetItem(e.Position);
                switch (item?.Type)
                {
                case Classes.ItemType.FriendRequest:
                {
                    var intent = new Intent(Activity, typeof(FriendRequestActivity));
                    Activity.StartActivity(intent);
                    break;
                }

                case Classes.ItemType.LastActivities when item.LastActivities.ActivityType == "following" || item.LastActivities.ActivityType == "friend":
                    WoWonderTools.OpenProfile(Activity, item.LastActivities.UserId, item.LastActivities.Activator);
                    break;

                case Classes.ItemType.LastActivities:
                {
                    var intent = new Intent(Activity, typeof(ViewFullPostActivity));
                    intent.PutExtra("Id", item.LastActivities.PostId);
                    //intent.PutExtra("DataItem", JsonConvert.SerializeObject(item.PostData));
                    Activity.StartActivity(intent);
                    break;
                }

                case Classes.ItemType.HashTag:
                {
                    string id     = item.HashTags.Hash.Replace("#", "").Replace("_", " ");
                    string tag    = item.HashTags?.Tag?.Replace("#", "");
                    var    intent = new Intent(Activity, typeof(HashTagPostsActivity));
                    intent.PutExtra("Id", id);
                    intent.PutExtra("Tag", tag);
                    Activity.StartActivity(intent);
                    break;
                }

                case Classes.ItemType.Section when item.SectionType == Classes.ItemType.HashTag:
                {
                    var intent = new Intent(Activity, typeof(SearchTabbedActivity));
                    intent.PutExtra("Key", "");
                    Activity.StartActivity(intent);
                    break;
                }

                case Classes.ItemType.Section when item.SectionType == Classes.ItemType.LastActivities:
                {
                    var intent = new Intent(Activity, typeof(LastActivitiesActivity));
                    Activity.StartActivity(intent);
                    break;
                }

                case Classes.ItemType.LastBlogs:
                {
                    var intent = new Intent(Activity, typeof(ArticlesViewActivity));
                    intent.PutExtra("Id", item.LastBlogs.Id);
                    intent.PutExtra("ArticleObject", JsonConvert.SerializeObject(item.LastBlogs));
                    Activity.StartActivity(intent);
                    break;
                }

                case Classes.ItemType.Section when item.SectionType == Classes.ItemType.LastBlogs:
                {
                    var intent = new Intent(Activity, typeof(ArticlesActivity));
                    Activity.StartActivity(intent);
                    break;
                }

                case Classes.ItemType.CoronaVirus:
                {
                    var intent = new Intent(Context, typeof(Covid19Activity));
                    Activity.StartActivity(intent);
                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
示例#22
0
        private void LoadCommentMovies()
        {
            try
            {
                if (MoviesObject == null)
                {
                    return;
                }

                if (AppSettings.FlowDirectionRightToLeft)
                {
                    BubbleLayout.LayoutDirection = LayoutDirection.Rtl;
                }

                var changer = new TextSanitizer(CommentText, Activity);
                changer.Load(Methods.FunString.DecodeString(MoviesObject.Text));

                TimeTextView.Text = Methods.Time.TimeAgo(int.Parse(MoviesObject.Posted));
                UserName.Text     = MoviesObject.UserData.Name;

                GlideImageLoader.LoadImage(Activity, MoviesObject.UserData.Avatar, Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                var textHighLighter = MoviesObject.UserData.Name;
                var textIsPro       = string.Empty;

                if (MoviesObject.UserData.Verified == "1")
                {
                    textHighLighter += " " + IonIconsFonts.CheckmarkCircled;
                }

                if (MoviesObject.UserData.IsPro == "1")
                {
                    textIsPro        = " " + IonIconsFonts.Flash;
                    textHighLighter += textIsPro;
                }

                var decorator = TextDecorator.Decorate(UserName, textHighLighter).SetTextStyle((int)TypefaceStyle.Bold, 0, MoviesObject.UserData.Name.Length);

                if (MoviesObject.UserData.Verified == "1")
                {
                    decorator.SetTextColor(Resource.Color.Post_IsVerified, IonIconsFonts.CheckmarkCircled);
                }

                if (MoviesObject.UserData.IsPro == "1")
                {
                    decorator.SetTextColor(Resource.Color.text_color_in_between, textIsPro);
                }

                decorator.Build();

                if (MoviesObject.Replies?.Count > 0)
                {
                    ReplyTextView.Text = Activity.GetText(Resource.String.Lbl_Reply) + " " + "(" + MoviesObject.Replies + ")";
                }

                if (MoviesObject.IsCommentLiked)
                {
                    LikeTextView.Text = Activity.GetText(Resource.String.Btn_Liked);
                    LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                    LikeTextView.Tag = "Liked";
                }
                else
                {
                    LikeTextView.Text = Activity.GetText(Resource.String.Btn_Like);
                    LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#000000"));
                    LikeTextView.Tag = "Like";
                }

                TimeTextView.Tag = "true";

                if (Image.HasOnClickListeners)
                {
                    return;
                }

                //Create an Event
                Image.Click += (sender, args) =>
                {
                    try
                    {
                        WoWonderTools.OpenProfile(Activity, MoviesObject.UserData.UserId, MoviesObject.UserData);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                };

                LikeTextView.Click += delegate
                {
                    try
                    {
                        if (!Methods.CheckConnectivity())
                        {
                            Toast.MakeText(Activity, Activity.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                            return;
                        }

                        if (LikeTextView.Tag.ToString() == "Liked")
                        {
                            LikeTextView.Text = Activity.GetText(Resource.String.Btn_Like);
                            LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#000000"));
                            LikeTextView.Tag = "Like";

                            MoviesObject.IsCommentLiked = false;
                            //sent api Dislike comment
                            PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                () => RequestsAsync.Movies.LikeUnLikeCommentAsync(MoviesObject.MovieId, MoviesObject.Id, false)
                            });
                        }
                        else
                        {
                            LikeTextView.Text = Activity.GetText(Resource.String.Btn_Liked);
                            LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                            LikeTextView.Tag = "Liked";

                            MoviesObject.IsCommentLiked = true;
                            //sent api Dislike comment
                            PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                () => RequestsAsync.Movies.LikeUnLikeCommentAsync(MoviesObject.MovieId, MoviesObject.Id, false)
                            });
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                };
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#23
0
        public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                    return;
                }

                if (itemString.ToString() == GetText(Resource.String.Lbl_MakeAdmin))
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Page.MakePageAdmin(PageId, ItemUser.UserId)
                    });

                    var local = MAdapter?.UserList?.FirstOrDefault(a => a.UserId == ItemUser.UserId);
                    if (local != null)
                    {
                        ItemUser.IsAdmin = "1";
                        MAdapter?.NotifyItemChanged(MAdapter.UserList.IndexOf(local));
                    }
                }
                else if (itemString.ToString() == GetText(Resource.String.Lbl_RemoveAdmin))
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Page.MakePageAdmin(PageId, ItemUser.UserId)
                    });

                    var local = MAdapter?.UserList?.FirstOrDefault(a => a.UserId == ItemUser.UserId);
                    if (local != null)
                    {
                        MAdapter.UserList.Remove(local);
                        MAdapter?.NotifyItemRemoved(MAdapter.UserList.IndexOf(local));
                    }
                }
                else if (itemString.ToString() == GetText(Resource.String.Lbl_BlockMember))
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Global.Block_User(PageId, true)
                    });

                    var local = MAdapter?.UserList?.FirstOrDefault(a => a.UserId == ItemUser.UserId);
                    if (local != null)
                    {
                        MAdapter.UserList.Remove(local);
                        MAdapter?.NotifyItemRemoved(MAdapter.UserList.IndexOf(local));
                    }
                }
                else if (itemString.ToString() == GetText(Resource.String.Lbl_ViewProfile))
                {
                    WoWonderTools.OpenProfile(this, ItemUser.UserId, ItemUser);
                }

                if (MAdapter?.UserList?.Count == 0)
                {
                    ShowEmptyPage();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }