public SimpleStringRecyclerViewAdapter(Context context, List <string> items, Resources res, ax_Links _tt) { context.Theme.ResolveAttribute(Resource.Attribute.selectableItemBackground, mTypedValue, true); mBackground = mTypedValue.ResourceId; mValues = items; mResource = res; tt = _tt; mCalculatedSizes = new Dictionary <int, int>(); }
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); }