public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { base.OnBindViewHolder(holder, position); if (holder is ItemViewHolder) { ItemViewHolder itemViewHolder = (ItemViewHolder)holder; var relatesBean = relates[position];//.get(position); var dd = "http://d.hiphotos.baidu.com/image/pic/item/d000baa1cd11728bc4388fe7c5fcc3cec2fd2cd9.jpg"; var requestOptions = new RequestOptions(); requestOptions.Placeholder(Resource.Drawable.I1); requestOptions.CenterCrop(); requestOptions.DontAnimate(); requestOptions.Error(Resource.Drawable.I7); requestOptions.CircleCrop(); Glide.With(holder.ItemView) .Load(dd) .Apply(requestOptions) .Into(itemViewHolder.mVideoPic); //.i //.with(getContext()) // .load(relatesBean.getPic()) // .centerCrop() // .diskCacheStrategy(DiskCacheStrategy.ALL) // .placeholder(R.drawable.bili_default_image_tv) // .dontAnimate() // .into(itemViewHolder.mVideoPic); itemViewHolder.mVideoTitle.Text = "Test"; // relatesBean.getTitle();//.setText(relatesBean.getTitle()); itemViewHolder.mVideoPlayNum.Text = "10"; // relatesBean.getStat().getView().ToString();//.setText( //NumberUtil.converString(relatesBean.getStat().getView())); itemViewHolder.mVideoReviewNum.Text = "0"; // relatesBean.getStat().getView().ToString();//setText( // NumberUtil.converString(relatesBean.getStat().getDanmaku())); itemViewHolder.mUpName.Text = "Someone"; // relatesBean.getOwner().getName();// setText(relatesBean.getOwner().getName()); } }
private void PickiTonCompleteListener(string path) { //Dismiss dialog and return the path try { // Check if it was a Drive/local/unknown provider file and display a Toast //if (wasDriveFile) => "Drive file was selected" //else if (wasUnknownProvider) => "File was selected from unknown provider" //else => "Local file was selected" // Chick if it was successful var check = WoWonderTools.CheckMimeTypesWithServer(path); if (!check) { //this file not supported on the server , please select another file Toast.MakeText(this, GetString(Resource.String.Lbl_ErrorFileNotSupported), ToastLength.Short)?.Show(); return; } var type = Methods.AttachmentFiles.Check_FileExtension(path); if (type == "Image") { File file2 = new File(PathImage); var photoUri = FileProvider.GetUriForFile(this, PackageName + ".fileprovider", file2); Glide.With(this).Load(photoUri).Apply(new RequestOptions()).Into(ImgGallery); //GlideImageLoader.LoadImage(this, PathImage, ImgGallery, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); } else { Toast.MakeText(this, GetText(Resource.String.Lbl_Failed_to_load), ToastLength.Short)?.Show(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public override void OnViewCreated(View view, Bundle savedInstanceState) { try { AlbumsId = Arguments.GetString("AlbumsId") ?? ""; InitComponent(view); GlideRequestOptions = new RequestOptions().Error(Resource.Drawable.ImagePlacholder).Placeholder(Resource.Drawable.ImagePlacholder).SetDiskCacheStrategy(DiskCacheStrategy.All).SetPriority(Priority.High); FullGlideRequestBuilder = Glide.With(this).AsBitmap().Apply(GlideRequestOptions).Transition(new BitmapTransitionOptions().CrossFade(100)); //InitToolbar(view); SetRecyclerViewAdapters(); SetDataAlbums(); AdsGoogle.Ad_Interstitial(Activity); base.OnViewCreated(view, savedInstanceState); } catch (Exception e) { Console.WriteLine(e); } }
public override void OnViewRecycled(Java.Lang.Object holder) { try { if (holder != null) { if (holder is GroupsAdapterViewHolder viewHolder) { Glide.With(ActivityContext).Clear(viewHolder.Image); } if (holder is PageAdapterViewHolder viewHolder2) { Glide.With(ActivityContext).Clear(viewHolder2.Image); } } base.OnViewRecycled(holder); } catch (Exception e) { Console.WriteLine(e); } }
public override void OnViewRecycled(Object holder) { try { if (ActivityContext?.IsDestroyed != false) { return; } if (holder != null) { if (holder is JoinAdapterViewHolder viewHolder) { Glide.With(ActivityContext).Clear(viewHolder.Image); } } base.OnViewRecycled(holder); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public override void OnViewRecycled(Java.Lang.Object holder) { try { if (ActivityContext?.IsDestroyed != false) { return; } switch (holder) { case FeelingsAdapterViewHolder viewHolder: Glide.With(ActivityContext).Clear(viewHolder.Image); break; } base.OnViewRecycled(holder); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
/// <summary> /// /// </summary> /// <param name="businessCode"></param> /// <param name="imageView"></param> /// <param name="CompleteContent"></param> /// <param name="ContentList"></param> /// <param name="textViewBusinessTitle"></param> /// <param name="textView1"></param> /// <param name="textView2"></param> /// <param name="textView3"></param> /// <param name="textView4"></param> /// <param name="galeria"></param> public void LoadData(int businessCode, ImageView imageView, string CompleteContent, string[] ContentList, TextView textViewBusinessTitle, TextView textView1, TextView textView2, TextView textView3, TextView textView4, Galeria galeria) { int SkillNumber = 1; Glide.With(this) .Load(galeria.Url) .Into(imageView); LoadTextViewText(textViewBusinessTitle, galeria.Nombre); CompleteContent = galeria.Texto; ContentList = CompleteContent.Split('/'); foreach (string Content in ContentList) { switch (SkillNumber) { case 1: textView1.Text = "• " + Content; break; case 2: textView2.Text = "• " + Content; break; case 3: textView3.Text = "• " + Content; break; case 4: textView4.Text = "• " + Content; break; default: break; } SkillNumber++; } }
public async Task <IImageSourceServiceResult <Drawable>?> GetDrawableAsync(IStreamImageSource imageSource, Context context, CancellationToken cancellationToken = default) { if (imageSource.IsEmpty) { return(null); } try { var stream = await imageSource.GetStreamAsync(cancellationToken).ConfigureAwait(false); // We can use the .NET stream directly because we register the InputStreamModelLoader. // There are 2 alternatives: // - Load the bitmap manually and pass that along, but then we do not get the decoding features. // - Copy the stream into a byte array and that is double memory usage - especially for large streams. var inputStream = new InputStreamAdapter(stream); var result = await Glide .With(context) .Load(inputStream) .SetDiskCacheStrategy(DiskCacheStrategy.None) .SubmitAsync(context, cancellationToken) .ConfigureAwait(false); if (result == null) { throw new InvalidOperationException("Unable to load image stream."); } return(result); } catch (Exception ex) { Logger?.LogWarning(ex, "Unable to load image stream."); throw; } }
private void btnLoad_Click(object sender, EventArgs e) { datas = getImageList(); int i = 0; //获取当前可加载的个数 x = 6; // (int)Math.Floor(flImages.Width / 100f); y = 6; //(int)Math.Ceiling(flImages.Height / 100f); currentRow = y; int maxNum = x * y; MaxRow = (int)Math.Ceiling(datas.Count * 1f / x); foreach (var item in datas) { if (i == maxNum) { //vScrollBar1.Maximum = 100 * ((int)Math.Ceiling(datas.Count / x * 1f) - y); //vScrollBar1.Minimum = 100; vScrollBar1.Maximum = MaxRow; break; } PictureBox image = new PictureBox(); image.Width = 100; image.Height = 100; image.SizeMode = PictureBoxSizeMode.StretchImage; flImages.Controls.Add(image); image.MouseDown += Image_MouseDown; image.MouseMove += Image_MouseMove; image.MouseUp += Image_MouseUp; i++; //加载图片 Glide.With(this.Handle).Load(item).Into(image); } }
public override View GetView(int position, View convertView, ViewGroup parent) { var view = convertView; // re--use an existing view, if one is available if (view == null) { view = this._context.LayoutInflater.Inflate(Resource.Layout.MovieListItem, null); } var movie = this._movieList[position]; view.FindViewById <TextView>(Resource.Id.title).Text = $"{movie.Title} ({movie.Year:yyyy})"; if (movie.Actors.Count() >= 3) { view.FindViewById <TextView>(Resource.Id.cast).Text = movie.Actors[0] + ", " + movie.Actors[1] + ", " + movie.Actors[2]; } else if (movie.Actors.Count() == 2) { view.FindViewById <TextView>(Resource.Id.cast).Text = movie.Actors[0] + ", " + movie.Actors[1]; } else if (movie.Actors.Count() == 1) { view.FindViewById <TextView>(Resource.Id.cast).Text = movie.Actors[0]; } else { view.FindViewById <TextView>(Resource.Id.cast).Text = ""; } var imageView = view.FindViewById <ImageView>(Resource.Id.movieImage); Glide.With(_context).Load("https://image.tmdb.org/t/p/w500" + movie.ImageUrl).Into(imageView); return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(WindowFeatures.NoTitle); // Create application here SetContentView(Resource.Layout.MovieDetail); // Get the passed JSON string of movies var jsonStr = this.Intent.GetStringExtra("singleMovie"); // Convert from JSON string to a list of movies _movie = JsonConvert.DeserializeObject <Movie>(jsonStr); this.FindViewById <TextView>(Resource.Id.title).Text = _movie.Title + " (" + _movie.Year + ")"; this.FindViewById <TextView>(Resource.Id.stats).Text = _movie.Runtime + " min | " + _movie.getStringedGenres(); this.FindViewById <TextView>(Resource.Id.description).Text = _movie.Description; // Load the Poster Image if (_movie.ImageName != null || _movie.ImageName != "") { var poster = this.FindViewById <ImageView>(Resource.Id.poster); Glide.With(this).Load(POSTER_URL + _movie.ImageName).Into(poster); } // Load the Backdrop if (_movie.Backdrop != null || _movie.Backdrop != "") { var backdrop = this.FindViewById <ImageView>(Resource.Id.backdrop); Glide.With(this).Load(POSTER_URL + _movie.Backdrop).Into(backdrop); } // Display the toolbar var toolbar = this.FindViewById <Toolbar>(Resource.Id.toolbar); this.SetActionBar(toolbar); this.ActionBar.Title = "About This Movie"; }
/// <summary> /// /// </summary> /// <param name="view">View Object to initialize all ImagesButton</param> private void InitializingReactImages(View view) { try { MImgButtonOne = view.FindViewById <ImageView>(Resource.Id.imgButtonOne); MImgButtonTwo = view.FindViewById <ImageView>(Resource.Id.imgButtonTwo); MImgButtonThree = view.FindViewById <ImageView>(Resource.Id.imgButtonThree); MImgButtonFour = view.FindViewById <ImageView>(Resource.Id.imgButtonFour); MImgButtonFive = view.FindViewById <ImageView>(Resource.Id.imgButtonFive); MImgButtonSix = view.FindViewById <ImageView>(Resource.Id.imgButtonSix); switch (AppSettings.PostButton) { case PostButtonSystem.ReactionDefault: Glide.With(Context).Load(Resource.Drawable.gif_like).Apply(new RequestOptions().CenterCrop()).Into(MImgButtonOne); Glide.With(Context).Load(Resource.Drawable.gif_love).Apply(new RequestOptions().CenterCrop()).Into(MImgButtonTwo); Glide.With(Context).Load(Resource.Drawable.gif_haha).Apply(new RequestOptions().CenterCrop()).Into(MImgButtonThree); Glide.With(Context).Load(Resource.Drawable.gif_wow).Apply(new RequestOptions().CenterCrop()).Into(MImgButtonFour); Glide.With(Context).Load(Resource.Drawable.gif_sad).Apply(new RequestOptions().CenterCrop()).Into(MImgButtonFive); Glide.With(Context).Load(Resource.Drawable.gif_angry).Apply(new RequestOptions().CenterCrop()).Into(MImgButtonSix); break; case PostButtonSystem.ReactionSubShine: Glide.With(Context).Load(Resource.Drawable.like).Apply(new RequestOptions().FitCenter()).Into(MImgButtonOne); Glide.With(Context).Load(Resource.Drawable.love).Apply(new RequestOptions().FitCenter()).Into(MImgButtonTwo); Glide.With(Context).Load(Resource.Drawable.haha).Apply(new RequestOptions().FitCenter()).Into(MImgButtonThree); Glide.With(Context).Load(Resource.Drawable.wow).Apply(new RequestOptions().FitCenter()).Into(MImgButtonFour); Glide.With(Context).Load(Resource.Drawable.sad).Apply(new RequestOptions().FitCenter()).Into(MImgButtonFive); Glide.With(Context).Load(Resource.Drawable.angry).Apply(new RequestOptions().FitCenter()).Into(MImgButtonSix); break; } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void LoadModelInView(string avatar, string name, string email, string gender, string birthdate, bool updated) { if (updated) { ImageUpdated = DateTime.Now.Millisecond.ToString(); } Glide.With(this) .Load(avatar) .Apply(RequestOptions.SignatureOf(new ObjectKey(ImageUpdated))) .Into(ciwProfileImage); Log.Error("ProfileActivity Glide ImgKey", ImageUpdated); tvName.Text = name; tvEmail.Text = email; SetGender(gender); if (convertDateToStringFormat(birthdate) != null) { tvDateOftBirth.Text = convertDateToStringFormat(birthdate); } else { tvDateOftBirth.Text = birthdate; } tvAge.Text = GetAge(birthdate) + " ani"; if (int.Parse(Utils.GetDefaults("UserType")) == 2) { var rlCWAfectiuni = FindViewById <RelativeLayout>(Resource.Id.cw_diseases); rlCWAfectiuni.Visibility = ViewStates.Gone; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_scrolling); Window.AddFlags(WindowManagerFlags.TranslucentNavigation); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); if (SupportActionBar != null) { SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.NavigationClick += (sender, args) => { OnBackPressed(); }; } FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab_scrolling); fab.SetOnClickListener(this); ImageView image_scrolling_top = FindViewById <ImageView>(Resource.Id.image_scrolling_top); Glide.With(this).Load(Resource.Drawable.material_design_3).Apply(RequestOptions.FitCenterTransform()).Into(image_scrolling_top); }
private void Initialize(NearbyShopsAdapterViewHolder holder, NearbyShopsDataObject item) { try { if (item.Product?.ProductClass?.Images?.Count > 0) { if (item.Product?.ProductClass != null && item.Product.Value.ProductClass.Images[0].Image.Contains("http")) { GlideImageLoader.LoadImage(ActivityContext, item.Product?.ProductClass?.Images?[0]?.Image, holder.Thumbnail, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); } else { Glide.With(ActivityContext).Load(new File(item.Product?.ProductClass?.Images?[0]?.Image)).Apply(new RequestOptions().CenterCrop().Placeholder(Resource.Drawable.ImagePlacholder).Error(Resource.Drawable.ImagePlacholder)).Into(holder.Thumbnail); } } GlideImageLoader.LoadImage(ActivityContext, item.Product?.ProductClass?.Seller?.Avatar, holder.Userprofilepic, ImageStyle.CircleCrop, ImagePlaceholders.Color); holder.Title.Text = Methods.FunString.DecodeString(item.Product?.ProductClass?.Name); holder.UserName.Text = WoWonderTools.GetNameFinal(item.Product?.ProductClass?.Seller); holder.Time.Text = item.Product?.ProductClass?.TimeText; var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Product?.ProductClass?.Currency); Console.WriteLine(currency); holder.TxtPrice.Text = currencyIcon + " " + item.Product?.ProductClass?.Price; holder.LocationText.Text = !string.IsNullOrEmpty(item.Product?.ProductClass?.Location) ? item.Product?.ProductClass?.Location : ActivityContext.GetText(Resource.String.Lbl_Unknown); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { UserScoreViewHolder vh = holder as UserScoreViewHolder; if (vh == null) { return; } UserScore userScore = _mGame.scores[position]; vh.TvUserName.Text = userScore.user.name; vh.TvWins.Text = userScore.user.winCount.ToString(); vh.TvLoss.Text = userScore.user.lossCount.ToString(); Glide .With(_mContext) .Load(userScore.user.profileUrl) .Apply(RequestOptions.CenterCropTransform()).Into(vh.IvUserProfile); GridLayoutManager layoutManager = new GridLayoutManager(_mContext.Context, 3); layoutManager.SetSpanSizeLookup(new ScoreSpanSizeLookup(userScore.scores.Count)); vh.RvUserScore.SetLayoutManager(layoutManager); vh.RvUserScore.SetAdapter(new ScoreAdapter(_mContext, userScore)); }
private void SetDataPlaylist() { try { PlaylistId = Arguments.GetString("PlaylistId") ?? ""; if (!string.IsNullOrEmpty(PlaylistId)) { PlaylistObject = JsonConvert.DeserializeObject <PlaylistDataObject>(Arguments.GetString("ItemData") ?? ""); if (PlaylistObject != null) { Glide.With(this).AsBitmap().Apply(GlideRequestOptions).Load(PlaylistObject.ThumbnailReady).Into(DiskImage); Glide.With(this).AsBitmap().Load(PlaylistObject.ThumbnailReady).Into(CoverImage); var d = PlaylistObject.Name.Replace("<br>", ""); TxtNamePlaylist.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(d), 70); TxtPublisherName.Text = PlaylistObject?.Publisher != null?Context.GetText(Resource.String.Lbl_By) + " " + DeepSoundTools.GetNameFinal(PlaylistObject?.Publisher.Value.PublisherClass) : Context.GetText(Resource.String.Lbl_By); if (!string.IsNullOrEmpty(PlaylistObject.Songs.ToString())) { TxtSongCount.Text = PlaylistObject.Songs + " " + GetText(Resource.String.Lbl_Songs); } else { TxtSongCount.Text = GetText(Resource.String.Lbl_Songs); } } StartApiService(); } } catch (Exception e) { Console.WriteLine(e); } }
public override Object InstantiateItem(ViewGroup container, int position) { position = position % Count; View view = container; var inflater = _context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; view = inflater.Inflate(Resource.Layout.image_slider_item, null); var child = view.FindViewById <ImageView>(Resource.Id.image_slider_item); // 点击事件 child.Click += (sender, args) => { Toast.MakeText(_context, $"{_imageList[position]}", ToastLength.Short).Show(); }; Glide.With(_context).AsBitmap().Load(_imageList[position]).Into(child); //Bitmap image = null; //Task.Run(() => //{ // URL url = new URL(_imageList[position]); // image = BitmapFactory.DecodeStream(url.OpenConnection().InputStream); //}).ContinueWith(t => //{ // (_context as FruitActivity)?.RunOnUiThread(() => // { // child.SetImageBitmap(image); // }); //}); container.AddView(view); return(view); }
public override View GetView(int position, View contentView, ViewGroup parent) { ViewHolder holder; if (contentView == null) { LayoutInflater inflater = LayoutInflater.From(Context); contentView = inflater.Inflate(Resource.Layout.item_tourist_spot_card, parent, false); holder = new ViewHolder(contentView); contentView.Tag = holder; } else { holder = (ViewHolder)contentView.Tag; } TouristSpot spot = GetItem(position); holder.Name.Text = spot.Name; holder.City.Text = spot.City; Glide.With(Context).Load(spot.Url).Into(holder.Image); return(contentView); }
// Replace the contents of a view (invoked by the layout manager) public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { try { if (viewHolder is StickerAdapterViewHolder holder) { var item = MstickerList.ElementAt(position).Key; if (item != null) { GlideImageLoader.LoadImage(ActivityContext, item, holder.ImgSticker, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); Glide.With(ActivityContext) .AsBitmap() .Load(item) .Apply(options) .Into(new MySimpleTarget(this, holder, position)); } } } catch (Exception e) { Console.WriteLine(e); } }
static void SetHeader(this MessageCell cell, int row, BotMessage message) { cell.SetHeader(message.LocalTimeStamp, message.Activity?.From?.Name); //cell.ImageView.SetCacheFormat (getCacheFormat (MessageCell.AvatarImageSize)); //if (message.Activity.From.Id == "DigitalAgencies") //{ // cell.SetAvatar (row, UIImage.FromBundle ("avatar_microsoft")); //} //else //{ var avatarUrl = string.IsNullOrEmpty(message.Activity?.From?.Id) ? string.Empty : BotClient.Shared.GetAvatarUrl(message.Activity.From.Id); if (string.IsNullOrEmpty(avatarUrl)) { cell.SetAvatar(row, null); } else { var placeholder = getPlaceholderImage(MessageCell.AvatarImageSize); Glide.With(cell.Context).Load(avatarUrl).Placeholder(placeholder).Into(cell.AvatarView); //using (NSUrl url = new NSUrl (avatarUrl)) //{ // cell?.ImageView.SetImage (url, placeholder, (img) => cell.SetAvatar (indexPath.Row, img), (err) => // { // cell.SetAvatar (indexPath.Row, null); // Log.Debug (err.LocalizedDescription); // }); //} } //} }
private static void TrimCache(Activity context) { try { File dir = context?.CacheDir; if (dir != null && dir.IsDirectory) { DeleteDir(dir); } context?.DeleteDatabase("WowonderSocial.db"); context?.DeleteDatabase(SqLiteDatabase.PathCombine); if (context?.IsDestroyed != false) { return; } Glide.Get(context)?.ClearMemory(); new Thread(() => { try { Glide.Get(context)?.ClearDiskCache(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }).Start(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public override View GetView(int position, View convertView, ViewGroup parent) { var grid = convertView; LayoutInflater inflater = (LayoutInflater)mContext.GetSystemService(Context.LayoutInflaterService); ReferenceImageViewHolder1 holder; if (grid == null) { holder = new ReferenceImageViewHolder1(); grid = inflater.Inflate(Resource.Layout.Attachment_layout, null); var view = grid.FindViewById <ImageView>(Resource.Id.imageview_attach); grid.Tag = new ReferenceImageViewHolder1() { View = view }; } holder = (ReferenceImageViewHolder1)grid.Tag; Glide.With(mContext).Load(myList[position].Path).Into(holder.View); holder.View.Click += (o, e) => { ImageDialogFragment nextFrag = new ImageDialogFragment(); fragment.BeginTransaction().Replace(Resource.Id.container, nextFrag).Commit(); //FragmentTransaction ft = Fragment.PopBackStack(); fragment.PopBackStack(); Bundle bundle = new Bundle(); bundle.PutString("Path", myList[position].Path); nextFrag.Arguments = bundle; }; //Bitmap bitmap = BitmapFactory.DecodeFile(myList[position].Path); //holder.View.SetImageBitmap(bitmap); return(grid); }
// Replace the contents of a view (invoked by the layout manager) public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { try { switch (viewHolder) { case PhotosAdapterViewHolder holder: { var item = PhotosList[position]; if (item != null) { switch (string.IsNullOrEmpty(item.Image)) { case false when item.Image.Contains("file://") || item.Image.Contains("content://") || item.Image.Contains("storage") || item.Image.Contains("/data/user/0/"): { File file2 = new File(item.Image); var photoUri = FileProvider.GetUriForFile(ActivityContext, ActivityContext.PackageName + ".fileprovider", file2); Glide.With(ActivityContext).Load(photoUri).Apply(new RequestOptions()).Into(holder.Image); break; } default: GlideImageLoader.LoadImage(ActivityContext, item.Image, holder.Image, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); break; } } break; } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.MovieDetail); var jsonStr = this.Intent.GetStringExtra("movie"); this._movie = JsonConvert.DeserializeObject <MovieInfo>(jsonStr); //TODO: Setja upp layout og fylla það af this._movie upplýsingum var movieTitleText = this.FindViewById <TextView>(Resource.Id.textView1); var movieDateText = this.FindViewById <TextView>(Resource.Id.textView2); var moviePoster = this.FindViewById <ImageView>(Resource.Id.imageView1); var movieOverviewText = this.FindViewById <TextView>(Resource.Id.textView3); movieTitleText.Text = _movie.Title; this.FindViewById <TextView>(Resource.Id.textView2).Text = _movie.ReleaseDate.Year.ToString(); Glide.With(this).Load("http://image.tmdb.org/t/p/w185/" + _movie.PosterPath).Apply(RequestOptions.FitCenterTransform()).Into(moviePoster); movieOverviewText.Text = _movie.Overview; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.MovieDetails); var jsonString = this.Intent.GetStringExtra("singleMovie"); var movie = JsonConvert.DeserializeObject <Movie>(jsonString); this.FindViewById <TextView>(Resource.Id.title).Text = movie.Title + " (" + movie.Year + ")"; string genres = ""; foreach (string s in movie.Genres) { genres += s + ", "; } if (genres.Length != 0) { genres = genres.Remove(genres.Length - 2); } this.FindViewById <TextView>(Resource.Id.info).Text = movie.Runtime + " min | " + genres; var poster = this.FindViewById <ImageView>(Resource.Id.poster); Glide.With(this).Load(ImageUrl + movie.ImageRemote).Into(poster); var backdrop = this.FindViewById <ImageView>(Resource.Id.backdrop); Glide.With(this).Load(ImageUrl + movie.BackdropRemote).Into(backdrop); this.FindViewById <TextView>(Resource.Id.description).Text = movie.Description; this.FindViewById <RatingBar>(Resource.Id.ratingBar).Rating = (float)movie.AverageVote; var toolbar = this.FindViewById <Toolbar>(Resource.Id.toolbar); this.SetActionBar(toolbar); this.ActionBar.Title = "MovieSearch"; }
public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { var item = images[position]; var holder = viewHolder as RecyclerHolder; RequestOptions ro = new RequestOptions().CenterCrop(); var glide = Glide.With(context).AsBitmap().Apply(ro).Load(item); glide.DiskCacheStrategy_T(DiskCacheStrategy.None); glide.Placeholder(Resource.Drawable.outline_file_upload_24).Error(Resource.Drawable.outline_error_24); glide.Into(holder.image); if (CheckedPositions.Contains(position)) { holder.checkBtn.Visibility = ViewStates.Visible; } else { holder.checkBtn.Visibility = ViewStates.Invisible; } holders.Add(holder); }
public RequestBuilder GetPreloadRequestBuilder(Java.Lang.Object p0) { return(Glide.With(ActivityContext).Load(p0.ToString()) .Apply(new RequestOptions().CenterCrop())); }
// Replace the contents of a view (invoked by the layout manager) public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { try { if (viewHolder is ExploreAdapterViewHolder holder) { var item = FeaturedList[position]; if (item != null) { item.Mp4 = Methods.FunString.StringNullRemover(item.Mp4); var type = NewsFeedAdapter.GetPostType(item); if (type == NativeFeedType.Video) { FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.PlayIcon, IonIconsFonts.Play); holder.PlayIcon.Visibility = ViewStates.Visible; FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.TypeIcon, IonIconsFonts.Videocamera); holder.TypeIcon.Visibility = ViewStates.Visible; } else if (type == NativeFeedType.Gif) { if (string.IsNullOrEmpty(item.MediaSet[0]?.Extra) && !item.MediaSet[0].Extra.Contains("http")) { item.MediaSet[0].Extra = item.MediaSet[0]?.File; } holder.TypeIcon.Text = ActivityContext.GetText(Resource.String.Lbl_Gif); FontUtils.SetFont(holder.TypeIcon, Fonts.SfSemibold); holder.PlayIcon.Visibility = ViewStates.Gone; holder.TypeIcon.Visibility = ViewStates.Visible; } else if (type == NativeFeedType.MultiPhoto || type == NativeFeedType.Photo) { if (string.IsNullOrEmpty(item.MediaSet[0]?.Extra) && !item.MediaSet[0].Extra.Contains("http")) { item.MediaSet[0].Extra = item.MediaSet[0]?.File; } holder.PlayIcon.Visibility = ViewStates.Gone; holder.TypeIcon.Visibility = ViewStates.Gone; } else if (type == NativeFeedType.Youtube) { FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.PlayIcon, IonIconsFonts.Play); holder.PlayIcon.Visibility = ViewStates.Visible; FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.TypeIcon, IonIconsFonts.SocialYoutube); holder.TypeIcon.Visibility = ViewStates.Visible; } if (type == NativeFeedType.Video) { if (!string.IsNullOrEmpty(item.MediaSet[0]?.Extra)) { FullGlideRequestBuilder.Load(item.MediaSet[0]?.Extra).Into(holder.Image); } else { var fileName = item.MediaSet[0].File.Split('/').Last(); var fileNameWithoutExtension = fileName.Split('.').First(); item.MediaSet[0].Extra = Methods.Path.FolderDcimImage + "/" + fileNameWithoutExtension + ".png"; var vidoePlaceHolderImage = Methods.MultiMedia.GetMediaFrom_Gallery(Methods.Path.FolderDcimImage, fileNameWithoutExtension + ".png"); if (vidoePlaceHolderImage == "File Dont Exists") { var bitmapImage = Methods.MultiMedia.Retrieve_VideoFrame_AsBitmap(ActivityContext, item.MediaSet[0]?.File); if (bitmapImage != null) { Methods.MultiMedia.Export_Bitmap_As_Image(bitmapImage, fileNameWithoutExtension, Methods.Path.FolderDcimImage); FullGlideRequestBuilder.Load(bitmapImage).Into(holder.Image); } else { Glide.With(ActivityContext) .AsBitmap() .Apply(new RequestOptions().Placeholder(Resource.Drawable.blackdefault).Error(Resource.Drawable.blackdefault)) .Load(item.MediaSet[0]?.File) // or URI/path .Into(holder.Image); //image view to set thumbnail to } } else { FullGlideRequestBuilder.Load(vidoePlaceHolderImage).Into(holder.Image); } } } else { var imageUri = item.MediaSet[0]?.File; if (imageUri != null) { FullGlideRequestBuilder.Load(imageUri).Into(holder.Image); } // GlideImageLoader.LoadImage(ActivityContext, imageUri, holder.Image, ImageStyle.CenterCrop, ImagePlaceholders.Color); } } } } catch (Exception exception) { Console.WriteLine(exception); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Profile); ImageButton back = FindViewById <ImageButton>(Resource.Id.back); //Here is buttons for actions in Profile activity Button logoutButton = FindViewById <Button>(Resource.Id.log_out); Button changepasswordButton = FindViewById <Button>(Resource.Id.change_password); Button editprofileButton = FindViewById <Button>(Resource.Id.edit_profile); TextView log_out_TV = FindViewById <TextView>(Resource.Id.log_out_TV); TextView nameTV = FindViewById <TextView>(Resource.Id.nameTV); string path = "fonts/HelveticaNeueLight.ttf"; Typeface tf = Typeface.CreateFromAsset(Assets, path); logoutButton.Typeface = tf; changepasswordButton.Typeface = tf; editprofileButton.Typeface = tf; log_out_TV.Typeface = tf; nameTV.Typeface = tf; //declaring path for RETRIEVING DATA string dbPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "ormdemo.db3"); var db = new SQLiteConnection(dbPath); var user_table = db.Table <ORM.UsersDataTable>(); var placesOfInterestTable = db.Table <ORM.PlacesOfInterestTable>(); var whishlistTable = db.Table <ORM.Wishlist>(); //var countryTable = db.Table<ORM.CountryTable>(); //declaring path for RETRIEVING DATA ENDED ImageView image = FindViewById <ImageView>(Resource.Id.circleImageView1); //assigning name from the database to textfield for name foreach (var item in user_table) { try { nameTV.Text = item.name; Login.avatar = item.avatar; Glide.With(Application.Context) .Load(item.avatar) .Into(image); } catch { } } changepasswordButton.Click += delegate { StartActivity(typeof(ForgetYourPasswordActivity)); }; back.Click += delegate { OnBackPressed(); }; FindViewById <Button>(Resource.Id.edit_profile).Click += delegate { StartActivity(typeof(RecyclerViewSampl.Activities.EditProfileActivity)); }; FindViewById <Button>(Resource.Id.log_out).Click += delegate { log_out_TV.Visibility = ViewStates.Visible; logoutButton.Visibility = ViewStates.Gone; //clearing lists Activities.Wishlist.wishlistClassForRecycler.Clear(); Activities.MyBookings.myExpListClassForRecycler.Clear(); if (MovieAdapter.moviesStatic != null) { MovieAdapter.moviesStatic.Clear(); } //clearing all existing tables. WE NEED FOR EACH TABLE EACH TRY-CATCH BECAUSE WE MUST NOT MISS ANY TABLE try { dbr.DropUsersTable(); /*foreach (var item in user_table) * { * dbr.RemoveUsersData(item.Id); * }*/ } catch { } try { dbr.DropPlacesOfInterestTable(); /*foreach (var item in placesOfInterestTable) * { * dbr.RemovePlacesOfInterestRecord(item.Id); * }*/ } catch { } try { dbr.DropWishlistTable(); /*foreach (var item in whishlistTable) * { * dbr.RemoveWishlistRecord(item.Id); * }*/ } catch { } /*try * { * dbr.DropCountryTable(); * /*foreach (var item in countryTable) * { * dbr.RemoveCountryRecord(item.Id); * } * } * catch { }*/ //clearing all existing tables ENDED //cleaning variables Tours_detail.titleStatic = ""; RecyclerViewSample.Login.token = ""; RecyclerViewSample.Login.name = ""; RecyclerViewSample.Login.email_ = ""; RecyclerViewSample.Login.user_id = 0; RecyclerViewSample.Login.birth_date = ""; RecyclerViewSample.Login.gender = ""; RecyclerViewSample.Login.phone_num = ""; RecyclerViewSample.Login.interests = ""; RecyclerViewSample.Login.password = ""; RecyclerViewSample.Login.user_country_id = 0; RecyclerViewSample.Login.avatar = null; //cleaning variables ENDED StartActivity(typeof(MainActivity)); }; }