public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { var vHolder = holder as RecyViewHolder; WebPageData data = this.data[position]; vHolder.mainTextView.Text = data.mainText; vHolder.subTextView.Text = data.subText; //if (data.drawable != null) vHolder.imageView.SetImageBitmap(data.drawable); //else vHolder.imageView.SetImageResource(DefaultPic); //vHolder.imageView.SetImageBitmap(imageProvider.GetBitmapThumbnail(data.ImageUrl));//Grab image from ImageProvider using URL for better user experience if (data.ImageUrl != string.Empty) { Picasso.With(context).Load(data.ImageUrl).Into(vHolder.imageView); } else { vHolder.imageView.SetImageResource(DefaultPic); } if (!data.IsFinal) { vHolder.mainTextView.SetTextColor(Android.Graphics.Color.Red); } else { vHolder.mainTextView.SetTextColor(Android.Graphics.Color.Black); } }
private void initialResponse(RequestPacket packet) { var responseHandler = packet.AnalisisModuleResponseUI; responseHandler.RequestProcessedCallback( packet.Uid, packet.Url, new WebPageData[] { WebPageData.GetFakeData() }); }
public static WebPageData GetFakeData() { WebPageData data = new WebPageData() { IsFinal = false }; data.mainText = "Loading..."; data.subText = "Loading..."; //data.underlayingLinkReader = null; return(data); }
public static WebPageData GetTextOnly(string mainText, string subText) { WebPageData data = new WebPageData() { IsFinal = false }; data.mainText = mainText; data.subText = subText; //data.underlayingLinkReader = null; return(data); }
public void RequestProcessedCallback(string uid, string requestedUrl, WebPageData[] data) { if (IsNextPageRequestSent) { var newData = new WebPageData[cachedData.Length + data.Length]; cachedData.CopyTo(newData, 0); data.CopyTo(newData, cachedData.Length); cachedData = newData; IsNextPageRequestSent = false; isDataChanged = true; } RunOnUiThread(new Action(() => { pAdapter.albumImages = ((IBigImageCollectionHolder)currentWebPage).AlbumImages; pAdapter.NotifyDataSetChanged(); })); }
private void ContentView_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { var webpageData = adapter.data[e.Position]; IsNextPageRequestSent = false; var nextPageReader = currentWebPage.OnClickCallback(webpageData); currentState = currentState + 1; if (nextPageReader.IsOnClickBigImage) { //show download button addToDownloadButton.Visibility = ViewStates.Visible; } else { addToDownloadButton.Visibility = ViewStates.Gone; } if (webpageData.IsFinal && nextPageReader != null) { analysisModule.RequestStringData(UidGenerator(), MoveToWebpage(nextPageReader, adapter.data, this.Title, e.Position), this); title = this.Title = webpageData.mainText; adapter.data = new WebPageData[] { WebPageData.GetFakeData() }; adapter.NotifyDataSetChanged(); currenItemPosition = 0; } else if (currentWebPage.IsOnClickBigImage) { try { currenItemPosition = e.Position; cachedData = adapter.data; //StartActivity(websiteImageViewer); StartActivityForResult(websiteImageViewer, WebsiteImageViewRequestCode); } catch (System.Exception) { } } }
public void RequestProcessedCallback(string uid, string requestedUrl, WebPageData[] data) { WebPageData[] newData = null; if (IsNextPageRequestSent) { newData = new WebPageData[adapter.data.Length + data.Length]; adapter.data.CopyTo(newData, 0); data.CopyTo(newData, adapter.data.Length); IsNextPageRequestSent = false; } RunOnUiThread(new Action(() => { adapter.data = newData != null ? newData : data; adapter.NotifyDataSetChanged(); restoreContainer(); restoreCurrentPosition(); //contentView.Invalidate(); })); }
public override View GetView(int position, View convertView, ViewGroup parent) { if (convertView == null) { var layoutInflator = (LayoutInflater)webBrowserContext.GetSystemService(Service.LayoutInflaterService); switch (currentWebPage.Viewing) { case PreferedViewing.List: convertView = layoutInflator.Inflate(Resource.Layout.website_browser_listview_single_row, parent, false); break; case PreferedViewing.Grid: convertView = layoutInflator.Inflate(Resource.Layout.website_browser_gridview_single_item, parent, false); break; default: break; } VAdapterViewHolder vholder = new VAdapterViewHolder(convertView); convertView.Tag = vholder; } VAdapterViewHolder vHolder = (VAdapterViewHolder)convertView.Tag; WebPageData data = this.data[position]; vHolder.mainTextView.Text = data.mainText; vHolder.subTextView.Text = data.subText; if (vHolder.imageView != null) { if (data.ImageUrl != string.Empty) { Picasso.With(parent.Context).Load(data.ImageUrl).Resize(128, 128).CenterInside().Into(vHolder.imageView); } else { vHolder.imageView.SetImageResource(DefaultPic); } } else { vHolder.comicContainerLinearLayout?.SetBackgroundColor(Android.Graphics.Color.ParseColor(data.color)); vHolder.comicTextView.Text = data.mainText[0].ToString() + data.mainText[1].ToString(); if (data.NoOfItemsIncluded != -1) { vHolder.noOfItemIncludedTextView.Visibility = ViewStates.Visible; vHolder.noOfItemIncludedTextView.Text = data.NoOfItemsIncluded.ToString(); } else { vHolder.noOfItemIncludedTextView.Visibility = ViewStates.Gone; } } //if (!data.IsFinal) vHolder.mainTextView.SetTextColor(Android.Graphics.Color.Red); //else vHolder.mainTextView.SetTextColor(Android.Graphics.Color.White); if (data.subText == string.Empty) { vHolder.subTextView.Visibility = ViewStates.Gone; } else { vHolder.subTextView.Visibility = ViewStates.Visible; } if (!this.parent.IsNextPageRequestSent && currentWebPage.IsMultiPaged) { float indexReched = (float)position / this.data.Length; if (indexReched >= NextPageLoadingIndex) { var nextPage = currentWebPage.GetNextPage(); if (nextPage != null) { analysisModule.RequestStringData(UidGenerator(), nextPage, this.parent); this.parent.IsNextPageRequestSent = true; } } } //Android.Util.Log.Debug("UI", parent.Id == liv.Id ? "ListView" : "Grid Called ==================================="); return(convertView); }