private async Task UploadPhoto() { await CrossMedia.Current.Initialize(); var file = await CrossMedia.Current.PickPhotoAsync(); if (file != null && file.Path != null) { currentImgPath = file.Path; Picasso.With(this) .Load(new Java.IO.File(currentImgPath)) .Fit() .CenterCrop() .Error(Resource.Color.red) .Placeholder(Resource.Color.grey) .Into(photoImage); addItemText.Visibility = ViewStates.Invisible; discardImgLayout.Visibility = ViewStates.Visible; buttonTakePhotoLayout.Visibility = ViewStates.Invisible; } }
async void PostRequest(string URL, string sermonID) { var formContent = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("SermonID", sermonID), }); var myHttpClient = new HttpClient(); var response = await myHttpClient.PostAsync(URL, formContent); string json = await response.Content.ReadAsStringAsync(); mSermon = JsonConvert.DeserializeObject <Sermon>(json); mSermonContent.LoadUrl(mSermon.Text); this.Title = mSermon.Title; if (mSermon.Image != null) { Picasso.With(this).Load(mSermon.Image).Into(FindViewById <ImageView>(Resource.Id.sermonTitle)); } }
public override View GetView(int position, View convertView, ViewGroup parent) { ThemeViewHolder holder; var item = themelist[position]; if (convertView == null) { convertView = activity.LayoutInflater.Inflate(Resource.Layout.ThemeViewItem, parent, false); holder = new ThemeViewHolder(); holder.Themename = convertView.FindViewById <TextView>(Resource.Id.tvThemeViewName); holder.Themepicture = convertView.FindViewById <ImageView>(Resource.Id.ivThemeViewItemPic); holder.PlayButton = convertView.FindViewById <ImageView>(Resource.Id.ivThemeViewPlay); holder.PlayButton.Click += delegate { var weclipVideo = new WeClipVideo { VideoFileName = item.Filename, VideoFileUrl = item.FileUrl, EventName = item.Name }; var videoPlayerActivity = new Android.Content.Intent(activity, typeof(VideoPlayerActivity)); videoPlayerActivity.PutExtra("VideoUrlFromTheme", JsonConvert.SerializeObject(weclipVideo)); activity.StartActivity(videoPlayerActivity); }; convertView.Tag = holder; } else { holder = convertView.Tag as ThemeViewHolder; } holder.Themename.Text = item.Name; holder.PlayButton.SetImageResource(Resource.Drawable.play_little); Picasso.With(activity).Load(item.Thumb).Placeholder(Resource.Drawable.default_event_back) .Resize(80, 80).Into(holder.Themepicture); return(convertView); }
static Sample() { Values = new[] { new Sample("Image Grid View", typeof(SampleGridViewActivity)), new Sample("Load from Gallery", typeof(SampleGalleryActivity)), new Sample("Contact Photos", typeof(SampleContactsActivity)), new Sample("List / Detail View", typeof(SampleListDetailActivity)), new Sample("Sample Notification", activity => { RemoteViews remoteViews = new RemoteViews(activity.PackageName, Resource.Layout.notification_view); Intent intent = new Intent(activity, typeof(SampleGridViewActivity)); Notification notification = new NotificationCompat.Builder(activity) .SetSmallIcon(Resource.Drawable.icon) .SetContentIntent(PendingIntent.GetActivity(activity, -1, intent, 0)) .SetContent(remoteViews) .Build(); // Bug in NotificationCompat that does not set the content. if ((int)Build.VERSION.SdkInt <= (int)BuildVersionCodes.GingerbreadMr1) { notification.ContentView = remoteViews; } NotificationManager notificationManager = NotificationManager.FromContext(activity); notificationManager.Notify(NotificationId, notification); // Now load an image for this notification. Picasso.With(activity) .Load(Data.Urls[(new Random()).Next(Data.Urls.Length)]) .ResizeDimen( Resource.Dimension.notification_icon_width_height, Resource.Dimension.notification_icon_width_height) .Into(remoteViews, Resource.Id.photo, NotificationId, notification); }) }; }
protected override void ConvertAsync(RecyclerView.ViewHolder holder, StatusCommentsModel model) { var baseHolder = holder as BaseAdapter.BaseViewHolder; var itemview = baseHolder.GetConvertView(); itemview.Tag = model.Id; (baseHolder.GetView(Resource.Id.txtUserName) as TextView).Text = Html.FromHtml(model.UserDisplayName).ToString(); (baseHolder.GetView(Resource.Id.txtPostdate) as TextView).Text = DateTimeUtils.CommonTime(Convert.ToDateTime(model.DateAdded)); (baseHolder.GetView(Resource.Id.txtContent) as TextView).SetText(Html.FromHtml(model.Content), TextView.BufferType.Spannable); var imgUserUrl = (baseHolder.GetView(Resource.Id.imgUserUrl) as ImageView); (baseHolder.GetView(Resource.Id.progressBar) as ProgressBar).Visibility = ViewStates.Gone; var imgDelete = (baseHolder.GetView(Resource.Id.imgDelete) as ImageButton); imgDelete.Tag = model.Id; imgDelete.SetOnClickListener(this); if (User != null && User.UserId == model.UserGuid && model.Id > 0) { imgDelete.Visibility = ViewStates.Visible; } else { imgDelete.Visibility = ViewStates.Gone; } try { Picasso.With(context) .Load(model.UserIconUrl) .Placeholder(Resource.Drawable.placeholder) .Error(Resource.Drawable.placeholder) .Transform(new CircleTransform()) .Into(imgUserUrl); } catch { } }
protected override void OnPostExecute(string result) { base.OnPostExecute(result); if (result.Contains("Error: Not City Found")) { pd.Dismiss(); return; } openWeatherMap = JsonConvert.DeserializeObject <OpenWeatherMap>(result); pd.Dismiss(); //Controls activity.txtCity = activity.FindViewById <TextView>(Resource.Id.txtCity); activity.txtLastUpdate = activity.FindViewById <TextView>(Resource.Id.txtLastUpdate); activity.txtDescription = activity.FindViewById <TextView>(Resource.Id.txtDescription); activity.txtHumidity = activity.FindViewById <TextView>(Resource.Id.txtHumidity); activity.txtTime = activity.FindViewById <TextView>(Resource.Id.txtTime); activity.txtCelsius = activity.FindViewById <TextView>(Resource.Id.txtCelsius); activity.imgView = activity.FindViewById <ImageView>(Resource.Id.imageView); //Add Data activity.txtCity.Text = $"{openWeatherMap.name},{openWeatherMap.sys.country}"; activity.txtLastUpdate.Text = $"Last Updated: {DateTime.Now.ToString("dd MMMM yyyy HH:mm")}"; activity.txtDescription.Text = $"{openWeatherMap.weather[0].description}"; activity.txtHumidity.Text = $"Humidity: {openWeatherMap.main.humidity} %"; activity.txtTime.Text = $"SunRise: {Common.Common.UnixTimeStampToDateTime(openWeatherMap.sys.sunrise).ToString("HH:mm")}\nSunSet: {Common.Common.UnixTimeStampToDateTime(openWeatherMap.sys.sunset).ToString("HH:mm")}"; activity.txtCelsius.Text = $"{openWeatherMap.main.temp} °C"; if (!string.IsNullOrEmpty(openWeatherMap.weather[0].icon)) { Picasso.With(activity.ApplicationContext).Load(Common.Common.GetImage(openWeatherMap.weather[0].icon)).Into(activity.imgView); } }
async void PostRequest(string URL, string audioID) { var formContent = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("AudioID", audioID), }); var dialog = ProgressDialog.Show(this, "Stream", "Streaming Audio"); var myHttpClient = new HttpClient(); var response = await myHttpClient.PostAsync(URL, formContent); string json = await response.Content.ReadAsStringAsync(); mAudio = JsonConvert.DeserializeObject <Audio>(json); mAudioDate.Text = mAudio.Date.ToString(); mAudioAuthor.Text = mAudio.Author; mAudioDesc.Text = mAudio.Description; mAudioLink = mAudio.Link; mAudioPlay.Click += new EventHandler(playAudio); this.Title = mAudio.Title; player.SetAudioStreamType(Stream.Music); player.SetDataSource(mAudioLink); player.Prepare(); setProgressText(); if (mAudio.Image != null) { Picasso.With(this).Load(mAudio.Image).Into(FindViewById <ImageView>(Resource.Id.audioTitle)); } dialog.Dismiss(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.game_detail); gamename = FindViewById <TextView>(Resource.Id.textViewGameTitle); summary = FindViewById <TextView>(Resource.Id.textViewSummary); img = FindViewById <ImageView>(Resource.Id.imageViewGameCover); buttonvideo = FindViewById <Button>(Resource.Id.buttonVideo); lista = JsonConvert.DeserializeObject <List <GameDetailInfo> >(Intent.GetStringExtra("detailgame")); gamename.Text = lista[0].name; summary.Text = lista[0].summary; buttonvideo.Enabled = false; buttonvideo.Click += delegate { StartActivity(new Intent(Intent.ActionView, Android.Net.Uri.Parse(string.Format("http://www.youtube.com/watch?v={0}", lista[0].videos[0].video_id)))); }; if (lista[0].cover != null) { Picasso.With(this).Load(string.Format("https://images.igdb.com/igdb/image/upload/t_cover_big/{0}.jpg", lista[0].cover.cloudinary_id)).Into(img); } else { Picasso.With(this).Load("https://lh3.googleusercontent.com/XO8m2QiuEU3hHIHcWlS29XxUhnMXj3fU_hU8WbR100-57ypK5A_6RNIXPOdYu-EyNVRS").Into(img); } if (lista[0].videos != null) { buttonvideo.Enabled = true; } }
public override View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent) { var video = _videosList[groupPosition]; if (convertView == null) { var layoutInflater = context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; convertView = layoutInflater.Inflate(Resource.Layout.playlist_item, parent, false); } convertView.Tag = video.VideoId; var txtListChild = convertView.FindViewById <TextView>(Resource.Id.lblListItem); txtListChild.Text = video.Title; convertView.FindViewById <TextView>(Resource.Id.viewCountItem).Text = video.ViewCountString; convertView.FindViewById <TextView>(Resource.Id.likeCountItem).Text = video.LikeCountString; convertView.FindViewById <TextView>(Resource.Id.dislikeCountItem).Text = video.DislikeCountString; imgHost = convertView.FindViewById <ImageView>(Resource.Id.imageViewItem); spinner = convertView.FindViewById <ProgressBar>(Resource.Id.progressSpinnerItem); spinner.Visibility = ViewStates.Gone; imgHost.Visibility = ViewStates.Visible; convertView.SetMinimumHeight(ImgMaxHeight); Picasso.With(context) .Load(GetThumbnailUrl(ref video)) .Fit() .CenterCrop() .Into(imgHost); return(convertView); }
void SetDataContent() { var CurrentModel = ContactViewModel.CurrentOpenContactDTO; SetToolbarTitle(CurrentModel == null ? "" : CurrentModel.NAME); txtUserName.Text = CurrentModel == null ? "" :CurrentModel.NAME.Trim(); txtUserEmail.Text = CurrentModel == null ? "" :CurrentModel.EMAIL.Trim(); if (CurrentModel == null || string.IsNullOrEmpty(CurrentModel.PHONE)) { txtUserPhone.Text = @"No phone number"; } else { txtUserPhone.Text = CurrentModel.PHONE.Trim(); } if (CurrentModel == null || string.IsNullOrEmpty(CurrentModel.PIC)) { Picasso.With(this).Load(Resource.Drawable.female_placeholder).Into(imgProfile); } else { Picasso.With(this).Load(ServerURL.BaseURL + CurrentModel.PIC).Into(imgProfile); } if (CurrentModel == null) { txtStatusContent.Text = "Hi, there, I am using NightOwl"; txtStatusLastUpdateDate.Text = string.Format("{0}: {1}", "Member From: ", ""); } else { var titleContent = CurrentModel.USER_STATUS_TITLE; txtStatusContent.Text = string.IsNullOrEmpty(titleContent)?"Hi, there, I am using NightOwl":titleContent; txtStatusLastUpdateDate.Text = string.Format("{0}: {1}", "Member From: ", DateConverter.GetDateTimeFromUnixTimeStamp(CurrentModel.USER_UPDATED_AT).ToString("yyyy-MM-dd hh:mm")); } }
public void UpdateData(Post post, Context context, int cellSize) { _post = post; _context = context; var thumbnail = post.Media[0].Thumbnails?[256]; _photoString = string.IsNullOrEmpty(thumbnail) ? post.Media[0].Url : thumbnail; if (_photoString != null) { Picasso.With(_context).Load(_photoString).Placeholder(Resource.Color.rgb244_244_246).NoFade().Resize(cellSize, cellSize).CenterCrop().Into(_photo, OnSuccess, OnError); } if (_post.ShowMask && (_post.IsNsfw || _post.IsLowRated)) { _nsfwMaskMessage.Text = AppSettings.LocalizationManager.GetText(_post.IsLowRated ? LocalizationKeys.LowRated : LocalizationKeys.Nsfw); _nsfwMask.Visibility = ViewStates.Visible; } else { _nsfwMask.Visibility = ViewStates.Gone; } }
public override View GetView(int position, View view, ViewGroup parent) { ViewHolder holder; if (view == null) { view = LayoutInflater.From(context).Inflate(Resource.Layout.sample_list_detail_item, parent, false); holder = new ViewHolder { image = view.FindViewById <ImageView>(Resource.Id.photo), text = view.FindViewById <TextView>(Resource.Id.url) }; view.Tag = holder; } else { holder = (ViewHolder)view.Tag; } // Get the image URL for the current position. string url = this[position]; holder.text.Text = url; // Trigger the download of the URL asynchronously into the image view. Picasso.With(context) .Load(url) .Placeholder(Resource.Drawable.placeholder) .Error(Resource.Drawable.error) .ResizeDimen(Resource.Dimension.list_detail_image_size, Resource.Dimension.list_detail_image_size) .CenterInside() .Tag(context) .Into(holder.image); return(view); }
public NotificationCompat.Builder Extend(NotificationCompat.Builder builder) { Bitmap largeIcon = null; try { _result.Payload.AdditionalData?.Keys(); var largeIconUrl = _result.Payload.AdditionalData?.Get("large_icon").ToString(); if (!string.IsNullOrEmpty(largeIconUrl)) { largeIcon = Picasso.With(this).Load(largeIconUrl).Get(); } } catch { } finally { builder.SetSmallIcon(Resource.Drawable.ic_stat_onesignal_default) .SetContentTitle(_result.Payload.Title) .SetContentText(_result.Payload.Body) .SetGroup(Build.VERSION.SdkInt >= BuildVersionCodes.N ? "steepshot" : null) .SetLargeIcon(largeIcon ?? BitmapFactory.DecodeResource(Resources, Resource.Drawable.ic_logo_main)); } return(builder); }
public async void SetPhoto(MediaInfo profile, bool thumbnail = true) { var bitmap = await Task.Run(() => { _fetchImage = true; try { var uri = global::Android.Net.Uri.Parse(ProxyFactory.GetProxyInstace().GetUri(thumbnail ? profile.ThumbnailUri : profile.Uri)); return(Picasso.With(Context) .Load(uri) .Get()); } catch { return(null); } }); if (bitmap != null) { this.image?.Recycle(); Image = bitmap; } }
public override void OnScrollStateChanged(RecyclerView recyclerView, int newState) { Picasso picasso = Picasso.With(Android.App.Application.Context); //if ((Android.Widget.ScrollState)recyclerView.ScrollState != ScrollState.Idle || (Android.Widget.ScrollState)recyclerView.ScrollState != ScrollState.TouchScroll) { // picasso.ResumeTag(Android.App.Application.Context); //} else { // picasso.PauseTag(Android.App.Application.Context); //} switch (newState) { case RecyclerView.ScrollStateIdle: picasso.ResumeTag(Android.App.Application.Context); break; case RecyclerView.ScrollStateDragging: picasso.PauseTag(Android.App.Application.Context); break; case RecyclerView.ScrollStateSettling: picasso.PauseTag(Android.App.Application.Context); break; } }
public override View GetView(int position, View convertView, ViewGroup parent) { SquaredImageView view = convertView as SquaredImageView; if (view == null) { view = new SquaredImageView(context); view.SetScaleType(ImageView.ScaleType.CenterCrop); } // Get the image URL for the current position. string url = this[position]; // Trigger the download of the URL asynchronously into the image view. Picasso.With(context) .Load(url) .Placeholder(Resource.Drawable.placeholder) .Error(Resource.Drawable.error) .Fit() .Tag(context) .Into(view); return(view); }
public override View GetView(int position, View convertView, ViewGroup parent) { FriendsHolder viewHolder; if (convertView == null) { viewHolder = new FriendsHolder(); LayoutInflater inflater = activity.LayoutInflater; convertView = inflater.Inflate(Resource.Layout.FriendsItem, parent, false); viewHolder.tvFriendName = convertView.FindViewById <TextView>(Resource.Id.tvFriendsName); viewHolder.ivFriendsPic = convertView.FindViewById <ImageView>(Resource.Id.ivFriendsImage); viewHolder.btnSendInvite = convertView.FindViewById <Button>(Resource.Id.btnFriendInvite); convertView.Tag = viewHolder; } else { viewHolder = convertView.Tag as FriendsHolder; } viewHolder.tvFriendName.Text = friendList[position].FriendName; var str = friendList[position].Picture; if (friendList[position].Picture == null) { viewHolder.ivFriendsPic.SetImageResource(Resource.Drawable.contact_withoutphoto); } else { Picasso.With(activity).Load(friendList[position].Picture).Placeholder(Resource.Drawable.ic_settings_black_24dp) .Transform(new CircleTransformation()) .Resize(150, 150).Into(viewHolder.ivFriendsPic); } return(convertView); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.MapFragment, container, false); view.FindViewById <ImageView>(Resource.Id.image).Post(() => { if (CurrentEvent != null) { view.FindViewById(Resource.Id.mapprogress).Visibility = ViewStates.Visible; view.FindViewById <ImageView>(Resource.Id.image).SetScaleType(ImageView.ScaleType.Center); if (noscroll) { Picasso.With(view.Context).Load(CurrentEvent.localroleimage).Error(Resource.Drawable.ic_errorstatus).Into(view.FindViewById <ImageView>(Resource.Id.image), this); } else { Picasso.With(view.Context).Load(CurrentEvent.localroleimage).NetworkPolicy(NetworkPolicy.NoCache).Error(Resource.Drawable.ic_errorstatus).Into(view.FindViewById <ImageView>(Resource.Id.image), this); } } }); view.FindViewById <FrameLayout>(Resource.Id.selectionmask).Touch += Roles_Touch; return(view); }
/** * change the image with a fade * @param urlImage * @param fadeDuration * * TODO : remove Picasso */ public static void SetImageUrl(ImageView imageView, string urlImage, int fadeDuration) { float alpha = ViewHelper.GetAlpha(imageView); ImageView viewToAnimate = imageView; //fade to alpha=0 ObjectAnimator fadeOut = ObjectAnimator.OfFloat(viewToAnimate, "alpha", 0); fadeOut.SetDuration(fadeDuration); fadeOut.SetInterpolator(new DecelerateInterpolator()); fadeOut.AnimationEnd += (sender, args) => { //change the image when alpha=0 Picasso.With(imageView.Context).Load(urlImage).CenterCrop().Fit().Into(viewToAnimate, () => { //then fade to alpha=1 ObjectAnimator fadeIn = ObjectAnimator.OfFloat(viewToAnimate, "alpha", alpha); fadeIn.SetDuration(fadeDuration); fadeIn.SetInterpolator(new AccelerateInterpolator()); fadeIn.Start(); }, () => { }); }; fadeOut.Start(); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { try { if (dropBoxRows == null && dropBoxRows.Count == 0) { return; } DropBoxViewHolder viewHolderData = holder as DropBoxViewHolder; if (dropBoxRows[position].Title != null) { viewHolderData.Title.Text = $"Title: {dropBoxRows[position]?.Title}"; } else { viewHolderData.Title.Text = "Title: No Title Available here!"; } if (dropBoxRows[position].Description != null) { viewHolderData.Description.Text = $"Description: {dropBoxRows[position]?.Description}"; } else { viewHolderData.Description.Text = "Description: No Description Available here!"; } if (dropBoxRows[position].ImageHref != null) { Picasso.With(recyclerViewActivityContext).Load(dropBoxRows[position]?.ImageHref).Error(Resource.Mipmap.Icon).Into(viewHolderData.Imageview); } } catch (Exception) { } }
public void SetItem(Shot item) { currentitem = item; view.FindViewById <ImageView>(Resource.Id.star).Visibility = ViewStates.Gone; switch (item.shot_type) { case Shot.ShotTypes.PHOTO: view.FindViewById <ImageView>(Resource.Id.shottype).SetImageResource(Resource.Drawable.ic_photo_camera_white_24dp); view.FindViewById <ImageView>(Resource.Id.shottype).Visibility = ViewStates.Visible; break; case Shot.ShotTypes.AUDIO: view.FindViewById <ImageView>(Resource.Id.shottype).SetImageResource(Resource.Drawable.ic_mic_white_48dp); view.FindViewById <ImageView>(Resource.Id.shottype).Visibility = ViewStates.Visible; break; default: view.FindViewById <ImageView>(Resource.Id.shottype).Visibility = ViewStates.Gone; break; } Picasso.With(view.Context).Load("file://" + item.icon).CenterCrop().Fit().NoFade().Into(view.FindViewById <ImageView>(Resource.Id.im)); }
//public CustomAdapter(Context context, int resource, List<PropertyFeedModel> objects) : base(context, resource, objects) //{ // this._context = context; // this.resource = resource; // this.propertyFeeds = objects; //} //public CustomAdapter(Context context, int resource, List<PropertyFeedModel> objects) // : base(context, resource, objects) //{ // this._context = context; // this.resource = resource; // this.propertyFeeds = objects; //} public override View GetView(int position, View convertView, ViewGroup parent) { if (inflater == null) { inflater = (LayoutInflater)_context.GetSystemService(Context.LayoutInflaterService); } if (convertView == null) { convertView = inflater.Inflate(resource, parent, false); } // bind data MyHolder holder = new MyHolder(convertView); holder.txtTitle.Text = propertyFeeds[position].Title; //holder.ivImage.SetImageBitmap(propertyFeeds[position].Image1); Picasso.With(Context).Load(propertyFeeds[position].Image2).Into(holder.ivImage); convertView.SetBackgroundColor(Color.AliceBlue); return(base.GetView(position, convertView, parent)); }
public override void OnBindViewHolder(PreferenceViewHolder holder) { base.OnBindViewHolder(holder); view = holder.ItemView; Button log = (Button)view.FindViewById(Resource.Id.logButton); logIn = (s, e) => { LogIn(); }; logOut = (s, e) => { LogOut(); }; if (MainActivity.account == null) { log.SetTextColor(Color.DarkBlue); log.Text = Preferences.instance.Resources.GetString(Resource.String.log_in); log.Click += logIn; Color color; TypedValue value = new TypedValue(); if (Context.Theme.ResolveAttribute(Resource.Attribute.accountIconColor, value, true)) { color = Color.ParseColor("#" + Integer.ToHexString(value.Data)); } else { color = Color.Black; } view.FindViewById <ImageView>(Android.Resource.Id.Icon).SetColorFilter(color); } else { log.Text = Preferences.instance.Resources.GetString(Resource.String.log_out); Picasso.With(Android.App.Application.Context).Load(MainActivity.account.PhotoUrl).Transform(new CircleTransformation()).Into(view.FindViewById <ImageView>(Android.Resource.Id.Icon)); log.SetTextColor(Color.Red); log.Click += logOut; } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.Inflate(Resource.Layout.fragment_movie_detail, container, false); viewHolder = new MovieViewHolder(rootView); var activityToolbar = (this.Activity).FindViewById <Toolbar>(Resource.Id.main_toolbar); activityToolbar.Visibility = ViewStates.Gone; mToolbar = rootView.FindViewById <Toolbar>(Resource.Id.toolbar); SetupToolbar(mToolbar); View navigationIcon = mToolbar.GetChildAt(1); //NavigationIcon navigationIcon.Click += delegate { this.Activity.OnBackPressed(); activityToolbar.Visibility = ViewStates.Visible; }; // Set Collapsing Toolbar layout to the screen collapsingToolbar = (CollapsingToolbarLayout)rootView.FindViewById(Resource.Id.collapsing_toolbar); collapsingToolbar.SetTitle(movieItem.Title); var imageView = rootView.FindViewById <ImageView>(Resource.Id.image); Picasso.With(this.Context) .Load(movieItem.Poster) .Fit() .Tag(this.Context) .Into(imageView); SetMovieDetail(viewHolder, movieItem); return(rootView); }
public static void LoadImage(string url, ImageView imageView) { if (string.IsNullOrWhiteSpace(url)) { System.Diagnostics.Debug.WriteLine("LoadImage: No Image URL!"); return; } if (imageView == null) { throw new Exception("ImageLoader.ImageLoader: imageView is null!"); } // Construct URL imageView.ViewTreeObserver.AddOnPreDrawListener(new PreDrawListener(() => { Picasso.With(Application.Context) .Load(url) .Resize(300, 300) .CenterInside() .Into(imageView, null, null); return(imageView); })); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Intent intent = Activity.Intent; View rootView = inflater.Inflate(Resource.Layout.fragment_detail, container, false); if (intent != null && intent.HasExtra(Intent.ExtraText)) { var movieId = intent.GetLongExtra(Intent.ExtraText, 0); var movieRequest = getMoveInfo(movieId); var movieInfo = movieRequest; var titleTV = rootView.FindViewById <TextView>(Resource.Id.title_text); titleTV.Text = movieRequest[0]; var posterIV = rootView.FindViewById <ImageView>(Resource.Id.moviePoster); Picasso.With(this.Activity).Load("http://image.tmdb.org/t/p/w185/" + movieRequest[1]).Into(posterIV); var plotTV = rootView.FindViewById <TextView>(Resource.Id.plot_text); plotTV.Text = movieRequest[2]; var userRatingTV = rootView.FindViewById <TextView>(Resource.Id.rating_text); userRatingTV.Text = movieRequest[3]; var releaseDateTV = rootView.FindViewById <TextView>(Resource.Id.releaseDate_text); releaseDateTV.Text = movieRequest[4]; } return(rootView); }
private void OnError() { Picasso.With(_context).Load(_userAvatar).Placeholder(Resource.Drawable.ic_holder).NoFade().Into(this); }
/// <summary> /// When you want to implement your own slider view, please call this method in the end in `getView()` method </summary> /// <param name="v"> the whole view </param> /// <param name="targetImageView"> where to place image </param> //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: //ORIGINAL LINE: protected void bindEventAndShow(final android.view.View v, android.widget.ImageView targetImageView) protected internal virtual void bindEventAndShow(View v, ImageView targetImageView) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final BaseSliderView me = this; BaseSliderView me = this; v.SetOnClickListener(new OnClickListenerAnonymousInnerClassHelper(this, v, me)); if (targetImageView == null) { return; } if (mLoadListener != null) { mLoadListener.onStart(me); } Picasso p = (mPicasso != null) ? mPicasso : Picasso.With(mContext); RequestCreator rq = null; if (mUrl != null) { rq = p.Load(mUrl); } else if (mFile != null) { rq = p.Load(mFile); } else if (mRes != 0) { rq = p.Load(mRes); } else { return; } if (rq == null) { return; } if (Empty != 0) { rq.Placeholder(Empty); } if (Error != 0) { rq.Error(Error); } switch (mScaleType) { case ScaleType.Fit: rq.Fit(); break; case ScaleType.CenterCrop: rq.Fit().CenterCrop(); break; case ScaleType.CenterInside: rq.Fit().CenterInside(); break; } rq.Into(targetImageView, () => OnSuccess(v), () => OnError(v, me)); //rq.Into(targetImageView, new CallbackAnonymousInnerClassHelper(this, v, me)); }
public void UpdateHeader(UserProfileResponse profile) { if (profile == null) { return; } _profile = profile; _userAvatar = profile.ProfileImage; if (!string.IsNullOrEmpty(_userAvatar)) { Picasso.With(_context).Load(_userAvatar).Placeholder(Resource.Drawable.ic_holder) .NoFade() .Resize(300, 300) .CenterCrop() .Into(_profileImage, OnSuccess, OnError); } else { Picasso.With(_context).Load(Resource.Drawable.ic_holder).Into(_profileImage); } if (profile.Username.Equals(BasePresenter.User.Login, StringComparison.OrdinalIgnoreCase)) { _votingPower.VotingPower = (float)profile.VotingPower; _votingPower.Draw = true; } if (string.Equals(BasePresenter.User.Login, profile.Username, StringComparison.OrdinalIgnoreCase)) { _followButton.Visibility = ViewStates.Gone; } else { var background = (GradientDrawable)_followButton.Background; if (profile.FollowedChanging) { background.SetColors(new int[] { Style.R255G121B4, Style.R255G22B5 }); background.SetOrientation(GradientDrawable.Orientation.LeftRight); background.SetStroke(0, Color.White); _followButton.Text = string.Empty; _followButton.SetTextColor(Color.White); _followButton.Enabled = false; _loadingSpinner.Visibility = ViewStates.Visible; } else { if (profile.HasFollowed) { background.SetColors(new int[] { Color.White, Color.White }); background.SetStroke(3, Style.R244G244B246); _followButton.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Unfollow); _followButton.SetTextColor(Style.R15G24B30); } else { background.SetColors(new int[] { Style.R255G121B4, Style.R255G22B5 }); background.SetOrientation(GradientDrawable.Orientation.LeftRight); background.SetStroke(0, Color.White); _followButton.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Follow); _followButton.SetTextColor(Color.White); } _followButton.Enabled = true; _loadingSpinner.Visibility = ViewStates.Gone; } } if (!string.IsNullOrEmpty(profile.Name)) { _name.Text = profile.Name; _name.SetTextColor(Style.R15G24B30); } else if (!string.Equals(BasePresenter.User.Login, profile.Username, StringComparison.OrdinalIgnoreCase)) { _name.Visibility = ViewStates.Gone; } if (!string.IsNullOrEmpty(profile.Location)) { _place.Text = profile.Location.Trim(); } else if (!string.Equals(BasePresenter.User.Login, profile.Username, StringComparison.OrdinalIgnoreCase)) { _place.Visibility = ViewStates.Gone; } if (!string.IsNullOrEmpty(profile.About)) { _description.Text = profile.About; _description.SetTextColor(Style.R15G24B30); } else if (!string.Equals(BasePresenter.User.Login, profile.Username, StringComparison.OrdinalIgnoreCase)) { _description.Visibility = ViewStates.Gone; } if (!string.IsNullOrEmpty(profile.Website)) { _site.Text = profile.Website; _site.SetTextColor(Style.R231G72B00); } else if (!string.Equals(BasePresenter.User.Login, profile.Username, StringComparison.OrdinalIgnoreCase)) { _site.Visibility = ViewStates.Gone; } _photosCount.Text = profile.PostCount.ToString("N0"); _followingCount.Text = profile.FollowingCount.ToString("#,##0"); _followersCount.Text = profile.FollowersCount.ToString("#,##0"); _balance.Text = BasePresenter.ToFormatedCurrencyString(profile.EstimatedBalance); }
void LoadBitmapFromPicasso2(ImageView imageView) { Picasso.With(this) .Load(Resource.Drawable.avatar_isaac_fielder) .Into(imageView); }