public void StartDownloadManager(string title, GetMoviesObject.Movie video)
        {
            try
            {
                if (video != null && !string.IsNullOrEmpty(title))
                {
                    Video = video;
                    SqLiteDatabase dbDatabase = new SqLiteDatabase();
                    dbDatabase.Insert_WatchOfflineVideos(Video);
                    dbDatabase.Dispose();

                    Request.SetTitle(title);
                    Request.SetAllowedNetworkTypes(DownloadNetwork.Mobile | DownloadNetwork.Wifi);
                    Request.SetDestinationInExternalPublicDir(FilePath, Filename);
                    Request.SetNotificationVisibility(DownloadVisibility.Visible);
                    Request.SetAllowedOverRoaming(true);
                    //Request.SetVisibleInDownloadsUi(true);
                    DownloadId = Downloadmanager.Enqueue(Request);

                    DownloadComplete onDownloadComplete = new DownloadComplete();
                    Application.Context.ApplicationContext.RegisterReceiver(onDownloadComplete, new IntentFilter(DownloadManager.ActionDownloadComplete));
                }
                else
                {
                    Toast.MakeText(ContextActivty, Application.Context.GetText(Resource.String.Lbl_Download_faileds), ToastLength.Short).Show();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        //Event Menu >> Share
        public async void OnMenu_ShareIcon_Click(GetMoviesObject.Movie video)
        {
            try
            {
                switch (CrossShare.IsSupported)
                {
                //Share Plugin same as flame
                case false:
                    return;

                default:
                    await CrossShare.Current.Share(new ShareMessage
                    {
                        Title = video.Name,
                        Text  = video.Description,
                        Url   = video.Url
                    });

                    break;
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        //Event Menu >> Share
        private async void OnShare_Button_Click(GetMoviesObject.Movie movie)
        {
            try
            {
                switch (CrossShare.IsSupported)
                {
                //Share Plugin same as video
                case false:
                    return;

                default:
                    await CrossShare.Current.Share(new ShareMessage
                    {
                        Title = movie.Name,
                        Text  = movie.Description,
                        Url   = movie.Url
                    });

                    break;
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        private void Initialize(MoviesAdapterViewHolder holder, GetMoviesObject.Movie movie)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, movie.Cover, holder.VideoImage, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                string name = Methods.FunString.DecodeString(movie.Name);
                holder.TxtTitle.Text       = name;
                holder.TxtDescription.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(movie.Description), 50);

                var millis  = Convert.ToInt32(movie.Duration);
                int hours   = millis / 60; //since both are ints, you get an int
                int minutes = millis % 60;
                holder.TxtDuration.Text = hours + ":" + minutes;

                holder.TxtViewsCount.Text = movie.Views + " " + ActivityContext.GetText(Resource.String.Lbl_Views);

                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.MenueView, IonIconsFonts.More);

                //Video Type
                ShowGlobalBadgeSystem(holder.VideoType, movie);

                switch (holder.MenueView.HasOnClickListeners)
                {
                case false:
                    holder.MenueView.Click += (sender, args) =>
                    {
                        try
                        {
                            MovieDataMenue = movie;

                            var arrayAdapter = new List <string>();
                            var dialogList   = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);

                            arrayAdapter.Add(ActivityContext.GetString(Resource.String.Lbl_CopeLink));
                            arrayAdapter.Add(ActivityContext.GetString(Resource.String.Lbl_Share));

                            dialogList.Title(ActivityContext.GetString(Resource.String.Lbl_More)).TitleColorRes(Resource.Color.primary);
                            dialogList.Items(arrayAdapter);
                            dialogList.NegativeText(ActivityContext.GetText(Resource.String.Lbl_Close)).OnNegative(this);
                            dialogList.AlwaysCallSingleChoiceCallback();
                            dialogList.ItemsCallback(this).Build().Show();
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    };
                    break;
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Ejemplo n.º 5
0
 //Event Menu >> Cope Link
 private void OnMenu_CopeLink_Click(GetMoviesObject.Movie video)
 {
     try
     {
         Methods.CopyToClipboard(ActivityContext, video.Url);
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
Ejemplo n.º 6
0
 //Event Menu >> Cope Link
 private void OnCopeLink_Button_Click(GetMoviesObject.Movie movie)
 {
     try
     {
         Methods.CopyToClipboard(ActivityContext, movie.Url);
     }
     catch (Exception e)
     {
         Methods.DisplayReportResultTrack(e);
     }
 }
        public async void GetDataVideo()
        {
            try
            {
                if (!string.IsNullOrEmpty(Intent?.GetStringExtra("Viewer_Video")))
                {
                    Video = JsonConvert.DeserializeObject <GetMoviesObject.Movie>(Intent?.GetStringExtra("Viewer_Video"));
                    LoadDataVideo();
                }
                else
                {
                    if (!Methods.CheckConnectivity())
                    {
                        Toast.MakeText(Application.Context, Application.Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                        return;
                    }

                    var(apiStatus, respond) = await RequestsAsync.Movies.GetMoviesAsync("", "", MoviesId);

                    switch (apiStatus)
                    {
                    case 200:
                    {
                        switch (respond)
                        {
                        case GetMoviesObject result:
                        {
                            var respondList = result.Movies.Count;
                            switch (respondList)
                            {
                            case > 0:
                                Video = result.Movies.FirstOrDefault(w => w.Id == MoviesId);
                                LoadDataVideo();
                                break;
                            }

                            break;
                        }
                        }

                        break;
                    }

                    default:
                        Methods.DisplayReportResult(this, respond);
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Ejemplo n.º 8
0
        //Event Menu >> Cope Link
        private void OnMenu_CopeLink_Click(GetMoviesObject.Movie video)
        {
            try
            {
                var clipboardManager = (ClipboardManager)ActivityContext.GetSystemService(Context.ClipboardService);

                ClipData clipData = ClipData.NewPlainText("text", video.Url);
                clipboardManager.PrimaryClip = clipData;

                Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_Copied), ToastLength.Short).Show();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        public async void GetDataVideo()
        {
            try
            {
                if (!string.IsNullOrEmpty(Intent.GetStringExtra("Viewer_Video")))
                {
                    Video = JsonConvert.DeserializeObject <GetMoviesObject.Movie>(Intent.GetStringExtra("Viewer_Video"));
                    LoadDataVideo();
                }
                else
                {
                    if (!Methods.CheckConnectivity())
                    {
                        Toast.MakeText(Application.Context, Application.Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                        return;
                    }

                    (int apiStatus, var respond) = await RequestsAsync.Movies.Get_Movies("", "", MoviesId);

                    if (apiStatus == 200)
                    {
                        if (respond is GetMoviesObject result)
                        {
                            var respondList = result.Movies.Count;
                            if (respondList > 0)
                            {
                                Video = result.Movies.FirstOrDefault(w => w.Id == MoviesId);
                                LoadDataVideo();
                            }
                        }
                    }
                    else
                    {
                        Methods.DisplayReportResult(this, respond);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        //Event Menu >> Share
        private async void OnShare_Button_Click(GetMoviesObject.Movie movie)
        {
            try
            {
                //Share Plugin same as video
                if (!CrossShare.IsSupported)
                {
                    return;
                }

                await CrossShare.Current.Share(new ShareMessage
                {
                    Title = movie.Name,
                    Text  = movie.Description,
                    Url   = movie.Url
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 private void ShowGlobalBadgeSystem(TextView videoTypeIcon, GetMoviesObject.Movie item)
 {
     try
     {
         if (!string.IsNullOrEmpty(item.Iframe) && item.Iframe.Contains("Youtube") || item.Iframe.Contains("youtu"))
         {
             FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, videoTypeIcon, IonIconsFonts.SocialYoutube);
             videoTypeIcon.Visibility         = ViewStates.Visible;
             videoTypeIcon.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor("#FF0000"));
         }
         else
         {
             videoTypeIcon.Text               = Methods.FunString.GetoLettersfromString(AppSettings.ApplicationName);
             videoTypeIcon.Visibility         = ViewStates.Visible;
             videoTypeIcon.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor(AppSettings.MainColor));
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Ejemplo n.º 12
0
        //Event Menu >> Share
        public async void OnMenu_ShareIcon_Click(GetMoviesObject.Movie video)
        {
            try
            {
                //Share Plugin same as flame
                if (!CrossShare.IsSupported)
                {
                    return;
                }

                await CrossShare.Current.Share(new ShareMessage
                {
                    Title = video.Name,
                    Text  = video.Description,
                    Url   = video.Url
                });
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        public void LoadVideo_Data(GetMoviesObject.Movie videoObject)
        {
            try
            {
                if (videoObject != null)
                {
                    VideoTittle.Text = Methods.FunString.DecodeString(videoObject.Name);

                    VideoQualityTextView.Text = videoObject.Quality.ToUpperInvariant();
                    VideoViewsNumber.Text     = videoObject.Views + " " + Activity.GetText(Resource.String.Lbl_Views);
                    VideoVideoDate.Text       = Activity.GetText(Resource.String.Lbl_Published_on) + " " + videoObject.Release;

                    VideoVideoCategory.Text = videoObject.Genre;
                    VideoStars.Text         = videoObject.Stars;
                    VideoTag.Text           = videoObject.Producer;

                    TextSanitizerAutoLink.Load(Methods.FunString.DecodeString(videoObject.Description));
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Ejemplo n.º 14
0
        public void PlayVideo(string videoUrL, GetMoviesObject.Movie videoObject)
        {
            try
            {
                if (videoObject != null)
                {
                    VideoData = videoObject;

                    VideoViewerActivity.GetInstance()?.TabVideosAbout?.LoadVideo_Data(videoObject);

                    TabbedMainActivity.GetInstance()?.SetOnWakeLock();

                    ReleaseVideo();

                    MFullScreenIcon.SetImageDrawable(ActivityContext.GetDrawable(Resource.Drawable.ic_action_ic_fullscreen_expand));

                    Uri videoUrl = Uri.Parse(!string.IsNullOrEmpty(videoUrL) ? videoUrL : VideoData.Source);

                    AdaptiveTrackSelection.Factory trackSelectionFactory = new AdaptiveTrackSelection.Factory();
                    var trackSelector = new DefaultTrackSelector(DefaultTrackSelector.Parameters.GetDefaults(ActivityContext), trackSelectionFactory);
                    trackSelector.SetParameters(new DefaultTrackSelector.ParametersBuilder(ActivityContext));

                    Player = new SimpleExoPlayer.Builder(ActivityContext).Build();

                    // Produces DataSource instances through which media data is loaded.
                    var defaultSource = GetMediaSourceFromUrl(videoUrl, videoUrl?.Path?.Split('.').Last(), "normal", IDrmSessionManager.DummyDrmSessionManager);

                    VideoSource = null !;

                    //Set Interactive Media Ads
                    if (PlayerSettings.ShowInteractiveMediaAds)
                    {
                        VideoSource = CreateMediaSourceWithAds(defaultSource, PlayerSettings.ImAdsUri);
                    }

                    if (SimpleExoPlayerView == null)
                    {
                        Initialize();
                    }

                    //Set Cache Media Load
                    if (PlayerSettings.EnableOfflineMode)
                    {
                        VideoSource = VideoSource == null?CreateCacheMediaSource(defaultSource, videoUrl) : CreateCacheMediaSource(VideoSource, videoUrl);

                        if (VideoSource != null)
                        {
                            SimpleExoPlayerView.Player = Player;
                            Player.Prepare(VideoSource);
                            //Player.AddListener(PlayerListener);
                            Player.PlayWhenReady = true;

                            bool haveResumePosition = ResumeWindow != C.IndexUnset;
                            if (haveResumePosition)
                            {
                                Player.SeekTo(ResumeWindow, ResumePosition);
                            }

                            return;
                        }
                    }

                    if (VideoSource == null)
                    {
                        if (!string.IsNullOrEmpty(videoUrL))
                        {
                            if (videoUrL.Contains("youtube") || videoUrL.Contains("Youtube") || videoUrL.Contains("youtu"))
                            {
                                //Task.Factory.StartNew(async () =>
                                //{
                                //    var newurl = await VideoInfoRetriever.GetEmbededVideo(VideoData.source);
                                //    videoSource = CreateDefaultMediaSource(Android.Net.Uri.Parse(newurl));
                                //});
                            }
                            else
                            {
                                VideoSource = GetMediaSourceFromUrl(Uri.Parse(videoUrL), videoUrL?.Split('.').Last(), "normal", IDrmSessionManager.DummyDrmSessionManager);

                                SimpleExoPlayerView.Player = Player;
                                Player.Prepare(VideoSource);
                                //Player.AddListener(PlayerListener);
                                Player.PlayWhenReady = true;

                                bool haveResumePosition = ResumeWindow != C.IndexUnset;
                                if (haveResumePosition)
                                {
                                    Player.SeekTo(ResumeWindow, ResumePosition);
                                }
                            }
                        }
                    }
                    else
                    {
                        SimpleExoPlayerView.Player = Player;
                        Player.Prepare(VideoSource);
                        //Player.AddListener(PlayerListener);
                        Player.PlayWhenReady = true;

                        bool haveResumePosition = ResumeWindow != C.IndexUnset;
                        if (haveResumePosition)
                        {
                            Player.SeekTo(ResumeWindow, ResumePosition);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }