Ejemplo n.º 1
0
        public void ShowActionSheet()
        {
            #region ActinSheet Items
            List<ActionSheetArgs> items = new List<ActionSheetArgs>();

            var alipayItem = new ActionSheetArgs("支付宝");
            alipayItem.OnClick += () =>
            {
                if (!AlipayHelper.CheckConfig())
                {
                    Toast.MakeText(ApplicationContext,
                        "系统异常.",
                        ToastLength.Long);
                    Log.Error(Tag, "Aplipay Config Exception ");
                    return;
                }
                string payInfo = AlipayHelper.GetPayInfo();
                // 完整的符合支付宝参数规范的订单信息
                Runnable payRunnable = new Runnable(() =>
                {
                    PayTask alipay = new PayTask(this);
                    // 调用支付接口,获取支付结果
                    string result = alipay.Pay(payInfo);

                    Message msg = new Message
                    {
                        What = (int)MsgWhat.AlipayPayFlag,
                        Obj = result
                    };
                    _handler.SendMessage(msg);
                });

                // 必须异步调用
                Thread payThread = new Thread(payRunnable);
                payThread.Start();
            };
            items.Add(alipayItem);
            var weixinItem = new ActionSheetArgs("微信");
            weixinItem.OnClick += () =>
            {
                Runnable wxpayRunnable = new Runnable(() =>
                {
                    _weixinpayHelper = new WeixinpayHelper(this);
                    _weixinpayHelper.Execute();
                });

                // 必须异步调用
                Thread payThread = new Thread(wxpayRunnable);
                payThread.Start();

            };
            items.Add(weixinItem);

            #endregion
            var menuView = new ActionSheet(this);
            menuView.SetCancelButtonTitle("取消");// before add items
            menuView.Items = items;
            menuView.CancelableOnTouchOutside = true;
            menuView.ShowMenu();
        }
Ejemplo n.º 2
0
        public void DownloadSubtitle(bool autoPlay = false, int pos = 0)
        {
            DownloadTempSubtitles(activeSubtitles[currentActiveSubtitle]);

            _tempThred = new Java.Lang.Thread(() =>
            {
                try {
                    bool _done = false;

                    for (int i = 0; i < 1000; i++)
                    {
                        if (!_done)
                        {
                            Java.Lang.Thread.Sleep(10);
                            if (SubtitleDoneDownloading())
                            {
                                _done = true;
                                if (autoPlay)
                                {
                                    DoLink(0, pos, useSub: true);
                                }
                            }
                        }
                    }
                }
                finally {
                    _tempThred.Join();
                    //invoke(onCompleted);
                }
            });
            _tempThred.Start();
        }
        private void Fun_GetGoldPrice()
        {
            string resultStringDr1 = null;

            Java.Lang.Thread th = new Java.Lang.Thread();
            th = new Java.Lang.Thread(() =>
            {
                try
                {
                    resultStringDr1 = WCFDataRequest.Instance.SvrRequest(
                        "P_GoldPriceInfo",
                        new string[] { },
                        new string[] { });
                }
                catch
                {
                    return;
                }
                if (resultStringDr1 != "鏈接錯誤" && resultStringDr1 != "鏈接超時")
                {
                    RunOnUiThread(() =>
                    {
                        loading(resultStringDr1);
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        MessageBox.Show(this, resultStringDr1, "請檢查網絡或者聯系服務商");
                    });
                }
            });
            th.Start();
        }
Ejemplo n.º 4
0
        public override StartCommandResult OnStartCommand(Android.Content.Intent intent, StartCommandFlags flags, int startId)
        {
            var t = new Java.Lang.Thread(() =>
            {
                _cts = new CancellationTokenSource();

                Task.Run(() =>
                {
                    try
                    {
                        var counter = new ScreenReceiver();
                        //counter.ExecutePost(_cts.Token).Wait();
                    }
                    catch (Android.Accounts.OperationCanceledException)
                    {
                    }
                    finally
                    {
                        if (_cts.IsCancellationRequested)
                        {
                        }
                    }
                }, _cts.Token);
            }
                                         );

            t.Start();
            return(StartCommandResult.RedeliverIntent);
        }
 public override void start()
 {
     if (t == null)
     {
         t = new Java.Lang.Thread(this);
         t.Start();
     }
 }
Ejemplo n.º 6
0
        public void Run()
        {
            // Show process dialog
            _progressDialog.Show();

            // Start Thread to Run task
            _thread = new Thread(_task.Run);
            _thread.Start();
        }
Ejemplo n.º 7
0
        /** Puts the buffer back into the FIFO without sending the packet. */
        public void commitBuffer()
        {
            if (mThread == null)
            {
                mThread = new Java.Lang.Thread(this);
                mThread.Start();
            }

            if (++mBufferIn >= mBufferCount)
            {
                mBufferIn = 0;
            }
            mBufferCommitted.Release();
        }
Ejemplo n.º 8
0
 /** Entry point. */
 public static void runTest(ExtractMpegFrames obj)
 {
     try
     {
         var wrapper         = new ExtractMpegFramesWrapper(obj);
         Java.Lang.Thread th = new Java.Lang.Thread(wrapper, "codec test");
         th.Start();
         th.Join();
         if (wrapper.mThrowable != null)
         {
             throw wrapper.mThrowable;
         }
     }
     catch (System.Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
Ejemplo n.º 9
0
        /** Sends the RTP packet over the network. */
        public void commitBuffer(int length)
        {
            updateSequence();
            mPackets[mBufferIn].Length = length;

            mAverageBitrate.push(length);

            if (++mBufferIn >= mBufferCount)
            {
                mBufferIn = 0;
            }
            mBufferCommitted.Release();

            if (mThread == null)
            {
                mThread = new Java.Lang.Thread(this);
                mThread.Start();
            }
        }
Ejemplo n.º 10
0
        private void Fun_GetGoldPrice()
        {
            string resultStringDr1 = null;

            Java.Lang.Thread th = new Java.Lang.Thread();
            th = new Java.Lang.Thread(() =>
            {
                try
                {
                    resultStringDr1 = WCFDataRequest.Instance.SvrRequest(
                        "P_GoldPriceInfo",
                        new string[] { },
                        new string[] { });
                }
                catch
                {
                    return;
                }
                if (resultStringDr1 != "鏈接錯誤" && resultStringDr1 != "鏈接超時")
                {
                    RunOnUiThread(() =>
                    {
                        Intent layOut = new Intent();
                        //layOut.SetClass(this, typeof(MainActivity));
                        layOut.SetClass(this, typeof(OtherMainActivity));
                        Bundle homeData = new Bundle();
                        homeData.PutString("resultStringDr1", resultStringDr1);
                        layOut.PutExtras(homeData);
                        StartActivity(layOut);
                        this.Finish();
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        MessageBox.Show(this, resultStringDr1, "請檢查網絡或者聯系服務商");
                    });
                }
            });
            th.Start();
        }
Ejemplo n.º 11
0
        public void Start()
        {
            object lck = new object();

            lock (lck)
            {
                thread = CreateThread(Name);
                try
                {
                    socket           = CreateSocket();
                    socket.SoTimeout = SOCKET_TIMEOUT;
                }
                catch (SocketException e)
                {
                    throw new RtpMidiSessionServerRuntimeException("DatagramSocket cannot be opened", e);
                }
                thread.Start();
                Log.Debug("RtpMidi", "MIDI session server started");
            }
        }
Ejemplo n.º 12
0
        private void TecentPayPay(object sender, EventArgs args)
        {
            _msgApi.RegisterApp(Constants.AppId);


            var checkRunnable = new Runnable(() =>
            {


                string url = string.Format("https://api.mch.weixin.qq.com/pay/unifiedorder");
                string entity = GenProductArgs();
                var buf = Util.httpPost(url, entity);

                string content = System.Text.Encoding.Default.GetString(buf);
                _resultunifiedorder = DecodeXml(content);
                var msg = new Message
                {
                    What = (int)MsgWhat.TencentValidateFlag,
                    Obj = content
                };
                _handler.SendMessage(msg);
            });

            Java.Lang.Thread checkThread = new Java.Lang.Thread(checkRunnable);
            checkThread.Start();

        }
Ejemplo n.º 13
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.ax_Search, container, false);

            // _w.RecyclerView rez = view as _w.RecyclerView;

            __view    = view;
            ___view   = view;
            ax_search = this;

            var bar = __view.FindViewById <ProgressBar>(Resource.Id.progressBar1);

            //bar.Visibility = ViewStates.Gone;
            pbar = bar;

            // _w.RecyclerView rez = view as _w.RecyclerView; //inflater.Inflate(Resource.Layout.ax_Search, container, false) as _w.RecyclerView;
            SearchView search = view.FindViewById <SearchView>(Resource.Id.movie_seach);

            _w.RecyclerView re = view.FindViewById <_w.RecyclerView>(Resource.Id.recyclerView_movies);
            _re = re;

            search.SetQueryHint(new Java.Lang.String("Movie Search"));
            //search.SetQuery(new Java.Lang.String("HELLO"), true);

            search.QueryTextSubmit += async(o, e) =>
            {
                search.ClearFocus();

                if (searchDone)
                {
                    searchDone             = false;
                    MainActivity.searchFor = e.Query;
                    // Intent intent = new Intent(search.Context, typeof(SearchResultsActivity));
                    //StartActivity(intent);
                    Action onCompleted = () =>
                    {
                        //print("daaaaaaaaaaaaaaaa")
                        // UpdateList();
                        ChangeBar(100);
                        searchDone = true;
                        //
                    };

                    sThred = new Java.Lang.Thread(
                        () =>
                    {
                        try {
                            Search(e.Query);
                            //Thread.Sleep(1000);
                        }
                        finally {
                            onCompleted();
                            sThred.Join();
                            //invoke(onCompleted);
                        }
                    });
                    sThred.Start();

                    ChangeBar(0);
                }
            };
            re.SetItemClickListener((rv, position, _view) =>
            {
                SelectMovie(rv, position, _view);
            });

            re.LongClickable = true;

            /*
             * re.LongClickable = true;
             * re.SetOnLongClickListener((rv, position, _view) =>
             * {
             *  //An item has been clicked
             *  HistoryPressTitle(movieTitles[wlink[position]]);
             *  movieSelectedID = wlink[position];
             *  Context context = _view.Context;
             *  Intent intent = new Intent(context, typeof(SearchResultsActivity));
             *  // intent.PutExtra(CheeseDetailActivity.EXTRA_NAME, values[position]);
             *
             *  context.StartActivity(intent);
             *
             * });
             */
            /*
             * var buttons = view.FindViewById<LinearLayout>(Resource.Id.s_Buttons);
             *
             * LinearLayout linearLayout = buttons; //new LinearLayout(this);
             * linearLayout.Orientation = (Android.Widget.Orientation.Vertical);
             *
             * for (int i = 0; i < 100; i++) {
             *  var button = new Button(this.Context);
             *  button.Text = "Button " + i;
             *  button.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
             *  button.Click += (o, e) =>
             *  {
             *      //selectedTitle = button.Text;
             *      //ClosePoster(ViewStates.Visible);
             *      Intent intent = new Intent(search.Context, typeof(SearchResultsActivity));
             *      StartActivity(intent);
             *  };
             *  linearLayout.AddView(button);
             *  btts.Add(button);
             * }*/


            // bar.Progress = MainActivity.bar_progress;

            //IRunnable
            // search.SetQuery("test", true);
            //  search.SetFocusable(ViewFocusability.Focusable);
            //search.SetIconifiedByDefault(false);
            search.OnActionViewExpanded();
            search.ClearFocus();
            searchView = view.FindViewById <SearchView>(Resource.Id.movie_seach);

            // imm.HideSoftInputFromInputMethod(search.WindowToken, HideSoftInputFlags.None);
            //search.RequestFocusFromTouch();


            return(view);
        }
Ejemplo n.º 14
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.ax_Links, container, false);
            // _w.RecyclerView rez = view as _w.RecyclerView;
            //  print(view.AccessibilityClassName);
            // System.Diagnostics.Debug.WriteLine("TTTTTTTTTTTTTTT" + view.);
            var         bar         = view.FindViewById <ProgressBar>(Resource.Id.progressBarLinks);
            ImageButton playListBtt = view.FindViewById <ImageButton>(Resource.Id.playList);

            playListBtt.Click += (o, e) =>
            {
                string path = MainActivity.GenerateM3UFileFromLoadedLinks("TempList", flinks: flink, reverse: movieIsAnime[movieSelectedID], placeInLinksFolder: false);
                if (path != "error")
                {
                    OpenPathAsVieo(path);
                }
            };
            if (currentMain && movieProvider[movieSelectedID] == 4)
            {
                playListBtt.Visibility = ViewStates.Gone;
            }

            bool m3uEnabled = true;// ax_Settings.SettingsGetChecked(10);

            // bar.layout

            if (showExtraListButtons)
            {
                Button copyM3U     = view.FindViewById <Button>(Resource.Id.copym3u);
                Button generateM3U = view.FindViewById <Button>(Resource.Id.generatem3u);

                copyM3U.Visibility     = ViewStates.Gone;
                generateM3U.Visibility = ViewStates.Gone;

                copyM3U.Visibility     = m3uEnabled ? ViewStates.Visible : ViewStates.Gone;
                generateM3U.Visibility = m3uEnabled ? ViewStates.Visible : ViewStates.Gone;
                copyM3U.Click         += (o, e) =>
                {
                    string           m3uCopy = MainActivity.GetM3UFileFromLoadedLinks();
                    ClipboardManager clip    = (ClipboardManager)Context.GetSystemService(Context.ClipboardService);
                    clip.PrimaryClip = ClipData.NewPlainText("m3u", m3uCopy);
                    ShowSnackBar("Copied m3u To Clipboard!", ax_links.View);
                };

                generateM3U.Click += (o, e) =>
                {
                    string        path   = MainActivity.GenerateM3UFileFromLoadedLinks();
                    Action <View> action = new Action <View>((View v) =>
                    {
                        OpenPathAsVieo(path);
                    });
                    ShowSnackBar("Download m3u to " + path, ax_links.View, "Play list", action);
                };
            }

            //bar.Visibility = ViewStates.Gone;
            pbar = bar;
            if (SearchResultsActivity.veiws == 0)
            {
                // pbar.Visibility = ViewStates.Gone;
                currentMain = true;
                ax_links    = this;
            }
            else
            {
                ax_links_sub = this;
            }
            if (SearchResultsActivity.veiws == 1)
            {
                ax_Links_all = new List <ax_Links>();
            }
            ax_Links_all.Add(this);
            currnView = SearchResultsActivity.veiws;
            SearchResultsActivity.veiws++;

            // _w.RecyclerView rez = view as _w.RecyclerView; //inflater.Inflate(Resource.Layout.ax_Search, container, false) as _w.RecyclerView;
            _w.RecyclerView re = view.FindViewById <_w.RecyclerView>(Resource.Id.recyclerView_links);
            _re    = re;
            __view = view;


            // ---------- ON LINK CLICKED ----------

            re.SetItemClickListener((rv, position, _view) =>
            {
                var check = view.FindViewById <CheckBox>(Resource.Id.checkBox1);

                string linkName = activeLinksNames[flink[position]];

                bool overideSettings = (movieProvider[movieSelectedID] == 4 && linkName.StartsWith("Episode") && currentMain);

                int rAct = 0;

                if (!check.Checked)
                {
                    //Toast t = new Toast(Context);
                    print("Loading: " + movieTitles[movieSelectedID] + " | " + activeLinksNames[flink[position]]);

                    rAct = 0;


                    if (!overideSettings)
                    {
                        rAct = ax_Settings.SettingsGetDef(0, true);
                        print("PRIMARY: " + rAct);
                    }

                    if (ax_Settings.SettingsGetChecked(4) && (rAct == 0 || rAct == 5))
                    {
                        //  DoLink(ax_Settings.SettingsGetDef(1), position);
                        DoLink(9, position);
                    }
                    ChangeBar(pbar.Progress);


                    //  bool downloadFile = false;
                    //  string link = activeLinks[flink[position]];
                    //  if (!downloadFile) {
                    // }
                    // else {
                    // HistoryPressTitle("D___" + movieTitles[movieSelectedID] + "|" + activeLinksNames[flink[position]]);
                    //      DoLink(2, position);

                    // }
                }
                else
                {
                    //  DoLink(1, position);

                    rAct = 1;

                    if (!overideSettings)
                    {
                        rAct = ax_Settings.SettingsGetDef(1, true);
                        print("SECONDARY: " + rAct);
                    }
                }

                DoLink(rAct, position);
            });

            // ---------- LOADED ALL LINKS ----------

            Action onCompleted = () =>
            {
                //print("daaaaaaaaaaaaaaaa")
                // UpdateList();
                // ChangeBar(100);
                if (movieSelectedID >= movieTitles.Count || movieSelectedID < 0)
                {
                }
                else
                {
                    ChangeBar(100);
                    if (ax_links_sub != null)
                    {
                        if (movieProvider[movieSelectedID] == 0)
                        {
                            ax_links_sub.ChangeBar(100);
                        }
                    }
                    print(movieProvider[movieSelectedID].ToString());
                    linksDone = true;
                }
                //
            };

            // ---------- LOAD LINKS ----------

            if (currentMain)    // not request twice
            {
                thredNumber++;
                sThred = new Java.Lang.Thread(
                    () =>
                {
                    try {
                        ChangeBar(0);

                        GetURLFromTitle(movieSelectedID);
                        //Thread.Sleep(1000);
                    }
                    finally {
                        onCompleted();
                        sThred.Join();
                        //invoke(onCompleted);
                    }
                });
                sThred.Start();
            }

            UpdateList();


            /*
             * var buttons = view.FindViewById<LinearLayout>(Resource.Id.s_Buttons);
             *
             * LinearLayout linearLayout = buttons; //new LinearLayout(this);
             * linearLayout.Orientation = (Android.Widget.Orientation.Vertical);
             *
             * for (int i = 0; i < 100; i++) {
             *  var button = new Button(this.Context);
             *  button.Text = "Button " + i;
             *  button.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
             *  button.Click += (o, e) =>
             *  {
             *      //selectedTitle = button.Text;
             *      //ClosePoster(ViewStates.Visible);
             *      Intent intent = new Intent(search.Context, typeof(SearchResultsActivity));
             *      StartActivity(intent);
             *  };
             *  linearLayout.AddView(button);
             *  btts.Add(button);
             * }*/


            // bar.Progress = MainActivity.bar_progress;

            //IRunnable
            //Activity.OnBackPressed();
            return(view);
        }
Ejemplo n.º 15
0
 private void Start()
 {
     t = new Java.Lang.Thread();
     t.Start();
 }
Ejemplo n.º 16
0
        /// <summary>
        /// id 0 = run VLC, 1 = Only history, 2 = Download, 3 = remove download, 4 = play download, 5 = copy link, 6 = chromecast, 7 = copy browser, 8 = Load links, 9 = Non invert history, 10 = copy subtitle URL, 11 = play vlc with subtitle, 12 = NOT USED
        /// </summary>
        /// <param name="id"></param>
        /// <param name="pos"></param>
        /// <param name="v"></param>
        void DoLink(int id, int pos, View v = null, string extra = "", bool useSub = false)
        {
            string link     = activeLinks[flink[pos]];
            string linkName = activeLinksNames[flink[pos]];



            if (movieProvider[movieSelectedID] == 4 && linkName.StartsWith("Episode") && currentMain && (id == 0 || id == 8))   // ------------- EPISODE SELECT TV SERIES -------------
            {
                string episode = FindHTML(linkName, "Episode ", ":");
                print("Episode id:" + episode);
                List <string> _activeLinks      = new List <string>();
                List <string> _activeLinksNames = new List <string>();
                activeSubtitles      = new List <string>();
                activeSubtitlesNames = new List <string>();

                for (int i = 0; i < activeLinks.Count; i++)
                {
                    if (activeLinksNames[i].StartsWith("Episode"))
                    {
                        _activeLinksNames.Add(activeLinksNames[i]);
                        _activeLinks.Add(activeLinks[i]);
                    }
                }
                activeLinks      = _activeLinks;
                activeLinksNames = _activeLinksNames;
                thredNumber++;
                ShowSnackBar("Loading Links For Episode " + episode, ax_Links.__view);

                tempThred = new Java.Lang.Thread(
                    () =>
                {
                    try {
                        GetUrlFromMovie123(movieSelectedID, thredNumber, "https://movies123.pro" + link, false, episode);

                        //Thread.Sleep(1000);
                    }
                    finally {
                        tempThred.Join();
                        //invoke(onCompleted);
                    }
                });
                tempThred.Start();
            }
            else if (id == 0)   // ------------- RUN VLC -------------

            // Intent intent = new Intent(Intent.ActionView);

            /*
             * string absolutePath = Android.OS.Environment.ExternalStorageDirectory + "/" + Android.OS.Environment.DirectoryDownloads;
             * string basePath = absolutePath + "/Youtube";
             * string subPath = "yeet" + ".mp4";
             *
             * string rootPath = basePath + "/" + subPath; */
            {
                Android.Net.Uri uri = Android.Net.Uri.Parse(link);
                // intent.SetData(uri);
                // intent.PutExtra("title", movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + " | " + activeLinksNames[flink[pos]]);
                //intent.PutExtra(EXTRA_FILENAME, movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + " | " + activeLinksNames[flink[pos]]);


                //   intent.PutExtra(EXTRA_RETURN_RESULT, true);
                //  StartActivityForResult(intent, REQUEST_CODE);
                Intent vlcIntent = new Intent(Intent.ActionView);
                vlcIntent.SetPackage("org.videolan.vlc");


                vlcIntent.PutExtra("title", movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + " | " + activeLinksNames[flink[pos]]);
                vlcIntent.AddFlags(ActivityFlags.GrantReadUriPermission);
                vlcIntent.AddFlags(ActivityFlags.GrantWriteUriPermission);
                vlcIntent.AddFlags(ActivityFlags.GrantPrefixUriPermission);
                vlcIntent.AddFlags(ActivityFlags.GrantPersistableUriPermission);


                if (useSub)
                {
                    try {
                        if (currentActiveSubtitle >= 0)
                        {
                            var localC = Application.Context.GetSharedPreferences("Subtitle", FileCreationMode.Private);

                            DownloadManager manager;
                            manager = (DownloadManager)ax_Links.ax_links.Context.GetSystemService(Context.DownloadService);

                            long subId = localC.GetLong("temp", -1);
                            if (subId == -1)
                            {
                            }
                            else
                            {
                                // for (int i = 0; i < 1000; i++) {
                                //    Java.Lang.Thread.Sleep(10);
                                Android.Net.Uri u = manager.GetUriForDownloadedFile(subId);

                                string truePath   = "file://" + Android.OS.Environment.ExternalStorageDirectory + "/" + Android.OS.Environment.DirectoryDownloads + "/" + SUBTITLE_PATH;
                                string _truePath  = manager.GetUriForDownloadedFile(subId).Path;
                                string __truePath = activeSubtitles[currentActiveSubtitle];

                                string subtitlePath = truePath;//activeSubtitles[currentActiveSubtitle];

                                vlcIntent.PutExtra("subtitles_location", subtitlePath);
                                // vlcIntent.PutExtra("item_location", truePath);

                                // intent.PutExtra(EXTRA_SUBTITLE_NAMES, activeSubtitlesNames[currentActiveSubtitle]);
                                print("Loaded subtitles: " + activeSubtitlesNames[currentActiveSubtitle] + "||" + activeSubtitles[currentActiveSubtitle]);
                                print("FROM PATH: " + subtitlePath);
                            }
                            //  intent.PutExtra(EXTRA_ENABLED_SUBTITLES, true);
                        }
                    }
                    catch (System.Exception) {
                    }
                }

                vlcIntent.SetDataAndType(uri, "video/*");

                StartActivityForResult(vlcIntent, 42);
            }
            else if (id == 1)   // ------------- REVERSE HISTORY (TOGGLE VIEWSTATE) -------------
            //HistoryPressTitle(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "|" + activeLinksNames[flink[pos]], true);
            {
                if (!currentMain && movieProvider[movieSelectedID] == 4)
                {
                    HistoryPressTitle(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "|" + currentEpisodeName + "|" + activeLinksNames[flink[pos]], true);
                }
                else
                {
                    HistoryPressTitle(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "|" + activeLinksNames[flink[pos]], true);
                }

                UpdateList();
                _re.ScrollToPosition(pos);
            }
            else if (id == 2)   // ------------- DOWNLOAD -------------
            // string link = activeLinks[flink[pos]];
            {
                UpdateList();
                _re.ScrollToPosition(pos);
                StartNewDownload(link, (movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "_" + activeLinksNames[flink[pos]]).ToLower().Replace(" ", "_"), (movieIsAnime[movieSelectedID] ? "Anime" : "Movie"));
            }
            else if (id == 3)   // ------------- REMOVE DOWNLOAD -------------
            {
                UpdateList();
                _re.ScrollToPosition(pos);

                RemoveDownload(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "_" + activeLinksNames[flink[pos]], mainActivity, this.View);
            }
            else if (id == 4)   // ------------- PLAY DOWNLOADED FILE -------------
            {
                ax_Downloads.PlayDownloadFileFromTitle((movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "_" + activeLinksNames[flink[pos]]).ToLower().Replace(" ", "_"));
            }
            else if (id == 5)   // ------------- COPY LINK -------------
            //print("Loading: " + movieTitles[movieSelectedID] + " | " + activeLinksNames[flink[pos]]);

            {
                ClipboardManager clip = (ClipboardManager)Context.GetSystemService(Context.ClipboardService);
                clip.PrimaryClip = ClipData.NewPlainText("Link", activeLinks[flink[pos]]);
                ShowSnackBar("Copied " + activeLinksNames[flink[pos]] + " Link To Clipboard!", ax_links.View);
            }
            else if (id == 6)   // ------------- CHOMECAST -------------
            {
                castWithSubtitle = -1;
                CastVideo(link);
                Intent intent = new Intent(Context, typeof(ChromeCastActivity));
                StartActivity(intent);
            }
            else if (id == 7)   // ------------- COPY BROWSER SITE (TV-SERIES ONLY) -------------
            {
                ClipboardManager clip = (ClipboardManager)Context.GetSystemService(Context.ClipboardService);
                clip.PrimaryClip = ClipData.NewPlainText("Link", "https://movies123.pro" + activeLinks[flink[pos]]);
                ShowSnackBar("Copied " + activeLinksNames[flink[pos]] + " Link To Clipboard!", ax_links.View);
            }
            else if (id == 9)   // ------------- JUST TOGGLE AS VIEWED HISTORY -------------
            {
                if (!currentMain && movieProvider[movieSelectedID] == 4)
                {
                    HistoryPressTitle(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "|" + currentEpisodeName + "|" + activeLinksNames[flink[pos]]);
                }
                else
                {
                    HistoryPressTitle(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "|" + activeLinksNames[flink[pos]]);
                }

                UpdateList();
                _re.ScrollToPosition(pos);
            }
            else if (id == 10)   // ------------- COPY SUBTITLE URL -------------
            {
                if (SHOW_INFO_SUBTITLES)
                {
                    ClipboardManager clip = (ClipboardManager)Context.GetSystemService(Context.ClipboardService);
                    clip.PrimaryClip = ClipData.NewPlainText("Link", activeSubtitles[currentActiveSubtitle]);
                    ShowSnackBar("Copied " + activeSubtitlesNames[currentActiveSubtitle] + " Subtitle Link To Clipboard!", ax_links.View);
                }
                else
                {
                    PopupMenu menu = new PopupMenu(ax_links.Context, v);
                    menu.MenuInflater.Inflate(Resource.Menu.menu1, menu.Menu);


                    for (int i = 0; i < activeSubtitles.Count; i++)
                    {
                        menu.Menu.Add(activeSubtitlesNames[i]);
                    }

                    menu.MenuItemClick += (s, arg) =>
                    {
                        print("ITEMID:" + arg.Item.ItemId.ToString());
                        // currentActiveSubtitle = -1;
                        int _pos = -1;
                        for (int i = 0; i < activeSubtitlesNames.Count; i++)
                        {
                            if (activeSubtitlesNames[i] == arg.Item.TitleFormatted.ToString())
                            {
                                _pos = i;
                            }
                        }
                        if (_pos != -1)
                        {
                            ClipboardManager clip = (ClipboardManager)Context.GetSystemService(Context.ClipboardService);
                            clip.PrimaryClip = ClipData.NewPlainText("Link", activeSubtitles[_pos]);
                            ShowSnackBar("Copied " + activeSubtitlesNames[_pos] + " Subtitle Link To Clipboard!", ax_links.View);
                        }

                        // Toast.MakeText(mainActivity, string.Format("Menu {0} clicked", arg.Item.TitleFormatted), ToastLength.Short).Show();
                    };

                    menu.DismissEvent += (s, arg) =>
                    {
                        //Toast.MakeText(mainActivity, string.Format("Menu dissmissed"), ToastLength.Short).Show();
                    };

                    menu.Show();
                }
            }
            else if (id == 11)   // ------------- PLAY VLC WITH SUBTITLE -------------

            //StartNewDownload(activeSubtitles[currentActiveSubtitle], movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + " | " + activeLinksNames[flink[pos]] + " | " + activeSubtitlesNames[currentActiveSubtitle], "Subtitles");
            {
                if (SHOW_INFO_SUBTITLES)
                {
                    DownloadSubtitle(true, pos);
                }
                else
                {
                    PopupMenu menu = new PopupMenu(ax_links.Context, v);
                    menu.MenuInflater.Inflate(Resource.Menu.menu1, menu.Menu);


                    for (int i = 0; i < activeSubtitles.Count; i++)
                    {
                        menu.Menu.Add(activeSubtitlesNames[i]);
                    }

                    menu.MenuItemClick += (s, arg) =>
                    {
                        print("ITEMID:" + arg.Item.ItemId.ToString());
                        currentActiveSubtitle = -1;
                        for (int i = 0; i < activeSubtitlesNames.Count; i++)
                        {
                            if (activeSubtitlesNames[i] == arg.Item.TitleFormatted.ToString())
                            {
                                currentActiveSubtitle = i;
                            }
                        }
                        if (currentActiveSubtitle != -1)
                        {
                            DownloadSubtitle(true, pos);
                        }

                        // Toast.MakeText(mainActivity, string.Format("Menu {0} clicked", arg.Item.TitleFormatted), ToastLength.Short).Show();
                    };

                    menu.DismissEvent += (s, arg) =>
                    {
                        //Toast.MakeText(mainActivity, string.Format("Menu dissmissed"), ToastLength.Short).Show();
                    };

                    menu.Show();
                }
            }
            else if (id == -100)   // ------------- NOT USED, WAS USED TO CAST WITH A DOWNLOAD SUBTITLE -------------
            {
                string subtitleURL = movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + " | " + activeLinksNames[flink[pos]] + " | " + activeSubtitlesNames[currentActiveSubtitle];
                DoLink(0, pos, null, subtitleURL);
            }
            else if (id == 12)  // ------------- CHROMECAST WITH SUBTITLES -------------
            {
                PopupMenu menu = new PopupMenu(ax_links.Context, v);
                menu.MenuInflater.Inflate(Resource.Menu.menu1, menu.Menu);


                for (int i = 0; i < activeSubtitles.Count; i++)
                {
                    menu.Menu.Add(activeSubtitlesNames[i]);
                }

                menu.MenuItemClick += (s, arg) =>
                {
                    print("ITEMID:" + arg.Item.ItemId.ToString());
                    currentActiveSubtitle = -1;
                    for (int i = 0; i < activeSubtitlesNames.Count; i++)
                    {
                        if (activeSubtitlesNames[i] == arg.Item.TitleFormatted.ToString())
                        {
                            currentActiveSubtitle = i;
                        }
                    }
                    if (currentActiveSubtitle != -1)
                    {
                        castWithSubtitle = currentActiveSubtitle;
                        CastVideo(link);
                        Intent intent = new Intent(Context, typeof(ChromeCastActivity));
                        StartActivity(intent);
                    }

                    // Toast.MakeText(mainActivity, string.Format("Menu {0} clicked", arg.Item.TitleFormatted), ToastLength.Short).Show();
                };

                menu.DismissEvent += (s, arg) =>
                {
                    //Toast.MakeText(mainActivity, string.Format("Menu dissmissed"), ToastLength.Short).Show();
                };

                menu.Show();
            }
        }
Ejemplo n.º 17
0
        public void StartListenForUDP()
        {
            UDPBroadcastThread = new Java.Lang.Thread(new Runnable(Run));

            UDPBroadcastThread.Start();
        }