private void Initialize(ArticlesAdapterViewHolder holder, ArticleDataObject item) { try { var colorImage = Color.ParseColor(Methods.FunString.RandomColor()); Glide.With(ActivityContext) .Load(item.Thumbnail) .Apply(RequestOptions.CenterCropTransform().Placeholder(new ColorDrawable(colorImage)).Fallback(new ColorDrawable(colorImage)).SetPriority(Priority.High)) .Into(holder.Image); Glide.With(ActivityContext) .Load(item.Author.Avatar) .Apply(RequestOptions.CircleCropTransform()) .Into(holder.UserImageProfile); holder.Category.SetBackgroundColor(colorImage); CategoriesController cat = new CategoriesController(); string id = item.CategoryLink.Split('/').Last(); holder.Category.Text = cat.Get_Translate_Categories_Communities(id, item.CategoryName, "Blog"); holder.Description.Text = Methods.FunString.DecodeString(item.Description); holder.Title.Text = Methods.FunString.DecodeString(item.Title); holder.Username.Text = WoWonderTools.GetNameFinal(item.Author); holder.ViewMore.Text = ActivityContext.GetText(Resource.String.Lbl_ReadMore) + " >"; //READ MORE > holder.Time.Text = item.Posted; } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { Category_model category_ModelList = modelList[position]; MyViewHolder myViewHolder = holder as MyViewHolder; if (category_ModelList.image != "" || !string.IsNullOrEmpty(category_ModelList.image)) { Glide.With(context) .Load(category_ModelList.image) .Apply(RequestOptions.CircleCropTransform()) .Into(myViewHolder.image); } preferences = context.GetSharedPreferences("lan", FileCreationMode.Private); language = preferences.GetString("language", ""); myViewHolder.title.Text = category_ModelList.title; myViewHolder.mainView.Click += delegate { string getid = modelList[position].cat_id; Intent intent = new Intent(context, typeof(CategoryPage)); intent.PutExtra("cat_id", getid); intent.PutExtra("title", modelList[position].title); intent.PutExtra("image", modelList[position].image); context.StartActivity(intent); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.layout1_image);//.test.layout.activity_main2); string url = "http://img1.dzwww.com:8080/tupian_pl/20150813/16/7858995348613407436.jpg"; ImageView imageView = FindViewById <ImageView>(Resource.Id.imgView); var requestOptions = new RequestOptions(); requestOptions.Placeholder(Resource.Drawable.I5); requestOptions.CenterCrop(); requestOptions.DontAnimate(); //requestOptions.SkipMemoryCache(true); requestOptions.Error(Resource.Drawable.I7); //Glide.With(this).Load(ImageUrl).Apply(requestOptions).Into(imageView); RequestOptions.DiskCacheStrategyOf(DiskCacheStrategy.None);//磁盘缓存 Glide.With(imageView.Context) .Load(url) //.Load(Resource.Drawable.I8) //.PlaceHolder(R.drawable.place_image)//图片加载出来前,显示的图片 //.Error(Resource.Drawable.girl)//图片加载失败后,显示的图片 .Apply(requestOptions) .Apply(RequestOptions.CircleCropTransform()) .Into(imageView); //.Into(imageView); //new GlideDrawableImageViewTarget // Create your application here }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { var book = listBook[position]; BookViewHolder vh = holder as BookViewHolder; Glide.With(contex).Load(book.image).Apply(RequestOptions.CircleCropTransform()).Into(vh.imgBook); vh.title.Text = book.title; vh.subtitle.Text = book.price; vh.setClickListener(this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); var image = FindViewById <ImageView> (Resource.Id.testImage); Glide.With(this) .Load("https://botlist.co/system/BotList/Bot/logos/000/002/271/medium/chuck_norris.jpg") .Apply(RequestOptions.CircleCropTransform().Placeholder(Android.Resource.Drawable.IcMenuCamera)) .Into(image); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { MyViewHolder myViewHolder = holder as MyViewHolder; CartModel cc = cartList[position]; myViewHolder.prodNAme.Text = (cc.getpNAme()); myViewHolder.pDescrptn.Text = (cc.getpDes()); myViewHolder.pQuan.Text = (cc.getpQuan()); myViewHolder.pPrice.Text = (cc.getpPrice()); myViewHolder.pdiscountOff.Text = (cc.getDiscountOff()); myViewHolder.pMrp.Text = (cc.getpMrp()); myViewHolder.pMrp.PaintFlags = (myViewHolder.pMrp.PaintFlags | Android.Graphics.PaintFlags.StrikeThruText); byte[] imageByteArray = Base64.Decode(cc.getpImage(), Base64Flags.Default); Glide.With(context) .Load(imageByteArray) .Apply(RequestOptions.CircleCropTransform()) .Into(myViewHolder.image); double items = double.Parse("0.00"); double price = double.Parse(cartList[position].getpPrice()); myViewHolder.image.Click += delegate { catId = cartList[position].getpId(); catName = cartList[position].getpNAme(); Intent intent = new Intent(context, typeof(ProductDetails)); intent.PutExtra("sId", catId); intent.PutExtra("sName", catName); context.StartActivity(intent); }; myViewHolder.btn_Add.Click += delegate { if (sessionManagement.isLoggedIn()) { updateMultiplyAsync(position, myViewHolder); } else { Toast.MakeText(this.context, "Please login", ToastLength.Short).Show(); } }; myViewHolder.plus.Click += delegate { increaseInteger(myViewHolder); }; myViewHolder.minus.Click += delegate { decreaseInteger(myViewHolder); }; }
// Replace the contents of a view (invoked by the layout manager) public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { var item = items[position]; // Replace the contents of the view with that element var holder = viewHolder as adaptadorsugerenciasViewHolder; Glide.With(contexto) .Load(item.Portrait) .Apply(RequestOptions.CircleCropTransform().SkipMemoryCache(true).Override(60, 60).Placeholder(Resource.Drawable.image)) .Into(holder.imagen); holder.texto.Text = item.Name; }
public override View GetView(int position, View convertView, ViewGroup parent) { if (inflater == null) { inflater = (LayoutInflater)c.GetSystemService(Context.LayoutInflaterService); } if (convertView == null) { convertView = inflater.Inflate(resource, parent, false); } LvHolder holder = new LvHolder(convertView) { NameTxt = { Text = images[position].Name } }; holder.button.Focusable = false; holder.button.FocusableInTouchMode = false; holder.button.Clickable = true; if (images[position].Favorite) { holder.button.SetImageResource(Resource.Drawable.like); } else { holder.button.SetImageResource(Resource.Drawable.dislike); } holder.button.Click += delegate { if (images[position].type == LvEntity.ImgType.IMAGE) { likeImage(position, holder); } else { likeAlbum(position, holder); } }; Glide .With(this.c) .Load(images[position].Link) .Apply(RequestOptions.CircleCropTransform()).Into(holder.Img); convertView.SetBackgroundColor(Constants.lv_Background); return(convertView); }
public UserMessagesAdapter(MessagesBoxActivity context) { try { ActivityContext = context; HasStableIds = true; Options = new RequestOptions().Apply(RequestOptions.CircleCropTransform() .CenterCrop() .SetPriority(Priority.High).Override(200) .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All) .Error(Resource.Drawable.ImagePlacholder) .Placeholder(Resource.Drawable.ImagePlacholder)); } catch (Exception e) { Console.WriteLine(e); } }
public LastMessagesAdapter(Activity context, bool onlineUsers) { try { ActivityContext = context; OnlineUsers = onlineUsers; Options = new RequestOptions().Apply(RequestOptions.CircleCropTransform() .CenterCrop().CircleCrop() .SetPriority(Priority.High).Override(200) .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All) .Error(Resource.Drawable.ImagePlacholder_circle) .Placeholder(Resource.Drawable.ImagePlacholder_circle)); } catch (Exception e) { Console.WriteLine(e); } }
private void SetGalleryThumbnail(Uri uri) { // Reference of the view that holds the gallery thumbnail ImageButton thumbnail = container.FindViewById <ImageButton>(Resource.Id.photo_view_button); // Run the operations in the view's thread thumbnail.Post(() => { // Remove thumbnail padding int padding = (int)Resources.GetDimension(Resource.Dimension.stroke_small); thumbnail.SetPadding(padding, padding, padding, padding); // Load thumbnail into circular button using Glide Glide.With(thumbnail) .Load(uri) .Apply(RequestOptions.CircleCropTransform()) .Into(thumbnail); }); }
protected override async void OnCreate(Bundle savedInstanceState) { mDatabase = FirebaseDatabase.Instance.Reference; tourneyID = Intent.GetStringExtra("tourneyID") ?? "None"; base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.AddTournamentInfo); // Adding Components AutoCompleteTextView tournamentTitleText = FindViewById <AutoCompleteTextView>(Resource.Id.tournamentTitleText); AutoCompleteTextView awardMoney = FindViewById <AutoCompleteTextView>(Resource.Id.awardMoneyText); AutoCompleteTextView participantsLimit = FindViewById <AutoCompleteTextView>(Resource.Id.participantsLimitText); AutoCompleteTextView entryFee = FindViewById <AutoCompleteTextView>(Resource.Id.entryFeeText); AutoCompleteTextView gameTitle = FindViewById <AutoCompleteTextView>(Resource.Id.gameTitleText); AutoCompleteTextView description = FindViewById <AutoCompleteTextView>(Resource.Id.descriptionText); RadioButton knockout = FindViewById <RadioButton>(Resource.Id.knockout); //RadioButton doubleEliminationKnockout = FindViewById<RadioButton>(Resource.Id.doubleEliminationKnockout); Button saveTournamentInfoButton = FindViewById <Button>(Resource.Id.tournamentInfoSaveButton); Button startDateButton = FindViewById <Button>(Resource.Id.startDateButton); Button finishDateButton = FindViewById <Button>(Resource.Id.finishDateButton); ImageView showCase = FindViewById <ImageView>(Resource.Id.tourneyImageShowCase); string showCaseURL = "https://firebasestorage.googleapis.com/v0/b/fir-test-1bdb3.appspot.com/o/ShowCase.png?alt=media&token=f0c6e2e7-e9fc-46e8-a2ad-528ebf778aad"; Glide.With(this).Load(showCaseURL).Apply(RequestOptions.CircleCropTransform()).Into(showCase); // Loading data from DB FirebaseClient firebase = new FirebaseClient("https://fir-test-1bdb3.firebaseio.com/tournaments/"); var items = await firebase .Child("") .OnceAsync <TournamentViewModel>(); foreach (var item in items) { if (item.Key.Equals(tourneyID)) { tournamentTitleText.Text = item.Object.Title ?? ""; startDateButton.Text = item.Object.StartDate ?? "Start Date"; finishDateButton.Text = item.Object.FinishDate ?? "Finish Date"; awardMoney.Text = item.Object.AwardMoney + "" ?? ""; participantsLimit.Text = item.Object.ParticipantsLimit ?? ""; entryFee.Text = item.Object.EntryFee ?? "0"; gameTitle.Text = item.Object.Game ?? ""; description.Text = item.Object.Description ?? ""; //if (item.Object.Format.Equals("Double Elimination Knockout")) //{ // doubleEliminationKnockout.Checked = true; // tourneyFormat = "Double Elimination Knockout"; //} if (item.Object.Format.Equals("Knockout")) { knockout.Checked = true; tourneyFormat = "Knockout"; } break; } } startDateButton.Click += (sender, e) => { DatePickerFragment frag = DatePickerFragment.NewInstance(delegate(DateTime time) { startDateButton.Text = time.ToLongDateString(); }); frag.Show(FragmentManager, DatePickerFragment.TAG); }; finishDateButton.Click += (sender, e) => { DatePickerFragment frag = DatePickerFragment.NewInstance(delegate(DateTime time) { finishDateButton.Text = time.ToLongDateString(); }); frag.Show(FragmentManager, DatePickerFragment.TAG); }; async void RadioButtonClickAsync(object sender, EventArgs e) { RadioButton rb = (RadioButton)sender; tourneyFormat = rb.Text; await mDatabase.Child("tournaments").Child(tourneyID).Child("Format").SetValueAsync(rb.Text); } knockout.Click += RadioButtonClickAsync; //doubleEliminationKnockout.Click += RadioButtonClickAsync; saveTournamentInfoButton.Click += async(sender, e) => { if (gameTitle.Text.Equals(string.Empty) || tournamentTitleText.Equals(string.Empty) || startDateButton.Text.Equals("Start Date") || finishDateButton.Text.Equals("Finish Date") || awardMoney.Equals("")) { Toast.MakeText(ApplicationContext, "Enter data in all fields first", ToastLength.Long).Show(); } else { string titleTemp = tournamentTitleText.Text.Replace(' ', '_'); titleTemp = tournamentTitleText.Text.Replace('-', '_'); titleTemp = tournamentTitleText.Text.Replace('.', '_'); await mDatabase.Child("tournaments").Child(tourneyID).Child("Title").SetValueAsync(titleTemp); await mDatabase.Child("tournaments").Child(tourneyID).Child("StartDate").SetValueAsync(startDateButton.Text); await mDatabase.Child("tournaments").Child(tourneyID).Child("FinishDate").SetValueAsync(finishDateButton.Text); await mDatabase.Child("tournaments").Child(tourneyID).Child("AwardMoney").SetValueAsync(awardMoney.Text); await mDatabase.Child("tournaments").Child(tourneyID).Child("Game").SetValueAsync(gameTitle.Text.ToUpper()); await mDatabase.Child("tournaments").Child(tourneyID).Child("Description").SetValueAsync(description.Text); // Inserting Participants limit if it meets certain conditions int limit; bool result = int.TryParse(participantsLimit.Text, out limit); if (result) { if (limit > 3 && limit < 33) { await mDatabase.Child("tournaments").Child(tourneyID).Child("ParticipantsLimit").SetValueAsync(participantsLimit.Text); } else { await mDatabase.Child("tournaments").Child(tourneyID).Child("ParticipantsLimit").SetValueAsync("6"); Toast.MakeText(ApplicationContext, "Limit should be above 3 or less than 33, so set to 6", ToastLength.Long).Show(); } } // ELSE statement if number is not correct then set it to 6 by default else { await mDatabase.Child("tournaments").Child(tourneyID).Child("ParticipantsLimit").SetValueAsync("6"); Toast.MakeText(ApplicationContext, "Invalid participants limit, set to 6 automatically", ToastLength.Long).Show(); } // Checking and inserting the entry fee int entryFeeNumber; result = int.TryParse(entryFee.Text, out entryFeeNumber); if (result) { if (entryFeeNumber == 0) { await mDatabase.Child("tournaments").Child(tourneyID).Child("EntryFee").SetValueAsync(entryFee.Text); await mDatabase.Child("tournaments").Child(tourneyID).Child("Paid").SetValueAsync("false"); } else { await mDatabase.Child("tournaments").Child(tourneyID).Child("EntryFee").SetValueAsync(entryFee.Text); await mDatabase.Child("tournaments").Child(tourneyID).Child("Paid").SetValueAsync("true"); } } else { await mDatabase.Child("tournaments").Child(tourneyID).Child("EntryFee").SetValueAsync("0"); await mDatabase.Child("tournaments").Child(tourneyID).Child("Paid").SetValueAsync("false"); Toast.MakeText(ApplicationContext, "Entered Entry Fee number was invalid so it is set to 0 and Free", ToastLength.Long).Show(); } // Going back to Tournament Main page Intent addTournamentActivity = new Intent(Application.Context, typeof(AddTournamentActivity)); addTournamentActivity.PutExtra("tourneyID", tourneyID); StartActivity(addTournamentActivity); Finish(); } }; }
private static RequestOptions GetOptions(ImageStyle style, ImagePlaceholders imagePlaceholders) { try { RequestOptions options = new RequestOptions(); switch (style) { case ImageStyle.CenterCrop: options = new RequestOptions().Apply(RequestOptions.CenterCropTransform() .CenterCrop() .SetPriority(Priority.High) .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All) .Error(Resource.Drawable.ImagePlacholder) .Placeholder(Resource.Drawable.ImagePlacholder)); break; case ImageStyle.FitCenter: options = new RequestOptions().Apply(RequestOptions.CenterCropTransform() .CenterCrop().FitCenter() .SetPriority(Priority.High) .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All) .Error(Resource.Drawable.ImagePlacholder) .Placeholder(Resource.Drawable.ImagePlacholder)); break; case ImageStyle.CircleCrop: options = new RequestOptions().Apply(RequestOptions.CircleCropTransform() .CenterCrop().CircleCrop() .SetPriority(Priority.High) .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All) .Error(Resource.Drawable.ImagePlacholder_circle) .Placeholder(Resource.Drawable.ImagePlacholder_circle)); break; case ImageStyle.RoundedCrop: options = new RequestOptions().Apply(RequestOptions.CircleCropTransform() .CenterCrop() .Transform(new MultiTransformation(new CenterCrop(), new RoundedCorners(20))) .SetPriority(Priority.High) .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All) .Error(Resource.Drawable.ImagePlacholder_circle) .Placeholder(Resource.Drawable.ImagePlacholder_circle)); break; default: options.CenterCrop() .SetPriority(Priority.High) .SetUseAnimationPool(false).SetDiskCacheStrategy(DiskCacheStrategy.All) .Error(Resource.Drawable.ImagePlacholder) .Placeholder(Resource.Drawable.ImagePlacholder); break; } switch (imagePlaceholders) { case ImagePlaceholders.Color: var color = Methods.FunString.RandomColor(); options.Placeholder(new ColorDrawable(Color.ParseColor(color))).Fallback(new ColorDrawable(Color.ParseColor(color))); break; case ImagePlaceholders.Drawable: switch (style) { case ImageStyle.CircleCrop: options.Placeholder(Resource.Drawable.ImagePlacholder_circle).Fallback(Resource.Drawable.ImagePlacholder_circle); break; default: options.Placeholder(Resource.Drawable.ImagePlacholder).Fallback(Resource.Drawable.ImagePlacholder); break; } break; } return(options); } catch (Exception e) { Console.WriteLine(e); return(new RequestOptions().CenterCrop()); } }
public override View GetView(int position, View convertView, ViewGroup parent) { int placeholder = 0; adaptadorlistaremotoViewHolder holder = null; if (newplaceholder != 0) { placeholder = newplaceholder; } else { placeholder = Resource.Drawable.image; } if (convertView != null) { holder = convertView.Tag as adaptadorlistaremotoViewHolder; } if (holder == null) { holder = new adaptadorlistaremotoViewHolder(); var inflater = context.GetSystemService(Context.LayoutInflaterService).JavaCast <LayoutInflater>(); //replace with your item and your holder items //comment back in convertView = inflater.Inflate(Resource.Layout.layoutlistaplayerindependiente, parent, false); holder.Title = convertView.FindViewById <TextView>(Resource.Id.textView1); holder.portrait = convertView.FindViewById <ImageView>(Resource.Id.imageView1); // view.SetBackgroundResource(Resource.Drawable.drwaablegris); convertView.Tag = holder; /* if (links.Contains("")) * { * links.Remove(""); * }*/ holder.portrait.SetTag(Resource.Id.imageView1, links[position]); if (linkactual == null || linkactual.Trim() == "") { if (links[position].Trim() != "") { Glide.With(context) .Load("http://i.ytimg.com/vi/" + links[position].Split('=')[1] + "/mqdefault.jpg") .Apply(RequestOptions.CircleCropTransform().Placeholder(placeholder)) .Into(holder.portrait); } else { Glide.With(context) .Load("") .Apply(RequestOptions.CircleCropTransform().Placeholder(placeholder)) .Into(holder.portrait); } } else { if (linkactual.Split('=')[1] == links[position].Split('=')[1]) { Glide.With(context) .Load("https://raw.githubusercontent.com/Gr3gorywolf/Multitube.android/master/Updates/playinganimation.gif") .Apply(RequestOptions.NoTransformation().Placeholder(placeholder)) .Into(holder.portrait); } else { Glide.With(context) .Load("http://i.ytimg.com/vi/" + links[position].Split('=')[1] + "/mqdefault.jpg") .Apply(RequestOptions.CircleCropTransform().Placeholder(placeholder)) .Into(holder.portrait); } } } // Console.WriteLine(linkactual + ">>>" + links[position]); if (holder.portrait.GetTag(Resource.Id.imageView1).ToString() != links[position]) { try { if (linkactual == null || linkactual.Trim() == "") { if (links[position].Trim() != "") { Glide.With(context) .Load("http://i.ytimg.com/vi/" + links[position].Split('=')[1] + "/mqdefault.jpg") .Apply(RequestOptions.CircleCropTransform().Placeholder(placeholder)) .Into(holder.portrait); } else { Glide.With(context) .Load("") .Apply(RequestOptions.CircleCropTransform().Placeholder(placeholder)) .Into(holder.portrait); } } else { if (linkactual.Split('=')[1] == links[position].Split('=')[1]) { Glide.With(context) .Load("https://raw.githubusercontent.com/Gr3gorywolf/Multitube.android/master/Updates/playinganimation.gif") .Apply(RequestOptions.NoTransformation().Placeholder(placeholder)) .Into(holder.portrait); } else { Glide.With(context) .Load("http://i.ytimg.com/vi/" + links[position].Split('=')[1] + "/mqdefault.jpg") .Apply(RequestOptions.CircleCropTransform().Placeholder(placeholder)) .Into(holder.portrait); } } } catch (Exception) { } } holder.Title.Text = nombres[position].Replace(">", "").Replace("<", ""); // holder.animar3((View)convertView); holder.portrait.SetTag(Resource.Id.imageView1, links[position]); //fill in your items //holder.Title.Text = "new text here"; /// clasesettings.recogerbasura(); return(convertView); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var imgTest = FindViewById <ImageView>(Resource.Id.imgTest); Glide.With(this).Load("https://scontent.fhan2-3.fna.fbcdn.net/v/t1.0-9/21231281_1462647560478655_5948244291370274738_n.jpg?oh=44119c06d2babac9abaa9b45fa6620d3&oe=5A4581D3").Apply(RequestOptions.CircleCropTransform()).Into(imgTest); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ViewSocialFeed); auth = FirebaseAuth.GetInstance(MainActivity.app); // Adding views Button timeStamp = FindViewById <Button>(Resource.Id.timeStampSocialFeed); ImageView profilePicture = FindViewById <ImageView>(Resource.Id.profilePictureSocialFeed); Button name = FindViewById <Button>(Resource.Id.nameSocialFeed); Button postBody = FindViewById <Button>(Resource.Id.SocialFeedPostBody); Button commentBody = FindViewById <Button>(Resource.Id.SocialFeedCommentBody); Button next = FindViewById <Button>(Resource.Id.nextPost); Button previous = FindViewById <Button>(Resource.Id.previousPost); EditText commentText = FindViewById <EditText>(Resource.Id.CommentBodySocialFeed); Button reply = FindViewById <Button>(Resource.Id.commentButton); circular_progress = FindViewById <ProgressBar>(Resource.Id.circularProgressSocialFeed); timeStamp.Enabled = false; name.Enabled = false; postBody.Enabled = false; commentBody.Enabled = false; circular_progress.Visibility = ViewStates.Visible; // Loading Social Posts from DB var firebase = new FirebaseClient("https://fir-test-1bdb3.firebaseio.com/"); var query = await firebase .Child("socialPosts") .OnceAsync <SocialPostViewModel>(); //query.Reverse(); List <SocialPostViewModel> posts = new List <SocialPostViewModel>(); foreach (var item in query) { posts.Add(item.Object); } posts.Reverse(); // Loading users' data to get profile pictures var users = await firebase.Child("users").OnceAsync <UserViewModel>(); // Getting comments from DB firebase = new FirebaseClient("https://fir-test-1bdb3.firebaseio.com/"); var comments = await firebase .Child("comments") .OnceAsync <CommentViewModel>(); //comments.Reverse(); List <CommentViewModel> commentsList = new List <CommentViewModel>(); foreach (var item in comments) { commentsList.Add(item.Object); } int postNumber = 0; // To keep track // Loading first post into views timeStamp.Text = posts[postNumber].TimeStamp; //name.Text = posts[postNumber].Email; foreach (var item in users) { if (item.Object.Email.Equals(posts[postNumber].Email)) { if (!item.Object.PhotoURL.Equals(string.Empty)) { Glide.With(this).Load(item.Object.PhotoURL).Apply(RequestOptions.CircleCropTransform()).Into(profilePicture); } name.Text = item.Object.FirstName + " " + item.Object.LastName ?? ""; } } postBody.Text = posts[postNumber].Body; string commentTextTemp = "Comments:\n"; int commentCounter = 0; // Filtering foreach (var item in commentsList) { if (item.SocialPostID.Equals(posts[postNumber].SocialPostID)) { commentCounter++; commentTextTemp += "\n" + item.Email + ":\n" + " - " + item.Body + "\n"; } } // Done getting comments if (commentCounter > 0) { commentBody.Text = commentTextTemp; } else { commentBody.Text += "\nNo Comments Yet"; } circular_progress.Visibility = ViewStates.Invisible; next.Click += (sender, e) => { if (query.Count() - 1 == postNumber) { // No new posts Toast.MakeText(ApplicationContext, "No more posts", ToastLength.Short).Show(); } else { circular_progress.Visibility = ViewStates.Visible; postNumber++; timeStamp.Text = posts[postNumber].TimeStamp; //name.Text = posts[postNumber].Email; foreach (var item in users) { if (item.Object.Email.Equals(posts[postNumber].Email)) { if (!item.Object.PhotoURL.Equals(string.Empty)) { Glide.With(this).Load(item.Object.PhotoURL).Apply(RequestOptions.CircleCropTransform()).Into(profilePicture); } name.Text = item.Object.FirstName + " " + item.Object.LastName ?? ""; } } postBody.Text = posts[postNumber].Body; commentTextTemp = "Comments:\n"; commentCounter = 0; // Filtering foreach (var item in commentsList) { if (item.SocialPostID.Equals(posts[postNumber].SocialPostID)) { commentCounter++; commentTextTemp += "\n" + item.Email + ":\n" + " - " + item.Body + "\n"; } } // Done getting comments if (commentCounter > 0) { commentBody.Text = commentTextTemp; } else { commentBody.Text = "Comments:\n"; commentBody.Text += "\nNo Comments Yet"; } circular_progress.Visibility = ViewStates.Invisible; } }; previous.Click += (sender, e) => { if (0 == postNumber) { // No new posts Toast.MakeText(ApplicationContext, "No more posts", ToastLength.Short).Show(); } else { circular_progress.Visibility = ViewStates.Visible; postNumber--; timeStamp.Text = posts[postNumber].TimeStamp; name.Text = posts[postNumber].Email; foreach (var item in users) { if (item.Object.Email.Equals(posts[postNumber].Email)) { if (!item.Object.PhotoURL.Equals(string.Empty)) { Glide.With(this).Load(item.Object.PhotoURL).Apply(RequestOptions.CircleCropTransform()).Into(profilePicture); } name.Text = item.Object.FirstName + " " + item.Object.LastName ?? ""; } } postBody.Text = posts[postNumber].Body; commentTextTemp = "Comments:\n"; commentCounter = 0; // Filtering foreach (var item in commentsList) { if (item.SocialPostID.Equals(posts[postNumber].SocialPostID)) { commentCounter++; commentTextTemp += "\n" + item.Email + ":\n" + " - " + item.Body + "\n"; } } // Done getting comments if (commentCounter > 0) { commentBody.Text = commentTextTemp; } else { commentBody.Text = "Comments:\n"; commentBody.Text += "\nNo Comments Yet"; } circular_progress.Visibility = ViewStates.Invisible; } }; reply.Click += async(sender, e) => { if (commentText.Text != String.Empty) { firebase = new FirebaseClient("https://fir-test-1bdb3.firebaseio.com/"); var item = await firebase.Child("comments") .PostAsync <CommentViewModel>(new CommentViewModel { Email = auth.CurrentUser.Email, Body = commentText.Text.Trim(), SocialPostID = posts[postNumber].SocialPostID }); commentText.Text = ""; Toast.MakeText(ApplicationContext, "Published", ToastLength.Short).Show(); } else { Toast.MakeText(ApplicationContext, "Enter a comment first", ToastLength.Long).Show(); } }; }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ViewOfflineTournaments); // Adding views circular_progress = FindViewById <ProgressBar>(Resource.Id.circularProgressOfflineTournaments); Button gameTitle = FindViewById <Button>(Resource.Id.gameTitleOffline); ImageView profilePicture = FindViewById <ImageView>(Resource.Id.profilePictureOfflineTournament); Button adminName = FindViewById <Button>(Resource.Id.AdminNameOfflineTournament); Button tourneyTitle = FindViewById <Button>(Resource.Id.TitleOfflineTournament); Button registrationStatus = FindViewById <Button>(Resource.Id.LiveStatusOfflineTournament); Button finishedStatus = FindViewById <Button>(Resource.Id.FinishedStatusOfflineTournament); Button description = FindViewById <Button>(Resource.Id.DescriptionOfflineTournament); Button previous = FindViewById <Button>(Resource.Id.previousTourneyOffline); Button next = FindViewById <Button>(Resource.Id.nextTourneyOffline); Button eventPageButton = FindViewById <Button>(Resource.Id.ViewEventPageButtonOfflineTournament); circular_progress.Visibility = ViewStates.Visible; eventPageButton.Enabled = false; // Loading tournaments var firebase = new FirebaseClient("https://fir-test-1bdb3.firebaseio.com/"); var items = await firebase .Child("tournaments") .OnceAsync <TournamentViewModel>(); List <TournamentViewModel> query = new List <TournamentViewModel>(); // Filtering foreach (var item in items) { if (item.Object.online.Equals("false")) { query.Add(item.Object); } } query.Reverse(); // Loading users' data to get profile pictures var users = await firebase.Child("users").OnceAsync <UserViewModel>(); // Loading first item int tourneyCounter = 0; // To keep track of opened tournament gameTitle.Text = query[0].Game; foreach (var item in users) { if (item.Object.Email.Equals(query[tourneyCounter].AdminID)) { if (!item.Object.PhotoURL.Equals(string.Empty)) { Glide.With(this).Load(item.Object.PhotoURL).Apply(RequestOptions.CircleCropTransform()).Into(profilePicture); } adminName.Text = item.Object.FirstName + " " + item.Object.LastName ?? ""; } } tourneyTitle.Text = query[0].Title; if (query[0].Live.Equals("false")) { registrationStatus.Text = "Registrations Open!"; } else { registrationStatus.Text = "Registrations Closed!"; } if (query[0].Finished.Equals("true")) { finishedStatus.Text = "Tournament is Over.."; } else { finishedStatus.Text = "Tournament is still going on!"; } description.Text = "Description:\n\n" + query[0].Description; eventPageButton.Enabled = true; circular_progress.Visibility = ViewStates.Invisible; next.Click += (sender, e) => { if (query.Count() - 1 == tourneyCounter) { // No new Tournaments Toast.MakeText(ApplicationContext, "No more tournaments", ToastLength.Short).Show(); } else { tourneyCounter++; gameTitle.Text = query[tourneyCounter].Game; foreach (var item in users) { if (item.Object.Email.Equals(query[tourneyCounter].AdminID)) { if (!item.Object.PhotoURL.Equals(string.Empty)) { Glide.With(this).Load(item.Object.PhotoURL).Apply(RequestOptions.CircleCropTransform()).Into(profilePicture); } adminName.Text = item.Object.FirstName + " " + item.Object.LastName ?? ""; } } tourneyTitle.Text = query[tourneyCounter].Title; if (query[tourneyCounter].Live.Equals("false")) { registrationStatus.Text = "Registrations Open!"; } else { registrationStatus.Text = "Registrations Closed!"; } if (query[tourneyCounter].Finished.Equals("true")) { finishedStatus.Text = "Tournament is Over.."; } else { finishedStatus.Text = "Tournament is still going on!"; } description.Text = "Description:\n\n" + query[tourneyCounter].Description; } }; previous.Click += (sender, e) => { if (0 == tourneyCounter) { // No new Tournaments Toast.MakeText(ApplicationContext, "No more tournaments", ToastLength.Short).Show(); } else { tourneyCounter--; gameTitle.Text = query[0].Game; foreach (var item in users) { if (item.Object.Email.Equals(query[tourneyCounter].AdminID)) { if (!item.Object.PhotoURL.Equals(string.Empty)) { Glide.With(this).Load(item.Object.PhotoURL).Apply(RequestOptions.CircleCropTransform()).Into(profilePicture); } adminName.Text = item.Object.FirstName + " " + item.Object.LastName ?? ""; } } tourneyTitle.Text = query[tourneyCounter].Title; if (query[tourneyCounter].Live.Equals("false")) { registrationStatus.Text = "Registrations Open!"; } else { registrationStatus.Text = "Registrations Closed!"; } if (query[tourneyCounter].Finished.Equals("true")) { finishedStatus.Text = "Tournament is Over.."; } else { finishedStatus.Text = "Tournament is still going on!"; } description.Text = "Description:\n\n" + query[tourneyCounter].Description; } }; eventPageButton.Click += (sender, e) => { Intent viewEventPageActivity = new Intent(ApplicationContext, typeof(ViewEventPageActivity)); viewEventPageActivity.PutExtra("tourneyID", query[tourneyCounter].TournamentID); StartActivity(viewEventPageActivity); }; /* * string[] events = new string[query.Count()]; * * for (int i = 0; i < query.Count(); i++) * { * events[i] = query.ToList().ElementAt(i).Title + "\n Tournament ID - " + query.ToList().ElementAt(i).TournamentID; * } * ListAdapter = new ArrayAdapter<string>(this, Resource.Layout.ViewOfflineTournaments, events); * * ListView.ItemClick += (sender, e) => * { * string tourneyID = string.Empty; * tourneyID = ((TextView)e.View).Text; * string[] temps = tourneyID.Split(' '); * tourneyID = temps[temps.Length - 1]; * Intent viewEventPageActivity = new Intent(ApplicationContext, typeof(ViewEventPageActivity)); * viewEventPageActivity.PutExtra("tourneyID", tourneyID); * StartActivity(viewEventPageActivity); * }; */ }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { MyViewHolder myViewHolder = holder as MyViewHolder; StoreCart map = new StoreCart(); map = list[position]; byte[] imageByteArray = map.ItemImage != null?Base64.Decode(map.ItemImage, Base64Flags.Default) : null; myViewHolder.prodNAme.Text = map.ItemMastId; string items = map.Quantity.ToString(); string sprice = map.SelRate.ToString("0.##"); myViewHolder.price = float.Parse(sprice); myViewHolder.pPrice.Text = "" + (decimal.Parse(sprice) * decimal.Parse(items)).ToString("0.##"); var totalAmount = (from data in list select data).Sum(x => x.SelRate * x.Quantity); CartFragment.tv_total.Text = activity.Resources.GetString(Resource.String.currency) + " " + totalAmount.ToString("0.##"); myViewHolder.txtQuan.Text = items.ToString(); myViewHolder.minteger = float.Parse(items); myViewHolder.pQuan.Text = map.Quantity.ToString(); myViewHolder.pMrp.Visibility = ViewStates.Gone; myViewHolder.pMrp.Text = ""; myViewHolder.pMrp.PaintFlags = (myViewHolder.pMrp.PaintFlags | Android.Graphics.PaintFlags.StrikeThruText); myViewHolder.btn_Add.Click += delegate { myViewHolder.btn_Add.Visibility = ViewStates.Gone; myViewHolder.ll_addQuan.Visibility = ViewStates.Visible; float items = map.Quantity; float price = float.Parse(sprice); double reward = double.Parse("0.00"); myViewHolder.pPrice.Text = "" + price * items; updateintent(); }; myViewHolder.txt_close.Click += async delegate { if (list.Count > 0) { var itemMasterId = list[position].ID; var deleteURI = BaseURL.DeleteCartItem + itemMasterId; using (var client = new HttpClient()) { StringContent content = new StringContent(""); var response = await client.PostAsync(deleteURI, content); if (response.StatusCode == HttpStatusCode.OK) { Toast.MakeText(activity, "Delete successfully", ToastLength.Short); } } list.RemoveAt(position); } var totalAmount = (from data in list select data).Sum(x => x.SelRate * x.Quantity); CartFragment.tv_total.Text = activity.Resources.GetString(Resource.String.currency) + " " + totalAmount; if (list.Count == 0) { CartFragment.noData.Visibility = ViewStates.Visible; CartFragment.viewCart.Visibility = ViewStates.Gone; } CartFragment.totalItems.Text = "" + list.Count() + " Total Items:"; NotifyDataSetChanged(); updateintent(); }; myViewHolder.plus.Click += delegate { increaseInteger(myViewHolder); updateMultiply(myViewHolder, map); }; myViewHolder.minus.Click += delegate { decreaseInteger(myViewHolder); updateMultiply(myViewHolder, map); }; Glide.With(activity) .Load(imageByteArray) .Apply(RequestOptions.CircleCropTransform()) .Into(myViewHolder.image); }
public GenresAdapter(Activity context) { try { ActivityContext = context; HasStableIds = true; var glideRequestOptions = new RequestOptions().SetDiskCacheStrategy(DiskCacheStrategy.All).SetPriority(Priority.High).Apply(RequestOptions.CircleCropTransform().CenterCrop().CircleCrop()); FullGlideRequestBuilder = Glide.With(context).AsBitmap().Apply(glideRequestOptions).Transition(new BitmapTransitionOptions().CrossFade(100)); } catch (Exception e) { Console.WriteLine(e); } }
protected override async void OnCreate(Bundle savedInstanceState) { string tourneyID = Intent.GetStringExtra("tourneyID") ?? "None"; auth = FirebaseAuth.GetInstance(MainActivity.app); mDatabase = FirebaseDatabase.Instance.Reference; base.OnCreate(savedInstanceState); // Loading tournaments var firebase = new FirebaseClient("https://fir-test-1bdb3.firebaseio.com/"); var items = await firebase .Child("tournaments") .OnceAsync <TournamentViewModel>(); foreach (var item in items) { if (item.Object.TournamentID.Equals(tourneyID)) { query = item.Object; break; } } SetContentView(Resource.Layout.ViewEventPage); // Adding Components TextView title = FindViewById <TextView>(Resource.Id.tournamentTitle); TextView startDate = FindViewById <TextView>(Resource.Id.startDateTitle); TextView finishDate = FindViewById <TextView>(Resource.Id.finishDateTitle); TextView awardMoney = FindViewById <TextView>(Resource.Id.awardMoneyTitle); TextView format = FindViewById <TextView>(Resource.Id.formatTitle); Button location = FindViewById <Button>(Resource.Id.location); Button adminProfile = FindViewById <Button>(Resource.Id.adminProfileView); Button register = FindViewById <Button>(Resource.Id.register); Button edit = FindViewById <Button>(Resource.Id.edit); Button bracketURL = FindViewById <Button>(Resource.Id.bracketLink); Button updateResult = FindViewById <Button>(Resource.Id.updateResult); Button searchOpponent = FindViewById <Button>(Resource.Id.searchOpponentButton); Button endTournament = FindViewById <Button>(Resource.Id.finishTournament); AutoCompleteTextView matchNumber = FindViewById <AutoCompleteTextView>(Resource.Id.MatchNumberText); AutoCompleteTextView matchWinner = FindViewById <AutoCompleteTextView>(Resource.Id.matchWinnerText); AutoCompleteTextView searchOpponentText = FindViewById <AutoCompleteTextView>(Resource.Id.searchOpponent); ImageView showCase = FindViewById <ImageView>(Resource.Id.tourneyImageShowCaseEventPage); string showCaseURL = "https://firebasestorage.googleapis.com/v0/b/fir-test-1bdb3.appspot.com/o/ShowCase.png?alt=media&token=f0c6e2e7-e9fc-46e8-a2ad-528ebf778aad"; Glide.With(this).Load(showCaseURL).Apply(RequestOptions.CircleCropTransform()).Into(showCase); if (MainActivity.decision.Equals("Login as Admin")) { register.Enabled = false; } if (query.Finished.Equals("true")) { matchNumber.Enabled = false; matchWinner.Enabled = false; updateResult.Enabled = false; } if (!query.AdminID.Equals(auth.CurrentUser.Email)) { edit.Enabled = false; matchNumber.Enabled = false; matchWinner.Enabled = false; updateResult.Enabled = false; endTournament.Enabled = false; } if (query.online.Equals("true")) { location.Enabled = false; } if (query.Live.Equals("false")) { bracketURL.Enabled = false; matchNumber.Enabled = false; matchWinner.Enabled = false; updateResult.Enabled = false; } else { register.Enabled = false; } if (query.Paid.Equals("false")) { register.Text = "Register for Free"; } else { register.Text = "Register for " + query.EntryFee + "¢"; } title.Text = query.Title ?? ""; startDate.Text = query.StartDate ?? ""; finishDate.Text = query.FinishDate ?? ""; awardMoney.Text = query.AwardMoney + "" ?? ""; format.Text = query.Format ?? ""; endTournament.Click += async(sender, e) => { if (query.Finished.Equals("true")) { Toast.MakeText(ApplicationContext, "Tournament is already Over!", ToastLength.Short).Show(); } else { if (query.Live.Equals("true")) { await mDatabase.Child("tournaments").Child(tourneyID).Child("Finished").SetValueAsync("true"); Toast.MakeText(ApplicationContext, "Tournament Ended", ToastLength.Short).Show(); } else { Toast.MakeText(ApplicationContext, "You cannot end a tournament before it goes live!", ToastLength.Short).Show(); } } }; searchOpponent.Click += async(sender, e) => { // Loading users' data for searching var users = await firebase.Child("users").OnceAsync <UserViewModel>(); bool found = false; string userID = ""; foreach (var user in users) { if (user.Object.Email.Equals(searchOpponentText.Text.Trim().ToLower())) { found = true; userID = user.Object.Email; break; } } if (found) { Intent viewProfileActivity = new Intent(Application.Context, typeof(ViewProfileActivity)); viewProfileActivity.PutExtra("toEmail", userID); // Recipient email HomeActivity.fromHome = false; StartActivity(viewProfileActivity); } else { Toast.MakeText(ApplicationContext, "Invalid user", ToastLength.Short).Show(); } }; updateResult.Click += async(sender, e) => { int spo; bool validInputs = false; // Getting user input values int matchNo; bool result = int.TryParse(matchNumber.Text, out matchNo); int playerNo; bool result2 = int.TryParse(matchWinner.Text, out playerNo); if (result && result2) { string url = "https://api.challonge.com/v1/tournaments/" + query.BracketID + "/matches.json?api_key=nzFuvS0FNlSVr7KWKdTpoCqP4EXhPAlyMccTfIyy"; // Create an HTTP web request using the URL: HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(url)); request.ContentType = "application/json"; request.Method = "GET"; request.Timeout = 20200000; // Send the request to the server and wait for the response: using (WebResponse response = await request.GetResponseAsync()) { // Get a stream representation of the HTTP web response: using (Stream stream = response.GetResponseStream()) { // Use this stream to build a JSON document object: JsonValue jsonDoc = await Task.Run(() => JsonObject.Load(stream)); foreach (JsonValue abc in jsonDoc) { JsonValue match = abc["match"]; spo = match["suggested_play_order"]; if (spo == matchNo) { id = match["id"]; validInputs = true; if (playerNo == 1) { matchWinnerID = match["player1_id"]; matchScore = "1-0"; } else if (playerNo == 2) { matchWinnerID = match["player2_id"]; matchScore = "0-1"; } else { validInputs = false; } break; } } } } // Now updating the result of that particular match if (validInputs) { url = "https://api.challonge.com/v1/tournaments/" + query.BracketID + "/matches/" + id + ".json?api_key=nzFuvS0FNlSVr7KWKdTpoCqP4EXhPAlyMccTfIyy&match[winner_id]=" + matchWinnerID + "&match[scores_csv]=" + matchScore; // Create an HTTP web request using the URL: request = (HttpWebRequest)HttpWebRequest.Create(new Uri(url)); request.ContentType = "application/json"; request.Method = "PUT"; request.ContentLength = 0; request.Timeout = 20200000; // Send the request to the server and wait for the response: using (WebResponse response = await request.GetResponseAsync()) { // Get a stream representation of the HTTP web response: using (Stream stream = response.GetResponseStream()) { // Use this stream to build a JSON document object: JsonValue jsonDoc = await Task.Run(() => JsonObject.Load(stream)); Console.Out.WriteLine("Response: {0}", jsonDoc.ToString()); } } } else { Toast.MakeText(ApplicationContext, "Either Match number or Player number is not valid. Try again.", ToastLength.Long).Show(); } } else { Toast.MakeText(ApplicationContext, "Match Number and Player number must be whole numbers", ToastLength.Long).Show(); } }; bracketURL.Click += (sender, e) => { Intent viewBracket = new Intent(Application.Context, typeof(ViewTournamentBracketActivity)); viewBracket.PutExtra("url", query.BracketURL); StartActivity(viewBracket); }; edit.Click += (sender, e) => { Intent editTournament = new Intent(Application.Context, typeof(AddTournamentActivity)); editTournament.PutExtra("tourneyID", tourneyID); StartActivity(editTournament); }; location.Click += (sender, e) => { Intent viewTournamentLocation = new Intent(Application.Context, typeof(ViewTournamentLocationActivity)); viewTournamentLocation.PutExtra("coords", query.Location); StartActivity(viewTournamentLocation); }; adminProfile.Click += (sender, e) => { Intent viewProfileActivity = new Intent(Application.Context, typeof(ViewProfileActivity)); viewProfileActivity.PutExtra("toEmail", query.AdminID); // Recipient email HomeActivity.fromHome = false; StartActivity(viewProfileActivity); }; register.Click += async(sender, e) => { string temp = query.Participants; string entryFee = query.EntryFee; // Temp change here from null to "" if (temp == null) { if (query.Paid.Equals("false")) { temp = ""; temp += auth.CurrentUser.Email; await mDatabase.Child("tournaments").Child(tourneyID).Child("Participants").SetValueAsync(temp); Toast.MakeText(ApplicationContext, "Registered", ToastLength.Long).Show(); } else { // Render the view from the type generated from RazorView.cshtml var model = new PaymentSendModel() { TournamentID = tourneyID, EntryFee = entryFee, NewParticipant = "true", Participants = "none", PlayerEmail = auth.CurrentUser.Email }; //string query = "?tourneyID=" + tourneyID + "&entryFee=" + entryFee + "&NewParticipant=true&PlayerEmail=" + auth.CurrentUser.Email; var template = new PaymentSendRazorView() { Model = model }; var page = template.GenerateString(); // Load the rendered HTML into the view with a base URL // that points to the root of the bundled Assets folder // It is done in another activity Intent makePaymentActivity = new Intent(Application.Context, typeof(MakePaymentActivity)); makePaymentActivity.PutExtra("page", page); StartActivity(makePaymentActivity); } } else { bool registered = false; string[] temps = temp.Split(','); if (temps.Count() == int.Parse(query.ParticipantsLimit)) { Toast.MakeText(ApplicationContext, "Registration is full!", ToastLength.Long).Show(); } else { foreach (string item in temps) { if (item.Equals(auth.CurrentUser.Email)) { registered = true; Toast.MakeText(ApplicationContext, "Already Registered", ToastLength.Long).Show(); break; } } if (!registered) { if (query.Paid.Equals("false")) { temp += "," + auth.CurrentUser.Email; await mDatabase.Child("tournaments").Child(tourneyID).Child("Participants").SetValueAsync(temp); Toast.MakeText(ApplicationContext, "Registered", ToastLength.Long).Show(); } else { // Render the view from the type generated from RazorView.cshtml var model = new PaymentSendModel() { TournamentID = tourneyID, EntryFee = entryFee, NewParticipant = "false", Participants = temp, PlayerEmail = auth.CurrentUser.Email }; //string query = "?tourneyID=" + tourneyID + "&entryFee=" + entryFee + "&NewParticipant=true&PlayerEmail=" + auth.CurrentUser.Email; var template = new PaymentSendRazorView() { Model = model }; var page = template.GenerateString(); // Load the rendered HTML into the view with a base URL // that points to the root of the bundled Assets folder // It is done in another activity Intent makePaymentActivity = new Intent(Application.Context, typeof(MakePaymentActivity)); makePaymentActivity.PutExtra("page", page); StartActivity(makePaymentActivity); } } } } /* * if (query.Participants == null) * query.Participants = ""; * * query.Participants += test + ","; * db.Update(query); * query = (from s in db.Table<TournamentViewModel>() * where s.TournamentID == tourneyID * select s).FirstOrDefault(); * * Intent viewTournamentsActivity = new Intent(Application.Context, typeof(ViewTournamentsActivity)); * viewTournamentsActivity.PutExtra("email", test); * viewTournamentsActivity.PutExtra("userType", userType); * StartActivity(viewTournamentsActivity); * Toast.MakeText(ApplicationContext, "Registered", ToastLength.Long).Show(); */ }; }
public override View GetView(int position, View convertView, ViewGroup parent) { var view = convertView; adapterlistaofflineViewHolder holder = null; int indexdefinitivo = todoslosnombres.IndexOf(nombres[position]); if (view != null) { holder = view.Tag as adapterlistaofflineViewHolder; } if (holder == null) { holder = new adapterlistaofflineViewHolder(); var inflater = context.GetSystemService(Context.LayoutInflaterService).JavaCast <LayoutInflater>(); //replace with your item and your holder items //comment back in view = inflater.Inflate(Resource.Layout.layoutlistaplayerindependiente, parent, false); holder.Title = view.FindViewById <TextView>(Resource.Id.textView1); holder.portrait = view.FindViewById <ImageView>(Resource.Id.imageView1); // view.SetBackgroundResource(Resource.Drawable.drwaablegris); view.Tag = holder; holder.portrait.Click += (aaas, adfas) => { animar(holder.portrait); pos = (int)(((ImageView)aaas).GetTag(Resource.Id.imageView1)); using (Intent intento = new Intent(context, typeof(actividadadinfooffline))) { intento.PutExtra("nombre", nombres[pos]); intento.PutExtra("link", links[todoslosnombres.IndexOf(nombres[pos])]); intento.PutExtra("path", patheses[todoslosnombres.IndexOf(nombres[pos])]); Thread.Sleep(50); context.StartActivity(intento); } }; Glide.With(context) .Load(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits/" + links[indexdefinitivo].Split('=')[1]) .Apply(RequestOptions.CircleCropTransform().SkipMemoryCache(true).Override(125, 125).Placeholder(Resource.Drawable.image)) .Into(holder.portrait); holder.portrait.SetTag(Resource.Id.imageView1, position); } holder.Title.Text = nombres[position]; try { if (links[(int)holder.portrait.GetTag(Resource.Id.imageView1)] != links[indexdefinitivo]) { Glide.With(context) .Load(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits/" + links[indexdefinitivo].Split('=')[1]) .Apply(RequestOptions.CircleCropTransform().SkipMemoryCache(true).Override(125, 125).Placeholder(Resource.Drawable.image)) .Into(holder.portrait); } } catch (Exception e) { var eo = e; eo = null; } holder.animar3(view); holder.portrait.SetTag(Resource.Id.imageView1, position); //fill in your items //holder.Title.Text = "new text here"; /// clasesettings.recogerbasura(); return(view); }
/* * RETURN INFLATED VIEW */ public override View GetView(int position, View convertView, ViewGroup parent) { var view = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.list_items, parent, false); var NameTxt = view.FindViewById <TextView>(Resource.Id.NameTxt); var numberTxt = view.FindViewById <TextView>(Resource.Id.numberTxt); var userImgview = view.FindViewById <ImageView>(Resource.Id.userImageView); var linear_layout = view.FindViewById <LinearLayout>(Resource.Id.linearlayout); view.Tag = new CustomAdapterViewHolder() { NameTxt = NameTxt, numberTxt = numberTxt, userImgview = userImgview, linearlayout = linear_layout }; var holder = (CustomAdapterViewHolder)view.Tag; holder.NameTxt.Text = freq_list[position].NPName; //holder.DesigTxt.Text = freq_list[position].DesignationId; holder.numberTxt.Text = freq_list[position].Mobile; //holder.numberTxt.Visibility = ViewStates.Gone; try { if (freq_list[position].PhotoPath != null) { Glide.With(c).Load(freq_list[position].PhotoPath).Apply(RequestOptions.CircleCropTransform()).Into(holder.userImgview); //Android.Net.Uri contactPhotoUri = Android.Net.Uri.Parse(freq_list[position].PhotoPath); //holder.userImgview.SetImageURI(contactPhotoUri); } } catch (System.Exception e) { } //if (freq_list[position].DesignationId != "" || freq_list[position].DesignationId != null) //{ // //holder.DesigTxt.Visibility = ViewStates.Visible; // holder.DesigTxt.Text = freq_list[position].DesignationId; //} //else //{ // holder.DesigTxt.Visibility = ViewStates.Gone; //} //holder.linearlayout.Click += delegate //{ // Intent intent = new Intent(c, typeof(Overlay)); // intent.PutExtra("number", freq_list[position].Mobile); // c.StartActivity(intent); //}; //holder.dotsImgView.SetImageResource(spacecrafts[position].dotsImg); // holder.userImgview.SetImageResource(spacecrafts[position].userImg); //if (position % 4 == 1) //{ // // Set a background color for ListView regular row/item // convertView.SetBackgroundColor(color: (Android.Graphics.Color.Blue)); //} //else if (position % 4 == 2) //{ // convertView.SetBackgroundColor(color: (Android.Graphics.Color.DarkOrange)); //} //else if (position % 4 == 3) //{ // convertView.SetBackgroundColor(color: (Android.Graphics.Color.SkyBlue)); //} //else //{ // // Set the background color for alternate row/item // convertView.SetBackgroundColor(color: (Android.Graphics.Color.Red)); //} return(view); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ViewInbox); Button timeStamp = FindViewById <Button>(Resource.Id.timeStamp); ImageView profilePicture = FindViewById <ImageView>(Resource.Id.profilePictureInbox); Button nameAndEmail = FindViewById <Button>(Resource.Id.nameAndEmailInbox); Button messageBody = FindViewById <Button>(Resource.Id.messageBodyInbox); Button next = FindViewById <Button>(Resource.Id.nextMessage); Button previous = FindViewById <Button>(Resource.Id.previousMessage); EditText replyText = FindViewById <EditText>(Resource.Id.replyBodyInbox); Button reply = FindViewById <Button>(Resource.Id.replyButton); circular_progress = FindViewById <ProgressBar>(Resource.Id.circularProgressInbox); nameAndEmail.Enabled = false; messageBody.Enabled = false; timeStamp.Enabled = false; auth = FirebaseAuth.GetInstance(MainActivity.app); toEmail = auth.CurrentUser.Email; circular_progress.Visibility = ViewStates.Visible; // Loading messages var firebase = new FirebaseClient("https://fir-test-1bdb3.firebaseio.com/"); var items = await firebase .Child("messages") .OnceAsync <MessageViewModel>(); // Loading users' data to get profile pictures var users = await firebase.Child("users").OnceAsync <UserViewModel>(); List <MessageViewModel> query = new List <MessageViewModel>(); // Filtering foreach (var item in items) { if (item.Object.ToEmail.Equals(toEmail)) { query.Add(item.Object); } } query.Reverse(); int messageNumber = 0; // To keep track of messages timeStamp.Text = query[messageNumber].Timestamp; foreach (var item in users) { if (item.Object.Email.Equals(query[messageNumber].FromEmail)) { if (!item.Object.PhotoURL.Equals(string.Empty)) { Glide.With(this).Load(item.Object.PhotoURL).Apply(RequestOptions.CircleCropTransform()).Into(profilePicture); } nameAndEmail.Text = item.Object.FirstName + " " + item.Object.LastName ?? ""; } } messageBody.Text = query[messageNumber].FromEmail + " says: \n\n" + query[messageNumber].Body; circular_progress.Visibility = ViewStates.Invisible; next.Click += (sender, e) => { int a = query.Count(); if (query.Count() - 1 == messageNumber) { // No new messages Toast.MakeText(ApplicationContext, "No more messages", ToastLength.Short).Show(); } else { circular_progress.Visibility = ViewStates.Visible; messageNumber++; timeStamp.Text = query[messageNumber].Timestamp; foreach (var item in users) { if (item.Object.Email.Equals(query[messageNumber].FromEmail)) { if (!item.Object.PhotoURL.Equals(string.Empty)) { Glide.With(this).Load(item.Object.PhotoURL).Apply(RequestOptions.CircleCropTransform()).Into(profilePicture); } nameAndEmail.Text = item.Object.FirstName + " " + item.Object.LastName ?? ""; } } messageBody.Text = query[messageNumber].FromEmail + " says: \n\n" + query[messageNumber].Body; circular_progress.Visibility = ViewStates.Invisible; } }; previous.Click += (sender, e) => { int a = query.Count(); if (messageNumber == 0) { // No new messages Toast.MakeText(ApplicationContext, "No more messages", ToastLength.Short).Show(); } else { circular_progress.Visibility = ViewStates.Visible; messageNumber--; timeStamp.Text = query[messageNumber].Timestamp; foreach (var item in users) { if (item.Object.Email.Equals(query[messageNumber].FromEmail)) { if (!item.Object.PhotoURL.Equals(string.Empty)) { Glide.With(this).Load(item.Object.PhotoURL).Apply(RequestOptions.CircleCropTransform()).Into(profilePicture); } nameAndEmail.Text = item.Object.FirstName + " " + item.Object.LastName ?? ""; } } messageBody.Text = query[messageNumber].FromEmail + " says: \n\n" + query[messageNumber].Body; circular_progress.Visibility = ViewStates.Invisible; } }; reply.Click += (sender, e) => { circular_progress.Visibility = ViewStates.Visible; if (!replyText.Text.Equals(string.Empty)) { var item = firebase.Child("messages") .PostAsync <MessageViewModel>(new MessageViewModel { ToEmail = query[messageNumber].FromEmail, FromEmail = auth.CurrentUser.Email, Body = replyText.Text.Trim(), Timestamp = DateTime.Now.ToString() }); replyText.Text = string.Empty; Toast.MakeText(ApplicationContext, "Message Sent", ToastLength.Short).Show(); } else { Toast.MakeText(ApplicationContext, "Enter a reply first", ToastLength.Short).Show(); } circular_progress.Visibility = ViewStates.Invisible; }; /* * string[] messages = new string[query.Count()]; * * for (int i = 0; i < query.Count(); i++) * { * messages[i] = query.ToList().ElementAt(i).Timestamp + "\n" + query.ToList().ElementAt(i).Body + "\n - " + query.ToList().ElementAt(i).FromEmail; * * } * ListAdapter = new ArrayAdapter<string>(this, Resource.Layout.ViewInbox, messages); * * ListView.ItemClick += (sender, e) => * { * string recipient = string.Empty; * recipient = ((TextView)e.View).Text; * string[] temps = recipient.Split(' '); * recipient = temps[temps.Length - 1]; * Intent sendMessageActivity = new Intent(ApplicationContext, typeof(MessageSendActivity)); * sendMessageActivity.PutExtra("toEmail", recipient); * HomeActivity.fromHome = false; * StartActivity(sendMessageActivity); * }; */ }
public override View GetView(int position, View convertView, ViewGroup parent) { var view = convertView; adapterlistaremotoconeliminarViewHolder holder = null; if (view != null) { holder = view.Tag as adapterlistaremotoconeliminarViewHolder; } if (holder == null) { holder = new adapterlistaremotoconeliminarViewHolder(); var inflater = context.GetSystemService(Context.LayoutInflaterService).JavaCast <LayoutInflater>(); //replace with your item and your holder items //comment back in view = inflater.Inflate(Resource.Layout.layoutlistaplayerindependienteconmenu, parent, false); holder.Title = view.FindViewById <TextView>(Resource.Id.textView1); holder.boton = view.FindViewById <ImageView>(Resource.Id.imageView2); holder.portrait = view.FindViewById <ImageView>(Resource.Id.imageView1); holder.boton.Click += (aadfd, aaaa) => { PopupMenu menu = new PopupMenu(context, holder.boton); menu.Inflate(Resource.Drawable.menupopup); menu.MenuItemClick += (s1, arg1) => { pos = (int)(((ImageView)aadfd).GetTag(Resource.Id.imageView2)); AlertDialog.Builder ad = new AlertDialog.Builder(context); ad.SetCancelable(false); if (listacompletai && !solomodifyelarray) { ad.SetMessage("Esta seguro que desea eliminar la lista de reproduccion " + nombres[pos] + "??"); } else if (!listacompletai && !solomodifyelarray) { ad.SetMessage("Esta seguro que desea eliminar " + nombres[pos] + " de la lista de reproduccion " + listaactual + "??"); } else if (solomodifyelarray) { ad.SetMessage("Esta seguro que desea remover el elemento? " + nombres[pos]); } ad.SetTitle("Advertencia"); ad.SetIcon(Resource.Drawable.alert); if (listacompletai && !solomodifyelarray) { ad.SetPositiveButton("Si", ok2); } else if (!listacompletai && !solomodifyelarray) { ad.SetPositiveButton("Si", ok); } else if (solomodifyelarray) { ad.SetPositiveButton("Si", ok3); } ad.SetNegativeButton("No", no); ad.Create(); ad.Show(); }; menu.Show(); }; // view.SetBackgroundResource(Resource.Drawable.drwaablegris); view.Tag = holder; /* if (links.Contains("")) * { * links.Remove(""); * }*/ holder.portrait.SetTag(Resource.Id.imageView1, links[position]); try { Glide.With(context) .Load("http://i.ytimg.com/vi/" + links[position].Split('=')[1] + "/mqdefault.jpg") .Apply(RequestOptions.CircleCropTransform().Placeholder(Resource.Drawable.image)) .Into(holder.portrait); } catch (Exception) { Glide.With(context) .Load("http://gr3gorywolf.github.io/Multitubeweb/lista.png") .Apply(RequestOptions.NoTransformation().Placeholder(Resource.Drawable.image)) .Into(holder.portrait); } } if (holder.portrait.GetTag(Resource.Id.imageView1).ToString() != links[position]) { try { Glide.With(context) .Load("http://i.ytimg.com/vi/" + links[position].Split('=')[1] + "/mqdefault.jpg") .Apply(RequestOptions.CircleCropTransform().Placeholder(Resource.Drawable.image)) .Into(holder.portrait); } catch (Exception) { Glide.With(context) .Load("http://gr3gorywolf.github.io/Multitubeweb/lista.png") .Apply(RequestOptions.NoTransformation().Placeholder(Resource.Drawable.image)) .Into(holder.portrait); } } holder.Title.Text = nombres[position]; holder.animar3(view); holder.portrait.SetTag(Resource.Id.imageView1, links[position]); holder.boton.SetTag(Resource.Id.imageView2, position); //fill in your items //holder.Title.Text = "new text here"; /// clasesettings.recogerbasura(); return(view); }
private void InitComponent(View view) { try { MRecycler = (RecyclerView)view.FindViewById(Resource.Id.recylerSongsPlaylist); EmptyStateLayout = view.FindViewById <ViewStub>(Resource.Id.viewStub); CollapsingToolbar = view.FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsingToolbar); CollapsingToolbar.Title = ""; IconMore = view.FindViewById <ImageView>(Resource.Id.more); IconMore.Click += IconMoreOnClick; AppBarLayout = view.FindViewById <AppBarLayout>(Resource.Id.appBarLayout); AppBarLayout.SetExpanded(true); LayoutImage = view.FindViewById <RelativeLayout>(Resource.Id.Layoutimage); LayoutImage.SetClipToPadding(true); TxtNamePlaylist = view.FindViewById <TextView>(Resource.Id.name); TxtSongCount = view.FindViewById <TextView>(Resource.Id.soungCount); TxtPublisherName = view.FindViewById <TextView>(Resource.Id.ByUser); CoverImage = view.FindViewById <ImageView>(Resource.Id.Coverimage); DiskImage = view.FindViewById <CircleImageView>(Resource.Id.Diskimage); GlideRequestOptions = new RequestOptions().SetDiskCacheStrategy(DiskCacheStrategy.All).SetPriority(Priority.High).Apply(RequestOptions.CircleCropTransform().CenterCrop().CircleCrop()); PlayAllButton = view.FindViewById <FloatingActionButton>(Resource.Id.fab); PlayAllButton.Click += PlayAllButtonOnClick; PlayAllButton.Tag = "play"; PlayAllButton.Visibility = ViewStates.Gone; ImageBack = view.FindViewById <ImageView>(Resource.Id.ImageBack); BackIcon = view.FindViewById <FrameLayout>(Resource.Id.back); BackIcon.Click += BackIcon_Click; LibrarySynchronizer = new LibrarySynchronizer(Activity); } catch (Exception e) { Console.WriteLine(e); } }