Example #1
0
        public InviteFriends_AdapterViewHolder(View itemView, Action <InviteFriends_AdapterClickEventArgs> clickListener,
                                               Action <InviteFriends_AdapterClickEventArgs> longClickListener) : base(itemView)
        {
            try
            {
                MainView = itemView;

                //Get values
                RelativeLayout_main = (RelativeLayout)MainView.FindViewById(Resource.Id.main);
                Txt_name            = (TextView)MainView.FindViewById(Resource.Id.name_Text);
                Txt_number          = (TextView)MainView.FindViewById(Resource.Id.numberphone_Text);
                ImageAvatar         = (ImageView)MainView.FindViewById(Resource.Id.Image_Avatar);

                //Create an Event
                itemView.Click += (sender, e) => clickListener(new InviteFriends_AdapterClickEventArgs
                {
                    View = itemView, Position = AdapterPosition
                });
                itemView.LongClick += (sender, e) => longClickListener(new InviteFriends_AdapterClickEventArgs
                {
                    View = itemView, Position = AdapterPosition
                });

                //Dont Remove this code #####
                FontController.SetFont(Txt_name, 1);
                FontController.SetFont(Txt_number, 3);
                //#####

                ImageCacheLoader.LoadImage("no_profile_image.png", ImageAvatar, false, true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            try {
                base.OnCreateView(inflater, container, savedInstanceState);

                // Set our view from the "Dialog_BlockUser_Fragment" layout resource
                var view = inflater.Inflate(Resource.Layout.Dialog_BlockUser_Fragment, container, false);

                // Get values
                Txt_Username = view.FindViewById <TextView> (Resource.Id.Txt_Username);
                Txt_Name     = view.FindViewById <TextView> (Resource.Id.Txt_SecendreName);

                Btn_UnBlockUser = view.FindViewById <Button> (Resource.Id.UnBlockUser_Button);

                Image_Userprofile = view.FindViewById <ImageView> (Resource.Id.profileAvatar_image);

                ImageCacheLoader.LoadImage(_Item.avatar, Image_Userprofile, false, true);

                Txt_Username.Text = _Item.name;
                Txt_Name.Text     = "@" + _Item.username;

                return(view);
            } catch (Exception e) {
                Console.WriteLine(e);
                return(null);
            }
        }
Example #3
0
        //View itemView, string type, Action<int> listener
        public StoriesViewHolder(View itemView, Action <AdapterClickEvents> listener) : base(itemView)
        {
            try
            {
                MainView = itemView;

                //Get values
                RelativeLayout_main = (RelativeLayout)MainView.FindViewById(Resource.Id.main);
                Txt_Username        = (TextView)MainView.FindViewById(Resource.Id.Txt_Username);
                Txt_description     = (TextView)MainView.FindViewById(Resource.Id.Txt_description);

                Profile_indicator     = itemView.FindViewById <CircleImageView>(Resource.Id.profile_indicator);
                ProfileImageViewAsync = itemView.FindViewById <ImageView>(Resource.Id.userProfileImage);

                //Create an Event
                itemView.Click += (sender, e) => listener(new AdapterClickEvents
                {
                    View     = itemView,
                    Position = AdapterPosition
                });

                //Dont Remove this code #####
                FontController.SetFont(Txt_Username, 1);
                FontController.SetFont(Txt_description, 3);
                //#####

                ImageCacheLoader.LoadImage("no_profile_image.png", ProfileImageViewAsync, false, true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e + "Error");
            }
        }
Example #4
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            try
            {
                base.OnCreateView(inflater, container, savedInstanceState);

                // Set our view from the "Dialog_DeleteMessege_Fragment" layout resource
                var view = inflater.Inflate(Resource.Layout.Dialog_DeleteMessege_Fragment, container, false);

                // Get values
                Txt_Username = view.FindViewById <TextView>(Resource.Id.Txt_Username);
                Txt_Name     = view.FindViewById <TextView>(Resource.Id.Txt_SecendreName);

                Btn_DeleteMessage = view.FindViewById <Button>(Resource.Id.DeleteMessage_Button);

                Image_Userprofile = view.FindViewById <ImageView>(Resource.Id.profileAvatar_image);

                //profile_picture
                ImageCacheLoader.LoadImage(_Item.ProfilePicture, Image_Userprofile, false, true);


                Txt_Username.Text = this.GetText(Resource.String.Lbl_Doyouwanttodeletechatwith);
                Txt_Name.Text     = "@" + _Item.Username;

                // Event
                Btn_DeleteMessage.Click += BtnDeleteMessageOnClick;

                return(view);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                View mContentView = Window.DecorView;
                var  uiOptions    = (int)mContentView.SystemUiVisibility;
                var  newUiOptions = (int)uiOptions;

                newUiOptions |= (int)SystemUiFlags.Fullscreen;
                newUiOptions |= (int)SystemUiFlags.HideNavigation;
                mContentView.SystemUiVisibility = (StatusBarVisibility)newUiOptions;

                Window.AddFlags(WindowManagerFlags.Fullscreen);
                //context.Window.RequestFeature(WindowFeatures.NoTitle);

                ImageCacheLoader.InitImageLoader(this);
                base.OnCreate(savedInstanceState);

                // Create your application here

                //if (Intent.GetBooleanExtra("crash", true))
                //    Toast.MakeText(this, "App restarted after crash", ToastLength.Short).Show();
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Example #6
0
        public BlockedUsers_AdapterViewHolder(View itemView, Action <BlockedUsers_AdapterClickEventArgs> clickListener, Action <BlockedUsers_AdapterClickEventArgs> longClickListener) : base(itemView)
        {
            try
            {
                MainView = itemView;

                //Get values
                RelativeLayout_main = (RelativeLayout)MainView.FindViewById(Resource.Id.main);

                Txt_Username = (TextView)MainView.FindViewById(Resource.Id.Txt_Username);
                Txt_Lastseen = (TextView)MainView.FindViewById(Resource.Id.Txt_LastSeen);
                ImageAvatar  = (ImageView)MainView.FindViewById(Resource.Id.Image_Avatar);

                //Create an Event
                itemView.Click += (sender, e) => clickListener(new BlockedUsers_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });
                itemView.LongClick += (sender, e) => longClickListener(new BlockedUsers_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });

                FontController.SetFont(Txt_Username, 1);
                FontController.SetFont(Txt_Lastseen, 3);

                ImageCacheLoader.LoadImage("no_profile_image.png", ImageAvatar, false, true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #7
0
        public SearchUser_AdapterViewHolder(View itemView, Action <SearchUser_AdapterClickEventArgs> clickListener,
                                            Action <SearchUser_AdapterClickEventArgs> longClickListener) : base(itemView)
        {
            try
            {
                MainView = itemView;

                //Get values
                Image  = MainView.FindViewById <ImageView>(Resource.Id.card_pro_pic);
                Name   = MainView.FindViewById <TextView>(Resource.Id.card_name);
                About  = MainView.FindViewById <TextView>(Resource.Id.card_dist);
                Button = MainView.FindViewById <Button>(Resource.Id.cont);

                //Create an Event
                itemView.Click += (sender, e) => clickListener(new SearchUser_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });
                itemView.LongClick += (sender, e) => longClickListener(new SearchUser_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });

                //Dont Remove this code #####
                FontController.SetFont(Name, 1);
                FontController.SetFont(About, 3);
                FontController.SetFont(Button, 1);
                //#####

                ImageCacheLoader.LoadImage("no_profile_image.png", Image, false, true);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Example #8
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is InviteFriends_AdapterViewHolder holder)
                {
                    var item = mUsersPhoneContacts[position];
                    if (item != null)
                    {
                        if (AppSettings.FlowDirection_RightToLeft)
                        {
                            holder.RelativeLayout_main.LayoutDirection = LayoutDirection.Rtl;
                            holder.Txt_name.TextDirection   = TextDirection.Rtl;
                            holder.Txt_number.TextDirection = TextDirection.Rtl;
                        }

                        string name = IMethods.Fun_String.DecodeString(item.UserDisplayName);
                        holder.Txt_name.Text   = name;
                        holder.Txt_number.Text = item.PhoneNumber;

                        ImageCacheLoader.LoadImage("no_profile_image.png", holder.ImageAvatar, false, true);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #9
0
 // Replace the contents of a view (invoked by the layout manager)
 public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
 {
     try
     {
         // Replace the contents of the view with that element
         if (viewHolder is StickerViewHolder holder)
         {
             var item = StickerRecylerList[position];
             if (item != null)
             {
                 if (!string.IsNullOrEmpty(item))
                 {
                     //Set image
                     ImageCacheLoader.LoadImage(item, holder.ImageViewAsync, false, false);
                     IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskSticker, item);
                 }
                 else
                 {
                     ImageCacheLoader.LoadImage("ImagePlacholder_circel.png", holder.ImageViewAsync, false, false);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Example #10
0
        public void Initialize(AddNewCall_AdapterViewHolder holder, Classes.UserContacts.User item)
        {
            try
            {
                ImageCacheLoader.LoadImage(item.Avatar, holder.ImageAvatar, false, true);



                string name = IMethods.Fun_String.DecodeString(item.Name);
                holder.Txt_Username.Text = IMethods.Fun_String.SubStringCutOf(name, 25);

                if (item.UserPlatform == null)
                {
                    item.UserPlatform = "web";
                }

                //User platform
                if (item.UserPlatform.Contains("phone"))
                {
                    holder.Txt_platform.Text = this.Activity_Context.GetString(Resource.String.Lbl_Phone);
                }
                else if (item.UserPlatform.Contains("web"))
                {
                    holder.Txt_platform.Text = this.Activity_Context.GetString(Resource.String.Lbl_Web);
                }
                else
                {
                    holder.Txt_platform.Text = this.Activity_Context.GetString(Resource.String.Lbl_Web);
                }

                //Online Or offline
                if (item.Lastseen == "on")
                {
                    holder.Image_Lastseen.SetImageResource(Resource.Drawable.Green_Online);
                    if (AppSettings.Show_Online_Oflline_Message)
                    {
                        var data = listOnline.Contains(item.Name);
                        if (data == false)
                        {
                            listOnline.Add(item.Name);

                            Toast toast = Toast.MakeText(Activity_Context, item.Name + " " + this.Activity_Context.GetString(Resource.String.Lbl_Online), ToastLength.Short);
                            toast.SetGravity(GravityFlags.Center, 0, 0);
                            toast.Show();
                        }
                    }
                }
                else
                {
                    holder.Image_Lastseen.SetImageResource(Resource.Drawable.Grey_Offline);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #11
0
        public void Load_userWhenCall(string User_ID)
        {
            try
            {
                UserNameTextView.Text = name;

                //profile_picture
                ImageCacheLoader.LoadImage(avatar, UserImageViewAsync, false, true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #12
0
        public void Initialize(Last_Calls_AdapterViewHolder holder, Classes.Call_User item)
        {
            try
            {
                ImageCacheLoader.LoadImage(item.avatar, holder.Image_Avatar, false, true);


                string name = IMethods.Fun_String.DecodeString(item.name);
                holder.Txt_Username.Text = name;

                if (item.typeIcon == "Accept")
                {
                    IMethods.Set_TextViewIcon("2", holder.Txt_LastCall_icon, "\uf095");
                    holder.Txt_LastCall_icon.SetTextColor(Color.ParseColor(item.typeColor));
                }
                else if (item.typeIcon == "Cancel")
                {
                    IMethods.Set_TextViewIcon("2", holder.Txt_LastCall_icon, "\uf3dd");
                    holder.Txt_LastCall_icon.SetTextColor(Color.ParseColor(item.typeColor));
                }
                else if (item.typeIcon == "Declined")
                {
                    IMethods.Set_TextViewIcon("2", holder.Txt_LastCall_icon, "\uf05e");
                    holder.Txt_LastCall_icon.SetTextColor(Color.ParseColor(item.typeColor));
                }

                if (item.time == "Declined call")
                {
                    holder.Txt_LastTimecall.Text = this.Activity_Context.GetText(Resource.String.Lbl_Declined_call);
                }
                else if (item.time == "Missed call")
                {
                    holder.Txt_LastTimecall.Text = this.Activity_Context.GetText(Resource.String.Lbl_Missed_call);
                }
                else if (item.time == "Answered call")
                {
                    holder.Txt_LastTimecall.Text = this.Activity_Context.GetText(Resource.String.Lbl_Answered_call);
                }
                else
                {
                    holder.Txt_LastTimecall.Text = item.time;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #13
0
        public void Initialize(OnlineSearch_AdapterViewHolder holder, GetSearchObject.User item)
        {
            try
            {
                ImageCacheLoader.LoadImage(item.Avatar, holder.ImageAvatar, false, true);


                string name = IMethods.Fun_String.DecodeString(item.Name);
                holder.Txt_Username.Text = IMethods.Fun_String.SubStringCutOf(name, 14);

                string lastSeen = Activity_Context.GetText(Resource.String.Lbl_Last_seen) + " ";
                var    time     = IMethods.ITime.TimeAgo(int.Parse(item.LastseenUnixTime));
                holder.Txt_Lastseen.Text = lastSeen + time;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #14
0
        public Last_Calls_AdapterViewHolder(View itemView, Action <Last_Calls_AdapterClickEventArgs> clickListener, Action <Last_Calls_AdapterClickEventArgs> longClickListener
                                            , Action <Last_Calls_AdapterClickEventArgs> CallclickListener) : base(itemView)
        {
            try
            {
                MainView = itemView;

                //Get values

                RelativeLayout_main = (RelativeLayout)MainView.FindViewById(Resource.Id.main);

                Txt_Username      = (TextView)MainView.FindViewById(Resource.Id.Txt_name);
                Txt_LastCall_icon = (AppCompatTextView)MainView.FindViewById(Resource.Id.LastCall_icon);
                Txt_LastTimecall  = (TextView)MainView.FindViewById(Resource.Id.Txt_Lasttimecalls);
                Image_Avatar      = (ImageView)MainView.FindViewById(Resource.Id.ImageAvatar);
                Txt_IconCall      = (AppCompatTextView)MainView.FindViewById(Resource.Id.IconCall);

                //Create an Event
                itemView.Click += (sender, e) => clickListener(new Last_Calls_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });
                itemView.LongClick += (sender, e) => longClickListener(new Last_Calls_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });
                Txt_IconCall.Click += (sender, e) => CallclickListener(new Last_Calls_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });

                IMethods.Set_TextViewIcon("1", Txt_IconCall, IonIcons_Fonts.AndroidCall);
                Txt_IconCall.SetTextColor(Color.ParseColor(AppSettings.MainColor));

                //Dont Remove this code #####
                FontController.SetFont(Txt_Username, 1);
                FontController.SetFont(Txt_LastTimecall, 3);
                //#####

                ImageCacheLoader.LoadImage("no_profile_image.png", Image_Avatar, false, true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #15
0
        public void Initialize(BlockedUsers_AdapterViewHolder holder, GetBlockedUsersObject.BlockedUsers users)
        {
            try
            {
                ImageCacheLoader.LoadImage(users.avatar, holder.ImageAvatar, false, true);


                string name = IMethods.Fun_String.DecodeString(users.name);
                holder.Txt_Username.Text = name;

                string lastSeen = Activity_Context.GetText(Resource.String.Lbl_Last_seen);
                var    time     = IMethods.ITime.TimeAgo(int.Parse(users.lastseen_unix_time));
                holder.Txt_Lastseen.Text = lastSeen + " " + time;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #16
0
        public void Initialize(StoriesViewHolder holder, GetStoriesObject.Story item)
        {
            try
            {
                //profile_picture
                ImageCacheLoader.LoadImage(item.user_data.avatar, holder.ProfileImageViewAsync, false, true);



                string name = IMethods.Fun_String.DecodeString(item.user_data.name);
                holder.Txt_Username.Text = name;

                if (!string.IsNullOrEmpty(item.description))
                {
                    holder.Txt_description.Text = item.description;
                }
                else if (!string.IsNullOrEmpty(item.title))
                {
                    holder.Txt_description.Text = item.title;
                }
                else
                {
                    holder.Txt_description.Text = this.Activity_Context.GetText(Resource.String.Lbl_Empty);
                }

                if (item.Profile_indicator == null)
                {
                    item.Profile_indicator = AppSettings.Story_Default_Color;
                }

                holder.Profile_indicator.BorderColor = Color.ParseColor(item.Profile_indicator); // Default_Color
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #17
0
        public LastMessages_AdapterViewHolder(View itemView, Action <LastMessages_AdapterClickEventArgs> clickListener, Action <LastMessages_AdapterClickEventArgs> longClickListener) : base(itemView)
        {
            try
            {
                MainView = itemView;

                //Get values
                RelativeLayout_main = (RelativeLayout)MainView.FindViewById(Resource.Id.main);
                checkicon           = (AppCompatTextView)MainView.FindViewById(Resource.Id.IconCheckRead);
                LastMessagesIcon    = (AppCompatTextView)MainView.FindViewById(Resource.Id.LastMessages_icon);
                Txt_Username        = (TextView)MainView.FindViewById(Resource.Id.Txt_Username);
                Txt_LastMessages    = (TextView)MainView.FindViewById(Resource.Id.Txt_LastMessages);
                Txt_timestamp       = (TextView)MainView.FindViewById(Resource.Id.Txt_timestamp);
                ImageAvatar         = (ImageView)MainView.FindViewById(Resource.Id.ImageAvatar);
                ImageLastseen       = (CircleImageView)MainView.FindViewById(Resource.Id.ImageLastseen);

                //Create an Event
                itemView.Click += (sender, e) => clickListener(new LastMessages_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });
                itemView.LongClick += (sender, e) => longClickListener(new LastMessages_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });

                //Dont Remove this code #####
                FontController.SetFont(Txt_Username, 1);
                FontController.SetFont(Txt_LastMessages, 3);
                //#####

                ImageCacheLoader.LoadImage("no_profile_image.png", ImageAvatar, false, true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e + "Error");
            }
        }
Example #18
0
        public void SetImageStory(string url)
        {
            try
            {
                if (imagstoryDisplay.Visibility == ViewStates.Gone)
                {
                    imagstoryDisplay.Visibility = ViewStates.Visible;
                }

                var file = Android.Net.Uri.FromFile(new File(url));

                ImageCacheLoader.LoadImage(file.Path, imagstoryDisplay, false, false);


                if (videoView.Visibility == ViewStates.Visible)
                {
                    videoView.Visibility = ViewStates.Gone;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #19
0
        protected override void OnStart()
        {
            try
            {
                base.OnStart();

                IMethods.Set_TextViewIcon("1", BackIcon, IonIcons_Fonts.AndroidArrowBack);

                //profile_picture
                ImageCacheLoader.LoadImage(UserDetails.avatar, UserProfileImage, false, true);

                if (!string.IsNullOrEmpty(UserDetails.Full_name))
                {
                    usernameText.Text = UserDetails.Full_name;
                }
                else
                {
                    usernameText.Text = UserDetails.Username;
                }

                ActivityListItems.Clear();

                if (Type == "image")
                {
                    SetImageStory(Uri);
                }
                else
                {
                    SetvideoStory(Uri);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #20
0
        public async void LoadProfileFromUserID(string User_ID)
        {
            try
            {
                MainUserViewProfile.Visibility = ViewStates.Visible;

                UserNameTextView.Text = name;

                //profile_picture
                ImageCacheLoader.LoadImage(avatar, UserImageViewAsync, false, true);

                var Call_Result_Generation = await API_Request.Create_Twilio_Video_Call_Answer_Async(User_ID);

                if (Call_Result_Generation != null)
                {
                    CALL_ID                   = Call_Result_Generation.id;
                    TWILIO_ACCESS_TOKEN       = Call_Result_Generation.access_token;
                    TWILIO_ACCESS_TOKEN_USER2 = Call_Result_Generation.access_token_2;
                    ROOM_NAME                 = Call_Result_Generation.room_name;


                    TimerRequestWaiter          = new Timer();
                    TimerRequestWaiter.Interval = 5000;
                    TimerRequestWaiter.Elapsed += TimerCallRequestAnswer_Waiter_Elapsed;
                    TimerRequestWaiter.Start();
                }
                else
                {
                    FinishCall(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #21
0
        //open Layout as a message
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            try
            {
                base.OnCreateView(inflater, container, savedInstanceState);

                // Set our view from the "Dialog_User_Fragment" layout resource
                var view = inflater.Inflate(Resource.Layout.Dialog_User_Fragment, container, false);

                // Get values
                Txt_Username = view.FindViewById <TextView>(Resource.Id.Txt_Username);
                Txt_Name     = view.FindViewById <TextView>(Resource.Id.Txt_SecendreName);

                Btn_SendMesseges = view.FindViewById <CircleButton>(Resource.Id.SendMesseges_button);

                Btn_Add     = view.FindViewById <CircleButton>(Resource.Id.Add_button);
                Btn_Add.Tag = "Add";

                Image_Userprofile = view.FindViewById <ImageView>(Resource.Id.profileAvatar_image);

                //profile_picture
                ImageCacheLoader.LoadImage(_Item.Avatar, Image_Userprofile, false, true);


                Txt_Username.Text = _Item.Name;
                Txt_Name.Text     = "@" + _Item.Username;

                if (_Item.is_following == "1") // My Friend
                {
                    Btn_Add.Visibility = ViewStates.Visible;
                    Btn_Add.SetColor(Color.ParseColor("#efefef"));
                    Btn_Add.SetImageResource(Resource.Drawable.ic_tick);
                    Btn_Add.Drawable.SetTint(Color.ParseColor("#444444"));
                    Btn_Add.Tag = "friends";
                }
                else if (_Item.is_following == "2") // Request
                {
                    Btn_Add.SetColor(Color.ParseColor("#efefef"));
                    Btn_Add.SetImageResource(Resource.Drawable.ic_tick);
                    Btn_Add.Drawable.SetTint(Color.ParseColor("#444444"));
                    Btn_Add.Tag = "Request";
                }
                else if (_Item.is_following == "0") //Not Friend
                {
                    Btn_Add.Visibility = ViewStates.Visible;

                    Btn_Add.SetColor(Color.ParseColor("#444444"));
                    Btn_Add.SetImageResource(Resource.Drawable.ic_add);
                    Btn_Add.Drawable.SetTint(Color.ParseColor("#ffffff"));
                    Btn_Add.Tag = "Add";
                }

                // Event
                Btn_SendMesseges.Click += BtnSendMessegesOnClick;
                Btn_Add.Click          += BtnAddOnClick;

                return(view);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
Example #22
0
        public void Initialize(SearchUser_AdapterViewHolder holder, GetSearchObject.User item)
        {
            try
            {
                ImageCacheLoader.LoadImage(item.Avatar, holder.Image, false, true);


                string name = IMethods.Fun_String.DecodeString(item.Name);
                holder.Name.Text = IMethods.Fun_String.SubStringCutOf(name, 14);

                string lastSeen = Activity_Context.GetText(Resource.String.Lbl_Last_seen) + " ";
                var    time     = IMethods.ITime.TimeAgo(int.Parse(item.LastseenUnixTime));
                holder.About.Text = lastSeen + time;

                if (item.is_following == "1") // My Friend
                {
                    holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                    holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                    if (AppSettings.ConnectivitySystem == "1") // Following
                    {
                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Following);
                    }
                    else // Friend
                    {
                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Friends);
                    }

                    holder.Button.Tag = "true";
                }
                else if (item.is_following == "2") // Request
                {
                    holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                    holder.Button.SetTextColor(Color.ParseColor("#444444"));
                    holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Request);
                    holder.Button.Tag  = "Request";
                }
                else if (item.is_following == "0") //Not Friend
                {
                    holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                    holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                    if (AppSettings.ConnectivitySystem == "1") // Following
                    {
                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Follow);
                    }
                    else // Friend
                    {
                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_AddFriends);
                    }
                    holder.Button.Tag = "false";

                    var dbDatabase = new SqLiteDatabase();
                    dbDatabase.Delete_UsersContact(item.UserId);
                    dbDatabase.Dispose();
                }
                else
                {
                    holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                    holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                    if (AppSettings.ConnectivitySystem == "1") // Following
                    {
                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Following);
                    }
                    else // Friend
                    {
                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Friends);
                    }
                }

                if (!holder.Button.HasOnClickListeners)
                {
                    holder.Button.Click += async(sender, args) =>
                    {
                        try
                        {
                            if (!IMethods.CheckConnectivity())
                            {
                                Toast.MakeText(Activity_Context, Activity_Context.GetString(Resource.String.Lbl_Error_check_internet_connection), ToastLength.Short).Show();
                            }
                            else
                            {
                                if (holder.Button.Tag.ToString() == "false")
                                {
                                    holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                                    holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                                    if (AppSettings.ConnectivitySystem == "1") // Following
                                    {
                                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Following);
                                        holder.Button.Tag  = "true";
                                    }
                                    else // Request Friend
                                    {
                                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                                        holder.Button.SetTextColor(Color.ParseColor("#444444"));
                                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Request);
                                        holder.Button.Tag  = "Request";
                                    }
                                }
                                else
                                {
                                    holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                                    holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                                    if (AppSettings.ConnectivitySystem == "1") // Following
                                    {
                                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Follow);
                                    }
                                    else // Friend
                                    {
                                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_AddFriends);
                                    }
                                    holder.Button.Tag = "false";

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

                                await Task.Run(async() =>
                                {
                                    var(apiStatus, respond) = await Global.Follow_User(item.UserId).ConfigureAwait(false);
                                });
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }
                    }
                }
                ;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public void Initialize(MarketAdapterViewHolder holder, Get_Products_Object.Product item)
        {
            try
            {
                if (holder.Thumbnail.Tag?.ToString() != "loaded")
                {
                    ImageCacheLoader.LoadImage(item.images[0].image, holder.Thumbnail, false, false);
                    holder.Thumbnail.Tag = "loaded";
                }


                if (holder.Userprofilepic.Tag?.ToString() != "loaded")
                {
                    var AvatarSplit = item.seller.avatar.Split('/').Last();



                    var getImage_Avatar = IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskImage, AvatarSplit);
                    if (getImage_Avatar != "File Dont Exists")
                    {
                        ImageServiceLoader.Load_Image(holder.Userprofilepic, "no_profile_image.png", getImage_Avatar, 1);
                        holder.Userprofilepic.Tag = "loaded";
                    }
                    else
                    {
                        IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskImage, item.seller.avatar);
                        ImageServiceLoader.Load_Image(holder.Userprofilepic, "no_profile_image.png", item.seller.avatar, 1);
                        holder.Userprofilepic.Tag = "loaded";
                    }
                }

                if (holder.mappinIcon.Text != IonIcons_Fonts.IosLocation)
                {
                    IMethods.Set_TextViewIcon("1", holder.mappinIcon, IonIcons_Fonts.IosLocation);
                }

                if (holder.Title.Tag?.ToString() != "true")
                {
                    holder.Title.Tag  = "true";
                    holder.Title.Text = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(item.name));
                }

                if (holder.User_name.Tag?.ToString() != "true")
                {
                    holder.User_name.Tag = "true";
                    string name = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(item.seller.name));
                    holder.User_name.Text = name;
                }

                if (holder.time.Tag?.ToString() != "true")
                {
                    holder.time.Tag  = "true";
                    holder.time.Text = item.time_text;
                }


                if (holder.Txt_price.Tag?.ToString() != "true")
                {
                    holder.Txt_price.Tag  = "true";
                    holder.Txt_price.Text = item.price + " " + Settings.Market_curency;
                }


                if (holder.LocationText.Tag?.ToString() != "true")
                {
                    if (!string.IsNullOrEmpty(item.location))
                    {
                        holder.LocationText.Text = item.location;
                    }
                    else
                    {
                        holder.LocationText.Text = Activity_Context.GetText(Resource.String.Lbl_Unknown);
                    }

                    holder.LocationText.Tag = "true";
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Example #24
0
        //Function add data story
        public void AddDataStory()
        {
            try
            {
                ListOfStories.Clear();

                if (_Story_Data != null)
                {
                    IMethods.Set_TextViewIcon("1", BackIcon, IonIcons_Fonts.AndroidArrowBack);

                    //ImageServiceLoader.Load_Image(UserProfileImage, "no_profile_image.png", _Story_Data.user_data.avatar, 1);
                    ImageCacheLoader.LoadImage(_Story_Data.user_data.avatar, UserProfileImage, false, true);

                    User_ID  = _Story_Data.user_id;
                    Story_ID = _Story_Data.id;

                    string name = IMethods.Fun_String.DecodeString(_Story_Data.user_data.name);
                    usernameText.Text = name;
                    Txt_LastSeen.Text = _Story_Data.expire;

                    //Successfully read
                    _Story_Data.Profile_indicator = AppSettings.Story_Read_Color;

                    //Set show or not icon delete
                    DeleteStory_Icon.Visibility = _Story_Data.is_owner ? ViewStates.Visible : ViewStates.Invisible;

                    var getStory = Classes.StoryList.FirstOrDefault(a => a.Value == User_ID);
                    if (getStory.Value != null)
                    {
                        if (Classes.StoryList?.FirstOrDefault(a => a.Value == User_ID).Key?.Count == 0)
                        {
                            var ckd = Last_Stroies_Fragment.StoryAdapter?.mStoryList?.FirstOrDefault(a => a.user_id == User_ID);
                            if (ckd != null)
                            {
                                ckd.Profile_indicator = AppSettings.Story_Read_Color;
                            }
                        }

                        count = getStory.Key.Count;

                        foreach (var story in getStory.Key)
                        {
                            string storyAbout = "";

                            if (!string.IsNullOrEmpty(_Story_Data.description))
                            {
                                storyAbout = story.description;
                            }
                            else if (!string.IsNullOrEmpty(_Story_Data.title))
                            {
                                storyAbout = story.title;
                            }

                            //image and video
                            if (!story.thumbnail.Contains("avatar"))
                            {
                                string[] data = new string[] { story.id, storyAbout };
                                ListOfStories?.Add(story.thumbnail, data);
                            }

                            if (story.images?.Count > 0)
                            {
                                for (int i = 0; i < story.images?.Count; i++)
                                {
                                    string[] data = new string[] { story.id, storyAbout };
                                    ListOfStories.Add(story.images[i].filename, data);
                                }
                            }

                            if (story.videos?.Count > 0)
                            {
                                for (int i = 0; i < story.videos?.Count; i++)
                                {
                                    string[] data = new string[] { story.id, storyAbout };
                                    ListOfStories.Add(story.videos[i].filename, data);
                                }
                            }
                        }
                    }

                    count = ListOfStories.Count;
                    CountStoryText.Text = count.ToString();
                }

                Timerstory          = new Timer();
                Timerstory.Interval = 6000;
                Timerstory.Elapsed += Timerstory_Elapsed;
                Timerstory.Start();

                Timerprogress          = new Timer();
                Timerprogress.Interval = 60;
                Timerprogress.Elapsed += Timerprogress_Elapsed;
                Timerprogress.Start();
                progrescount = 0;

                countstory = -1; // starts the list from the first url

                RunOnUiThread(ChangeStoryView);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public void FirstRunExcute()
        {
            try
            {
                var AppSettings = new AppSettings();
                var client      = new Client(AppSettings.TripleDesAppServiceProvider);

                if (AppSettings.Show_ADMOB_Banner || AppSettings.Show_ADMOB_Interstitial || AppSettings.Show_ADMOB_RewardVideo)
                {
                    MobileAds.Initialize(this, AppSettings.Ad_App_ID);
                }

                ImageCacheLoader.InitImageLoader(this);

                SqLiteDatabase dbDatabase = new SqLiteDatabase();
                var            result     = dbDatabase.Get_data_Login_Credentials();
                if (result != null)
                {
                    Task.Run(() =>
                    {
                        dbDatabase       = new SqLiteDatabase();
                        Classes.UserList = new ObservableCollection <Classes.Get_Users_List_Object.User>();
                        var list         = dbDatabase.Get_LastUsersChat_List();
                        Classes.UserList = new ObservableCollection <Classes.Get_Users_List_Object.User>(list.OrderByDescending(a => a.LastMessage.Time));
                    });

                    UserDetails.access_token = result.access_token;
                    UserDetails.User_id      = result.UserID;
                    UserDetails.Username     = result.Username;
                    UserDetails.Password     = result.Password;
                    UserDetails.Full_name    = result.Username;
                    try
                    {
                        if (AppSettings.Lang != "")
                        {
                            if (AppSettings.Lang == "ar")
                            {
                                AppSettings.FlowDirection_RightToLeft = true;
                            }

                            Configuration config = new Configuration();

                            config.Locale = Locale.Default = new Locale(AppSettings.Lang);

                            Resources.UpdateConfiguration(config, null);
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }

                    var data = Intent.GetStringExtra("UserID") ?? "Data not available";
                    if (data != "Data not available" && !string.IsNullOrEmpty(data))
                    {
                        Intent intent = new Intent(Application.Context, typeof(ChatWindow_Activity));
                        intent.PutExtra("UserID", data); // to_id
                        intent.PutExtra("Notfi", "Notfi");
                        intent.PutExtra("App", "Timeline");
                        intent.PutExtra("Name", Intent.GetStringExtra("Name"));
                        intent.PutExtra("Username", Intent.GetStringExtra("Username"));
                        intent.PutExtra("Time", Intent.GetStringExtra("Time"));
                        intent.PutExtra("LastSeen", Intent.GetStringExtra("LastSeen"));
                        intent.PutExtra("About", Intent.GetStringExtra("About"));
                        intent.PutExtra("Address", Intent.GetStringExtra("Address"));
                        intent.PutExtra("Phone", Intent.GetStringExtra("Phone"));
                        intent.PutExtra("Website", Intent.GetStringExtra("Website"));
                        intent.PutExtra("Working", Intent.GetStringExtra("Working"));
                        StartActivity(intent);
                    }
                    else
                    {
                        StartActivity(new Intent(Application.Context, typeof(Tabbed_Main_Page)));
                    }
                }
                else
                {
                    if (AppSettings.Lang != "")
                    {
                        if (AppSettings.Lang == "ar")
                        {
                            AppSettings.FlowDirection_RightToLeft = true;
                        }

                        Configuration config = new Configuration();

                        config.Locale = Locale.Default = new Locale(AppSettings.Lang);

                        Resources.UpdateConfiguration(config, null);
                    }

                    var data = Intent.GetStringExtra("UserID") ?? "Data not available";
                    if (data != "Data not available" && !string.IsNullOrEmpty(data))
                    {
                        Intent intent = new Intent(Application.Context, typeof(ChatWindow_Activity));
                        intent.PutExtra("UserID", data); // to_id
                        intent.PutExtra("Notfi", "Notfi");
                        intent.PutExtra("App", "Timeline");
                        intent.PutExtra("Name", Intent.GetStringExtra("Name"));
                        intent.PutExtra("Username", Intent.GetStringExtra("Username"));
                        intent.PutExtra("Time", Intent.GetStringExtra("Time"));
                        intent.PutExtra("LastSeen", Intent.GetStringExtra("LastSeen"));
                        intent.PutExtra("About", Intent.GetStringExtra("About"));
                        intent.PutExtra("Address", Intent.GetStringExtra("Address"));
                        intent.PutExtra("Phone", Intent.GetStringExtra("Phone"));
                        intent.PutExtra("Website", Intent.GetStringExtra("Website"));
                        intent.PutExtra("Working", Intent.GetStringExtra("Working"));
                        StartActivity(intent);
                    }
                    else
                    {
                        StartActivity(new Intent(Application.Context, typeof(MainActivity)));
                    }
                }

                dbDatabase.Dispose();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #26
0
        public async void Update_Image_Api(string type, string path)
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_Error_check_internet_connection),
                                   ToastLength.Short)
                    .Show();
                }
                else
                {
                    if (type == "Avatar")
                    {
                        var(api_status, respond) = await Global.Update_User_Avatar(path);

                        if (api_status == 200)
                        {
                            if (respond is MessageObject result)
                            {
                                Toast.MakeText(this, result.Message, ToastLength.Short).Show();

                                var file = Uri.FromFile(new File(path));
                                //Set image
                                ImageCacheLoader.LoadImage(file.Path, Image_Userprofile, false, true);
                            }
                        }
                        else if (api_status == 400)
                        {
                            if (respond is ErrorObject error)
                            {
                                var errortext = error._errors.Error_text;
                                Toast.MakeText(this, errortext, ToastLength.Short).Show();

                                if (errortext.Contains("Invalid or expired access_token"))
                                {
                                    API_Request.Logout(this);
                                }
                            }
                        }
                        else if (api_status == 404)
                        {
                            var error = respond.ToString();
                            Toast.MakeText(this, error, ToastLength.Short).Show();
                        }
                    }
                    else if (type == "Cover")
                    {
                        var(api_status, respond) = await Global.Update_User_Cover(path);

                        if (api_status == 200)
                        {
                            if (respond is MessageObject result)
                            {
                                Toast.MakeText(this, result.Message, ToastLength.Short).Show();

                                //Set image
                                var file = Uri.FromFile(new File(path));
                                ImageCacheLoader.LoadImage(file.Path, Image_UserCover, false, false);
                            }
                        }
                        else if (api_status == 400)
                        {
                            if (respond is ErrorObject error)
                            {
                                var errortext = error._errors.Error_text;
                                Toast.MakeText(this, errortext, ToastLength.Short).Show();

                                if (errortext.Contains("Invalid or expired access_token"))
                                {
                                    API_Request.Logout(this);
                                }
                            }
                        }
                        else if (api_status == 404)
                        {
                            var error = respond.ToString();
                            Toast.MakeText(this, error, ToastLength.Short).Show();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #27
0
        private void LoadDataUser(GetUserDataObject.User_Data data)
        {
            try
            {
                //Cover
                var CoverSplit     = data.cover.Split('/').Last();
                var getImage_Cover = IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskImage, CoverSplit);
                if (getImage_Cover != "File Dont Exists")
                {
                    ImageCacheLoader.LoadImage(data.cover, Image_UserCover, false, false);
                }
                else
                {
                    IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskImage, data.cover);

                    ImageCacheLoader.LoadImage(data.cover, Image_UserCover, false, false);
                }

                //profile_picture
                var AvatarSplit     = data.avatar.Split('/').Last();
                var getImage_Avatar = IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskImage, AvatarSplit);
                if (getImage_Avatar != "File Dont Exists")
                {
                    ImageCacheLoader.LoadImage(data.avatar, Image_Userprofile, false, true);
                }
                else
                {
                    IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskImage, data.avatar);

                    ImageCacheLoader.LoadImage(data.avatar, Image_Userprofile, false, true);
                }

                UserDetails.Full_name = data.name;

                string name = IMethods.Fun_String.DecodeString(data.name);
                Txt_Fullname.Text  = name;
                Txt_UserName.Text  = "@" + data.username;
                Txt_FirstName.Text = IMethods.Fun_String.DecodeString(data.first_name);
                Txt_LastName.Text  = IMethods.Fun_String.DecodeString(data.last_name);

                S_About  = data.about;
                S_School = data.school;

                var following = IMethods.Fun_String.FormatPriceValue(Convert.ToInt32(data.details.following_count));
                var followers = IMethods.Fun_String.FormatPriceValue(Convert.ToInt32(data.details.followers_count));

                if (AppSettings.ConnectivitySystem == "1")
                {
                    Txt_Following.Visibility      = ViewStates.Visible;
                    Txt_FollowingCount.Visibility = ViewStates.Visible;

                    Txt_Followers.Visibility      = ViewStates.Visible;
                    Txt_FollowersCount.Visibility = ViewStates.Visible;

                    Txt_Following.Text      = this.GetText(Resource.String.Lbl_Following);
                    Txt_FollowingCount.Text = following;

                    Txt_Followers.Text      = this.GetText(Resource.String.Lbl_Followers);
                    Txt_FollowersCount.Text = followers;
                }
                else
                {
                    Txt_Following.Visibility      = ViewStates.Visible;
                    Txt_FollowingCount.Visibility = ViewStates.Visible;

                    Txt_Followers.Visibility      = ViewStates.Gone;
                    Txt_FollowersCount.Visibility = ViewStates.Gone;

                    Txt_Following.Text      = this.GetText(Resource.String.Lbl_Friends);
                    Txt_FollowingCount.Text = following;
                }

                switch (data.gender.ToLower())
                {
                case "male":
                    Txt_gender_text.Text = this.GetText(Resource.String.Radio_Male);
                    break;

                case "female":
                    Txt_gender_text.Text = this.GetText(Resource.String.Radio_Female);
                    break;

                default:
                    Txt_gender_text.Text = data.gender;
                    break;
                }

                Txt_location_text.Text = data.address;
                Txt_mobile_text.Text   = data.phone_number;
                Txt_website_text.Text  = data.website;
                Txt_work_text.Text     = data.working;

                S_Facebook  = data.facebook;
                S_Google    = data.google;
                S_Twitter   = data.twitter;
                S_Youtube   = data.youtube;
                S_VK        = data.vk;
                S_Instagram = data.instagram;

                Txt_facebook_text.Text  = S_Facebook;
                Txt_Google_text.Text    = S_Google;
                Txt_Twitter_text.Text   = S_Twitter;
                Txt_VK_text.Text        = S_VK;
                Txt_Instagram_text.Text = S_Instagram;
                Txt_Youtube_text.Text   = S_Youtube;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #28
0
        public AddNewCall_AdapterViewHolder(View itemView, Action <AddNewCall_AdapterClickEventArgs> clickListener, Action <AddNewCall_AdapterClickEventArgs> longClickListener
                                            , Action <AddNewCall_AdapterClickEventArgs> AudioCallclickListener, Action <AddNewCall_AdapterClickEventArgs> VideoCallclickListener) : base(itemView)
        {
            try
            {
                MainView = itemView;

                //Get values
                RelativeLayout_main = (RelativeLayout)MainView.FindViewById(Resource.Id.main);
                Txt_Username        = (TextView)MainView.FindViewById(Resource.Id.Txt_Username);
                Txt_platform        = (TextView)MainView.FindViewById(Resource.Id.Txt_Userplatform);
                ImageAvatar         = (ImageView)MainView.FindViewById(Resource.Id.Img_Avatar);
                Image_Lastseen      = (CircleImageView)MainView.FindViewById(Resource.Id.Img_Lastseen);
                Txt_IconAudioCall   = (AppCompatTextView)MainView.FindViewById(Resource.Id.IconAudioCall);
                Txt_IconVideoCall   = (AppCompatTextView)MainView.FindViewById(Resource.Id.IconVideoCall);

                itemView.Click += (sender, e) => clickListener(new AddNewCall_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });
                itemView.LongClick += (sender, e) => longClickListener(new AddNewCall_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });
                Txt_IconAudioCall.Click += (sender, e) => AudioCallclickListener(new AddNewCall_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });
                Txt_IconVideoCall.Click += (sender, e) => VideoCallclickListener(new AddNewCall_AdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition
                });


                FontController.SetFont(Txt_Username, 1);
                FontController.SetFont(Txt_platform, 3);

                if (AppSettings.Enable_Video_Call)
                {
                    Txt_IconVideoCall.Visibility = ViewStates.Visible;
                    IMethods.Set_TextViewIcon("1", Txt_IconVideoCall, IonIcons_Fonts.IosVideocam);
                }
                else
                {
                    Txt_IconVideoCall.Visibility = ViewStates.Gone;
                }

                if (AppSettings.Enable_Audio_Call)
                {
                    Txt_IconAudioCall.Visibility = ViewStates.Visible;
                    IMethods.Set_TextViewIcon("1", Txt_IconAudioCall, IonIcons_Fonts.AndroidCall);
                    Txt_IconAudioCall.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                }
                else
                {
                    Txt_IconAudioCall.Visibility = ViewStates.Gone;
                }

                ImageCacheLoader.LoadImage("no_profile_image.png", ImageAvatar, false, true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #29
0
        public void Initialize(UserContact_AdapterViewHolder holder, Classes.UserContacts.User users)
        {
            try
            {
                if (users.St_ChatColor == null)
                {
                    users.St_ChatColor = AppSettings.MainColor;
                }

                ImageCacheLoader.LoadImage(users.Avatar, holder.Image, false, true);


                string name = IMethods.Fun_String.DecodeString(users.Name);
                if (holder.Name.Text != name)
                {
                    holder.Name.Text = IMethods.Fun_String.SubStringCutOf(name, 25);
                }

                var dataAbout = IMethods.Fun_String.StringNullRemover(users.About);
                if (dataAbout != "Empty")
                {
                    var about = IMethods.Fun_String.DecodeString(dataAbout);
                    holder.About.Text = IMethods.Fun_String.SubStringCutOf(about, 25);
                }
                else
                {
                    var about = Activity_Context.GetText(Resource.String.Lbl_DefaultAbout) + " " + AppSettings.Application_Name;
                    holder.About.Text = IMethods.Fun_String.SubStringCutOf(about, 25);
                }

                if (string.IsNullOrEmpty(users.IsFollowing.ToString()))
                {
                    users.IsFollowing = 1;
                }

                //Set All My Contacts
                holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                if (AppSettings.ConnectivitySystem == "1") // Following
                {
                    holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Following);
                }
                else // Friend
                {
                    holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Friends);
                }
                holder.Button.Tag = "true";

                if (!holder.Button.HasOnClickListeners)
                {
                    holder.Button.Click += async(sender, args) =>
                    {
                        try
                        {
                            if (!IMethods.CheckConnectivity())
                            {
                                Toast.MakeText(Activity_Context,
                                               Activity_Context.GetString(Resource.String.Lbl_Error_check_internet_connection),
                                               ToastLength.Short).Show();
                            }
                            else
                            {
                                if (holder.Button.Tag.ToString() == "false")
                                {
                                    holder.Button.SetBackgroundResource(Resource.Drawable
                                                                        .follow_button_profile_friends_pressed);
                                    holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                                    if (AppSettings.ConnectivitySystem == "1") // Following
                                    {
                                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Following);
                                        holder.Button.Tag  = "true";
                                    }
                                    else // Request Friend
                                    {
                                        holder.Button.SetBackgroundResource(Resource.Drawable
                                                                            .follow_button_profile_friends);
                                        holder.Button.SetTextColor(Color.ParseColor("#444444"));
                                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Request);
                                        holder.Button.Tag  = "Request";
                                    }
                                }
                                else
                                {
                                    holder.Button.SetBackgroundResource(Resource.Drawable
                                                                        .follow_button_profile_friends);
                                    holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                                    if (AppSettings.ConnectivitySystem == "1") // Following
                                    {
                                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Follow);
                                    }
                                    else // Friend
                                    {
                                        holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_AddFriends);
                                    }
                                    holder.Button.Tag = "false";

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

                                await Task.Run(async() =>
                                {
                                    var(apiStatus, respond) = await Global.Follow_User(users.UserId).ConfigureAwait(false);
                                });
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }
                    }
                }
                ;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #30
0
        public void Initialize(LastMessages_AdapterViewHolder holder, Classes.Get_Users_List_Object.User item)
        {
            try
            {
                ImageCacheLoader.LoadImage(item.ProfilePicture, holder.ImageAvatar, false, true);

                string name = IMethods.Fun_String.DecodeString(item.Name);
                if (holder.Txt_Username.Text != name)
                {
                    holder.Txt_Username.Text = name;
                }

                //If message contains Media files
                if (item.LastMessage.Media.Contains("image"))
                {
                    if (holder.LastMessagesIcon.Text != IonIcons_Fonts.Images)
                    {
                        holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                        IMethods.Set_TextViewIcon("1", holder.LastMessagesIcon, IonIcons_Fonts.Images);
                        holder.Txt_LastMessages.Text = this.Activity_Context.GetText(Resource.String.Lbl_SendImageFile);
                    }
                }
                else if (item.LastMessage.Media.Contains("video"))
                {
                    if (holder.LastMessagesIcon.Text != IonIcons_Fonts.Videocamera)
                    {
                        holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                        IMethods.Set_TextViewIcon("1", holder.LastMessagesIcon, IonIcons_Fonts.Videocamera);
                        holder.Txt_LastMessages.Text = this.Activity_Context.GetText(Resource.String.Lbl_SendVideoFile);
                    }
                }
                else if (item.LastMessage.Media.Contains("sticker"))
                {
                    if (holder.LastMessagesIcon.Text != IonIcons_Fonts.Happy)
                    {
                        holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                        IMethods.Set_TextViewIcon("1", holder.LastMessagesIcon, IonIcons_Fonts.Happy);
                        holder.Txt_LastMessages.Text = this.Activity_Context.GetText(Resource.String.Lbl_SendStickerFile);
                    }
                }
                else if (item.LastMessage.Media.Contains("sounds"))
                {
                    if (holder.LastMessagesIcon.Text != IonIcons_Fonts.IosMusicalNote)
                    {
                        holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                        IMethods.Set_TextViewIcon("1", holder.LastMessagesIcon, IonIcons_Fonts.IosMusicalNote);
                        holder.Txt_LastMessages.Text = this.Activity_Context.GetText(Resource.String.Lbl_SendAudioFile);
                    }
                }
                else if (item.LastMessage.Media.Contains("file"))
                {
                    if (holder.LastMessagesIcon.Text != IonIcons_Fonts.IosMusicalNote)
                    {
                        holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                        IMethods.Set_TextViewIcon("1", holder.LastMessagesIcon, IonIcons_Fonts.Document);
                        holder.Txt_LastMessages.Text = this.Activity_Context.GetText(Resource.String.Lbl_SendFile);
                    }
                }
                else if (item.LastMessage.Stickers.Contains("gif"))
                {
                    if (holder.LastMessagesIcon.Text != "\uf06b")
                    {
                        holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                        IMethods.Set_TextViewIcon("4", holder.LastMessagesIcon, "\uf06b");
                        holder.Txt_LastMessages.Text = this.Activity_Context.GetText(Resource.String.Lbl_SendGifFile);
                    }
                }
                else
                {
                    holder.LastMessagesIcon.Visibility = ViewStates.Gone;

                    if (item.LastMessage.Text.Contains("http"))
                    {
                        holder.Txt_LastMessages.Text = IMethods.Fun_String.SubStringCutOf(item.LastMessage.Text, 30);
                    }
                    else if (item.LastMessage.Text.Contains("{&quot;Key&quot;") || item.LastMessage.Text.Contains("{key:^qu") || item.LastMessage.Text.Contains("{^key:^qu") || item.LastMessage.Text.Contains("{key:"))
                    {
                        if (holder.LastMessagesIcon.Text != IonIcons_Fonts.IosContact)
                        {
                            holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                            IMethods.Set_TextViewIcon("1", holder.LastMessagesIcon, IonIcons_Fonts.IosContact);
                            holder.Txt_LastMessages.Text = this.Activity_Context.GetText(Resource.String.Lbl_SendContactnumber);
                        }
                    }
                    else
                    {
                        holder.Txt_LastMessages.Text = IMethods.Fun_String.DecodeString(IMethods.Fun_String.SubStringCutOf(item.LastMessage.Text, 30));
                    }
                }

                //last seen time
                holder.Txt_timestamp.Text = IMethods.ITime.ReplaceTime(item.LastseenTimeText);


                //Online Or offline
                if (item.Lastseen == "on")
                {
                    holder.Txt_timestamp.Text = this.Activity_Context.GetText(Resource.String.Lbl_Online);
                    holder.ImageLastseen.SetImageResource(Resource.Drawable.Green_Online);

                    if (AppSettings.Show_Online_Oflline_Message)
                    {
                        var data = listOnline.Contains(item.Name);
                        if (data == false)
                        {
                            listOnline.Add(item.Name);

                            Toast toast = Toast.MakeText(Activity_Context, item.Name + " " + this.Activity_Context.GetText(Resource.String.Lbl_Online), ToastLength.Short);
                            toast.SetGravity(GravityFlags.Center, 0, 0);
                            toast.Show();
                        }
                    }
                }
                else
                {
                    holder.ImageLastseen.SetImageResource(Resource.Drawable.Grey_Offline);
                }

                //Check read message
                if (item.LastMessage.ToId != UserDetails.User_id && item.LastMessage.FromId == UserDetails.User_id)
                {
                    if (item.LastMessage.Seen == "0" || item.LastMessage.Seen == "")
                    {
                        holder.checkicon.Visibility = ViewStates.Invisible;
                        holder.Txt_Username.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                        holder.Txt_LastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                    }
                    else
                    {
                        holder.checkicon.Visibility = ViewStates.Visible;
                        holder.Txt_Username.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                        holder.Txt_LastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                        IMethods.Set_TextViewIcon("1", holder.checkicon, IonIcons_Fonts.AndroidDoneAll);
                    }
                }
                else
                {
                    if (item.LastMessage.Seen == "0" || item.LastMessage.Seen == "")
                    {
                        holder.checkicon.Visibility = ViewStates.Visible;
                        holder.Txt_Username.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
                        holder.Txt_LastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
                        IMethods.Set_TextViewIcon("1", holder.checkicon, IonIcons_Fonts.ChatbubbleWorking);
                    }
                    else
                    {
                        holder.checkicon.Visibility = ViewStates.Invisible;
                        holder.Txt_Username.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                        holder.Txt_LastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }