private void MAdapterOnOnItemClick(object sender, LastChatAdapterClickEventArgs e)
        {
            try
            {
                HomeActivity.GetInstance()?.SetService();

                if (ToolBar.Visibility != ViewStates.Visible)
                {
                    ToolBar.Visibility = ViewStates.Visible;
                }

                // read the item which removes bold from the row >> event click open ChatBox by user id
                var item = MAdapter.GetItem(e.Position);
                if (item != null)
                {
                    UserId                   = item.User.Id.ToString();
                    item.GetCountSeen        = 0;
                    item.GetLastMessage.Seen = 1;
                    Intent intent = new Intent(this, typeof(MessagesBoxActivity));
                    intent.PutExtra("UserId", item.User.Id.ToString());
                    intent.PutExtra("TypeChat", "LastChat");
                    intent.PutExtra("UserItem", JsonConvert.SerializeObject(item.User));

                    // Check if we're running on Android 5.0 or higher
                    if ((int)Build.VERSION.SdkInt < 23)
                    {
                        StartActivity(intent);
                        MAdapter.NotifyItemChanged(e.Position);
                    }
                    else
                    {
                        //Check to see if any permission in our group is available, if one, then all are
                        if (CheckSelfPermission(Manifest.Permission.ReadExternalStorage) == Permission.Granted && CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Permission.Granted)
                        {
                            StartActivity(intent);
                            MAdapter.NotifyItemChanged(e.Position);
                        }
                        else
                        {
                            new PermissionsController(this).RequestPermission(100);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
 public FragmentBottomNavigationView(Activity context)
 {
     try
     {
         Context          = (HomeActivity)context;
         FragmentListTab0 = new List <Fragment>();
         FragmentListTab1 = new List <Fragment>();
         FragmentListTab2 = new List <Fragment>();
         FragmentListTab3 = new List <Fragment>();
         FragmentListTab4 = new List <Fragment>();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Beispiel #3
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                GlobalContext = (HomeActivity)Activity;

                UserPostAdapter = new UserPostAdapter(Activity);

                HasOptionsMenu = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #4
0
            public async void Run()
            {
                try
                {
                    await ApiRequest.GetInfoData(Activity, UserDetails.UserId.ToString()).ConfigureAwait(false);

                    HomeActivity.GetInstance()?.GetNotifications();
                    await ApiRequest.LoadFriendRequestsData(Activity).ConfigureAwait(false);

                    MainHandler?.PostDelayed(new ApiPostUpdaterHelper(Activity, MainHandler), 20000);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
 private void MoreTextOnClick(object sender, EventArgs e)
 {
     try
     {
         var globalContext = HomeActivity.GetInstance();
         if (globalContext?.TrendingFragment != null)
         {
             globalContext.TrendingFragment.HotOrNotFragment = new HotOrNotFragment();
             globalContext.FragmentBottomNavigator.DisplayFragment(globalContext.TrendingFragment.HotOrNotFragment);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
Beispiel #6
0
 public StationsAdapter(Activity context)
 {
     try
     {
         ActivityContext = context;
         HasStableIds    = true;
         ClickListeners  = new SocialIoClickListeners(context);
         var glideRequestOptions = new RequestOptions().Error(Resource.Drawable.ImagePlacholder).Placeholder(Resource.Drawable.ImagePlacholder).SetDiskCacheStrategy(DiskCacheStrategy.All).SetPriority(Priority.High);
         FullGlideRequestBuilder = Glide.With(context).AsBitmap().Apply(glideRequestOptions).Transition(new BitmapTransitionOptions().CrossFade(100));
         GlobalContext           = HomeActivity.GetInstance();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.EventsFragment, container, false);


            homeActivity = this.Activity as HomeActivity;

            EventsFromServer = new List <Event>();

            // Get our RecyclerView layout:
            mRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.EventsRecyclerView);

            // Use the built-in linear layout manager:
            mLayoutManager = new LinearLayoutManager(this.Activity);

            // Plug the layout manager into the RecyclerView:
            mRecyclerView.SetLayoutManager(mLayoutManager);


            FloatingActionButton button = view.FindViewById <FloatingActionButton>(Resource.Id.floatingActionButton1);

            button.Click += delegate {
                var addEventActivity = new Intent(this.Context, typeof(AddEventActivity));
                StartActivity(addEventActivity);
            };

            // Search EditText
            EditText editSearch = view.FindViewById <EditText>(Resource.Id.editTextSearchEvent);

            editSearch.EditorAction += (object sender, TextView.EditorActionEventArgs e) => {
                if (e.ActionId == ImeAction.Done)
                {
                    EditText et = sender as EditText;
                    SetAdapterWithFilterText(et.Text);
                }
                e.Handled = false;
            };

            // Get open events form server
            GetOpenEventsFromServer();

            // Get active sections
            GetActiveSectionsFromServer();

            return(view);
        }
        //Open profile
        private void TxtPublisherNameOnClick(object sender, EventArgs e)
        {
            try
            {
                InfoSongWindow.Hide();
                InfoSongWindow.Dismiss();

                if (DataObject.Publisher.Id != null)
                {
                    HomeActivity.GetInstance()?.OpenProfile(DataObject.Publisher.Id, DataObject.Publisher);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Beispiel #9
0
        public void AutoLinkTextViewOnAutoLinkOnClick(object sender, AutoLinkOnClickEventArgs autoLinkOnClickEventArgs)
        {
            try
            {
                AutoLinkMode matchedText = autoLinkOnClickEventArgs.P0;
                var          typeText    = Methods.FunString.Check_Regex(autoLinkOnClickEventArgs.P1);
                if (typeText == "Email" || matchedText == AutoLinkMode.ModeEmail)
                {
                    Methods.App.SendEmail(Application.Context, autoLinkOnClickEventArgs.P1);
                }
                else if (typeText == "Website" || matchedText == AutoLinkMode.ModeUrl)
                {
                    string url = autoLinkOnClickEventArgs.P1;
                    if (!autoLinkOnClickEventArgs.P1.Contains("http"))
                    {
                        url = "http://" + autoLinkOnClickEventArgs.P1;
                    }

                    var intent = new Intent(Application.Context, typeof(LocalWebViewActivity));
                    intent.PutExtra("URL", url);
                    intent.PutExtra("Type", url);
                    Activity.StartActivity(intent);
                }
                else if (typeText == "Hashtag" || matchedText == AutoLinkMode.ModeHashtag)
                {
                    Bundle bundle = new Bundle();
                    bundle.PutString("Key", autoLinkOnClickEventArgs.P1.Replace("#", ""));
                    SearchFragment searchFragment = new SearchFragment
                    {
                        Arguments = bundle
                    };
                    HomeActivity.GetInstance()?.FragmentBottomNavigator.DisplayFragment(searchFragment);
                }
                else if (typeText == "Mention" || matchedText == AutoLinkMode.ModeMention)
                {
                }
                else if (typeText == "Number" || matchedText == AutoLinkMode.ModePhone)
                {
                    //IMethods.IApp.SaveContacts(Activity, autoLinkOnClickEventArgs.P1, "", "2");
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Beispiel #10
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            try
            {
                GlobalContext = (HomeActivity)Activity;
                ContextSearch = (SearchFragment)ParentFragment;

                InitComponent(view);
                SetRecyclerViewAdapters();

                base.OnViewCreated(view, savedInstanceState);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #11
0
            public void OnDestroyActionMode(ActionMode mode)
            {
                try
                {
                    MAdapter.ClearSelections();
                    ActionMode = null;
                    SetSystemBarColor(Activity, AppSettings.MainColor);

                    HomeActivity.GetInstance()?.SetService();

                    ToolBar.Visibility = ViewStates.Visible;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
Beispiel #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                Window.SetSoftInputMode(SoftInput.AdjustResize);
                base.OnCreate(savedInstanceState);

                Window.SetBackgroundDrawableResource(AppSettings.SetTabDarkTheme ? Resource.Drawable.chatBackground3_Dark : Resource.Drawable.chatBackground);

                Methods.App.FullScreenApp(this);
                SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);

                // Set our view from the "MessagesBox_Layout" layout resource
                SetContentView(Resource.Layout.MessagesBoxLayout);

                Instance = this;

                var data = Intent.GetStringExtra("UserId") ?? "Data not available";
                if (data != "Data not available" && !string.IsNullOrEmpty(data))
                {
                    Userid = int.Parse(data);                                                              // to_id
                }
                string json = Intent.GetStringExtra("UserItem");
                var    item = JsonConvert.DeserializeObject <UserDataObject>(json);
                if (item != null)
                {
                    UserInfoData = item;
                }

                //Get Value And Set Toolbar
                InitComponent();
                InitToolbar();
                SetRecyclerViewAdapters();

                //Set Title ToolBar and data chat user After that get messages
                LoadData_ItemUser();

                RewardedVideoAd = AdsGoogle.Ad_RewardedVideo(this);

                GlobalContext = HomeActivity.GetInstance();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #13
0
        public static void MensagemDeLogout(Context contexto, HomeActivity home)
        {
            var alert = new AlertDialog.Builder(contexto);

            alert.SetTitle("Deseja realizar Logout");
            alert.SetPositiveButton("Ok", (senderAlert, args) =>
            {
                home.Logout();
            });

            alert.SetNegativeButton("Cancelar", (sender, args) =>
            {
            });

            Dialog dialog = alert.Create();

            dialog.Show();
        }
Beispiel #14
0
        //////////////////////////////////////////////////////

        #region MaterialDialog

        public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                string text = itemString.ToString();
                if (text == ActivityContext.GetString(Resource.String.Btn_Paypal))
                {
                    if (DialogButtonType == "membership")
                    {
                        HomeActivity.GetInstance()?.InitPayPalPayment?.BtnPaypalOnClick(ItemPremium.Price, "membership", ItemPremium.Type, ItemPremium.Id.ToString());
                    }
                    else if (DialogButtonType == CreditType)
                    {
                        HomeActivity.GetInstance()?.InitPayPalPayment?.BtnPaypalOnClick(ItemCredits.Price, CreditType, ItemCredits.TotalCoins, "");
                    }
                }
                else if (text == ActivityContext.GetString(Resource.String.Btn_GooglePlay))
                {
                    if (DialogButtonType == "membership")
                    {
                        HomeActivity.GetInstance()?.BillingPayment.SetConnInAppBilling();
                        HomeActivity.GetInstance()?.BillingPayment?.InitInAppBilling(ItemPremium.Price, "membership", ItemPremium.Type, ItemPremium.Id.ToString());
                    }
                    else if (DialogButtonType == CreditType)
                    {
                        HomeActivity.GetInstance()?.BillingPayment.SetConnInAppBilling();
                        HomeActivity.GetInstance()?.BillingPayment?.InitInAppBilling(ItemCredits.Price, CreditType, ItemCredits.TotalCoins, "");
                    }
                }
                else if (text == ActivityContext.GetString(Resource.String.Lbl_CreditCard))
                {
                    OpenIntentCreditCard();
                }
                else if (text == ActivityContext.GetString(Resource.String.Lbl_BankTransfer))
                {
                    OpenIntentBankTransfer();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                Window.SetSoftInputMode(SoftInput.AdjustResize);

                SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);

                // Create your application here
                SetContentView(Resource.Layout.AddStoryLayout);
                //Get Value And Set Toolbar
                InitComponent();
                InitToolbar();

                GlobalContext = HomeActivity.GetInstance();

                var dataUri = Intent.GetStringExtra("Uri") ?? "Data not available";
                if (dataUri != "Data not available" && !string.IsNullOrEmpty(dataUri))
                {
                    PathStory = dataUri;                                                                    // Uri file
                }
                var dataType = Intent.GetStringExtra("Type") ?? "Data not available";
                if (dataType != "Data not available" && !string.IsNullOrEmpty(dataType))
                {
                    Type = dataType;                                                                      // Type file
                }
                if (Type == "image")
                {
                    SetImageStory(PathStory);
                }
                else
                {
                    SetVideoStory(PathStory);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public async void OnSuccess(Token token)
        {
            try
            {
                // Send token to your own web service
                var stripeBankAccount = token.BankAccount;
                var stripeCard        = token.Card;
                var stripeCreated     = token.Created;
                var stripeId          = token.Id;
                var stripeLiveMode    = token.Livemode;
                var stripeType        = token.Type;
                var stripeUsed        = token.Used;

                (int apiStatus, var respond) = await RequestsAsync.Auth.PayStripeAsync(stripeId, PayType, "Pay the card " + Price, Price).ConfigureAwait(false);

                if (apiStatus == 200)
                {
                    if (respond is AmountObject result)
                    {
                        RunOnUiThread(() =>
                        {
                            if (HomeActivity.GetInstance().ProfileFragment.WalletNumber != null)
                            {
                                HomeActivity.GetInstance().ProfileFragment.WalletNumber.Text = result.CreditAmount.ToString();
                            }

                            Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Long).Show();
                        });
                    }
                }
                else
                {
                    Methods.DisplayReportResult(this, respond);
                }

                //ShowFragmentStripe();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #17
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            try
            {
                View view = inflater.Inflate(Resource.Layout.SearchSongsLayout, container, false);

                GlobalContext = (HomeActivity)Activity;
                ContextSearch = (SearchFragment)ParentFragment;

                InitComponent(view);
                SetRecyclerViewAdapters();

                return(view);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
Beispiel #18
0
        public static void OpenProfile(Activity activity, string userId, UserDataObject item)
        {
            try
            {
                if (userId != UserDetails.UserId)
                {
                    Bundle bundle = new Bundle();
                    bundle.PutString("userinfo", JsonConvert.SerializeObject(item));
                    bundle.PutString("type", "UserData");
                    bundle.PutString("userid", userId);
                    bundle.PutString("avatar", item.Avatar);
                    bundle.PutString("fullname", item.Username);
                    if (AppSettings.ProfileTheme == ProfileTheme.DefaultTheme)
                    {
                        UserProfileFragment profileFragment = new UserProfileFragment
                        {
                            Arguments = bundle
                        };

                        HomeActivity.GetInstance()?.OpenFragment(profileFragment);
                    }
                    else if (AppSettings.ProfileTheme == ProfileTheme.TikTheme)
                    {
                        TikUserProfileFragment profileFragment = new TikUserProfileFragment
                        {
                            Arguments = bundle
                        };
                        HomeActivity.GetInstance()?.OpenFragment(profileFragment);
                    }
                }
                else
                {
                    HomeActivity.GetInstance()?.NavigationTabBar.SetModelIndex(4, true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            try
            {
                Context        contextThemeWrapper = AppSettings.SetTabDarkTheme ? new ContextThemeWrapper(Activity, Resource.Style.MyTheme_Dark_Base) : new ContextThemeWrapper(Activity, Resource.Style.MyTheme_Base);
                LayoutInflater localInflater       = inflater.CloneInContext(contextThemeWrapper);
                View           view = localInflater.Inflate(Resource.Layout.MainFragmentLayout, container, false);

                ContextProfile = (TikProfileFragment)ParentFragment;
                GlobalContext  = (HomeActivity)Activity;

                InitComponent(view);
                SetRecyclerViewAdapters();

                return(view);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            try
            {
                // Use this to return your custom view for this Fragment
                View view = inflater.Inflate(Resource.Layout.SearchUsersLayout, container, false);

                //Get Value
                InitComponent(view);
                SetRecyclerViewAdapters();

                GlobalContext = (HomeActivity)Activity ?? HomeActivity.GetInstance();
                ContextSearch = (SearchFragment)ParentFragment;

                return(view);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
Beispiel #21
0
            public bool OnActionItemClicked(ActionMode mode, IMenuItem item)
            {
                int id = item.ItemId;

                if (id == Resource.Id.action_delete)
                {
                    DeleteItems();
                    mode.Finish();
                    return(true);
                }
                if (id == Android.Resource.Id.Home)
                {
                    HomeActivity.GetInstance()?.SetService();

                    MAdapter.ClearSelections();

                    ToolBar.Visibility = ViewStates.Visible;
                    ActionMode.Finish();

                    return(true);
                }
                return(false);
            }
Beispiel #22
0
 public void OnSensorChanged(SensorEvent e)
 {
     try
     {
         if (e.Sensor.Type == SensorType.Proximity)
         {
             if (e.Values[0] >= -SENSOR_SENSITIVITY && e.Values[0] <= SENSOR_SENSITIVITY)
             {
                 //near
                 HomeActivity.GetInstance()?.SetOffWakeLock();
             }
             else
             {
                 //far
                 HomeActivity.GetInstance()?.SetOnWakeLock();
             }
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
Beispiel #23
0
        private void LayoutFollowersOnClick(object sender, EventArgs e)
        {
            try
            {
                Bundle bundle = new Bundle();
                bundle.PutString("UserId", DataUser.Id.ToString());
                bundle.PutString("UserType", "Followers");

                ContactsFragment contactsFragment = new ContactsFragment
                {
                    Arguments = bundle
                };


                HomeActivity.GetInstance().FragmentBottomNavigator.DisplayFragmentOnSamePage(contactsFragment);

                Finish();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Beispiel #24
0
            //Delete Chat
            private void DeleteItems()
            {
                try
                {
                    HomeActivity.GetInstance()?.SetService();

                    if (ToolBar.Visibility != ViewStates.Visible)
                    {
                        ToolBar.Visibility = ViewStates.Visible;
                    }

                    if (Methods.CheckConnectivity())
                    {
                        List <int> selectedItemPositions = MAdapter.GetSelectedItems();
                        for (int i = selectedItemPositions.Count - 1; i >= 0; i--)
                        {
                            var datItem = MAdapter.GetItem(selectedItemPositions[i]);
                            if (datItem != null)
                            {
                                MAdapter.RemoveData(selectedItemPositions[i], datItem);
                                //Send Api Delete
                                RequestsAsync.Messages.DeleteChat(datItem.UserId.ToString()).ConfigureAwait(false);
                            }
                        }

                        MAdapter.NotifyDataSetChanged();
                    }
                    else
                    {
                        Toast.MakeText(Activity, Activity.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                View mContentView = Window.DecorView;
                var  uiOptions    = (int)mContentView.SystemUiVisibility;
                var  newUiOptions = uiOptions;

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

                Window.AddFlags(WindowManagerFlags.Fullscreen);

                SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);

                // Create your application here
                SetContentView(Resource.Layout.ViewStoryLayout);

                UserId = Intent.GetStringExtra("UserId");

                GlobalContext = HomeActivity.GetInstance();

                //Get Value And Set Toolbar
                InitComponent();
                InitVideoView();
                InitToolbar();

                LoadData();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #26
0
 public static void OpenProfile(Activity activity, string eventPage, UserInfoObject item, ImageView image)
 {
     try
     {
         if (item.Id != UserDetails.UserId)
         {
             var intent = new Intent(activity, typeof(UserProfileActivity));
             intent.PutExtra("EventPage", eventPage); // Close , Move , likeAndClose , HideButton
             intent.PutExtra("ItemUser", JsonConvert.SerializeObject(item));
             if (AppSettings.EnableAddAnimationImageUser)
             {
                 if (image != null)
                 {
                     ActivityOptionsCompat options = ActivityOptionsCompat.MakeSceneTransitionAnimation((Activity)activity, image, "profileimage");
                     activity.StartActivity(intent, options.ToBundle());
                 }
                 else
                 {
                     activity.StartActivity(intent);
                 }
             }
             else
             {
                 activity.StartActivity(intent);
             }
         }
         else
         {
             HomeActivity.GetInstance()?.NavigationTabBar.SetModelIndex(4, true);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Beispiel #27
0
        public override void OnCreate()
        {
            try
            {
                base.OnCreate();
                Service = this;

                GlobalContext        = HomeActivity.GetInstance();
                MNotificationManager = (NotificationManager)GetSystemService(NotificationService);

                OnCallIncome      = new CallBroadcastReceiver();
                OnHeadPhoneDetect = new HeadPhoneBroadcastReceiver();

                RegisterReceiver(OnCallIncome, new IntentFilter("android.intent.action.PHONE_STATE"));
                RegisterReceiver(OnHeadPhoneDetect, new IntentFilter(AudioManager.ActionAudioBecomingNoisy));

                SetAudioFocus();
                InitializePlayer();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                Methods.App.FullScreenApp(this);
                SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);

                // Create your application here
                SetContentView(Resource.Layout.PopularityLayout);

                //Get Value And Set Toolbar
                InitComponent();
                InitToolbar();
                GetDataOption();

                GlobalContext = HomeActivity.GetInstance();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        //Click Save data Playlist
        private async void BtnSaveOnClick(object sender, EventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                }
                else
                {
                    if (string.IsNullOrEmpty(TitleEditText.Text))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_PleaseEnterTitleSong), ToastLength.Short).Show();
                        return;
                    }

                    if (string.IsNullOrEmpty(DescriptionEditText.Text))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_PleaseEnterDescriptionSong), ToastLength.Short).Show();
                        return;
                    }

                    if (string.IsNullOrEmpty(GenresEditText.Text))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_PleaseChooseGenres), ToastLength.Short).Show();
                        return;
                    }

                    if (string.IsNullOrEmpty(PriceEditText.Text))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_PleaseChoosePrice), ToastLength.Short).Show();
                        return;
                    }

                    if (string.IsNullOrEmpty(PathImage))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_PleaseSelectImage), ToastLength.Short).Show();
                        return;
                    }

                    //Show a progress
                    AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading));                                                                                         //wael
                    (int apiStatus, var respond) = await RequestsAsync.Albums.SubmitAlbumAsync(TitleEditText.Text, DescriptionEditText.Text, PathImage, IdGenres, IdPrice); //Sent api

                    if (apiStatus.Equals(200))
                    {
                        if (respond is SubmitTrackObject result)
                        {
                            Console.WriteLine(result.Link);
                            Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Short).Show();
                            AndHUD.Shared.Dismiss(this);

                            // wael
                            var dataProfileFragment = HomeActivity.GetInstance()?.ProfileFragment.LatestSongsAdapter;
                            //dataProfileFragment?.SoundsList.Insert(0, result.Data);
                            dataProfileFragment?.NotifyItemInserted(dataProfileFragment.SoundsList.IndexOf(dataProfileFragment.SoundsList.FirstOrDefault()));

                            Finish();
                        }
                    }
                    else
                    {
                        if (respond is ErrorObject error)
                        {
                            var errorText = error.Error.Replace("&#039;", "'");
                            AndHUD.Shared.ShowError(this, errorText, MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                        else if (respond is MessageObject errorRespond)
                        {
                            AndHUD.Shared.ShowError(this, errorRespond.Message, MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                        Methods.DisplayReportResult(this, respond);
                    }

                    AndHUD.Shared.Dismiss(this);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                AndHUD.Shared.Dismiss(this);
            }
        }
Beispiel #30
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     // Create your fragment here
     GlobalContext = (HomeActivity)Activity;
 }