private void HolderDelegate(CachingViewHolder holder, Boiler item, int index) { holder.FindCachedViewById <TextView>(Resource.Id.NameTextView).Text = item.Name; holder.FindCachedViewById <TextView>(Resource.Id.MetaDataTextView).Text = $"{GetString(Resource.String.NumberOfMeasurments)} {item.Count}\n" + $"{GetString(Resource.String.CreatedAt)} {item.DateCreated.ToShortDateString()}"; var button = holder.FindCachedViewById <ImageView>(Resource.Id.DeleteButton); if (!button.HasOnClickListeners) { button.Click += (s, e) => { var position = holder.AdapterPosition; new AlertDialog.Builder(Context) .SetTitle(GetString(Resource.String.Delete)) .SetMessage($"{GetString(Resource.String.DeleteBoilerQ)} {VM.Boilers[position].Name}?") .SetPositiveButton(GetString(Resource.String.Yes), (s1, e1) => VM.DeleteBoiler(VM.Boilers[position])) .SetNegativeButton(GetString(Resource.String.No), (s1, e1) => { }) .Create() .Show(); } } ; }
private void BindRedditView(CachingViewHolder holder, SubredditItem item, int position) { holder.FindCachedViewById <TextView>(Resource.Id.TitleTextView).Text = item.Title.Replace("&", "&"); holder.FindCachedViewById <TextView>(Resource.Id.SubtitleTextView).Text = $"/r/{item.Url} • {item.Subscribers} Subscribers"; var addButton = holder.FindCachedViewById <View>(Resource.Id.AddButton); var addButtonVisibilityBinding = new Binding <bool, ViewStates>(item, () => item.IsFavorited, addButton, () => addButton.Visibility).ConvertSourceToTarget((flag) => flag ? ViewStates.Gone : ViewStates.Visible); holder.DeleteBinding(nameof(addButtonVisibilityBinding)); holder.SaveBinding(nameof(addButtonVisibilityBinding), addButtonVisibilityBinding); //addButton.SetCommand("Click", Vm.ToggleFavorite, item); var checkButton = holder.FindCachedViewById <View>(Resource.Id.CheckButton); var checkButtonVisibilityBinding = new Binding <bool, ViewStates>(item, () => item.IsFavorited, checkButton, () => checkButton.Visibility).ConvertSourceToTarget((flag) => !flag ? ViewStates.Gone : ViewStates.Visible); holder.DeleteBinding(nameof(checkButtonVisibilityBinding)); holder.SaveBinding(nameof(checkButtonVisibilityBinding), checkButtonVisibilityBinding); //checkButton.SetCommand("Click", Vm.ToggleFavorite, item); var toggleContainer = holder.FindCachedViewById <View>(Resource.Id.ToggleContainer); toggleContainer.SetCommand("Click", Vm.ToggleFavorite, item); }
private void BindViewHolder(CachingViewHolder holder, Item item, int position) { var root = holder.FindCachedViewById <LinearLayout>(Resource.Id.LayoutRoot); if (item == _adapter.SelectedItem) { root.SetBackgroundColor(Color.Yellow); } else { root.SetBackgroundColor(Color.Transparent); } var text = holder.FindCachedViewById <TextView>(Resource.Id.ItemText); text.Text = item.Name; var check = holder.FindCachedViewById <CheckBox>(Resource.Id.ItemCheck); holder.DeleteBinding(check); var binding = new Binding <bool, bool>( item, () => item.IsToggled, check, () => check.Checked, BindingMode.TwoWay); holder.SaveBinding(check, binding); }
private void BindViewHolder(CachingViewHolder holder, GalleryItem item, int position) { var thumbnail = holder.FindCachedViewById <ImageViewAsync>(Resource.Id.Thumbnail); thumbnail.SetImageResource(global::Android.Resource.Color.Transparent); thumbnail.Post(() => { var height = item.BigThumbRatio * thumbnail.Width; var layoutParams = thumbnail.LayoutParameters; layoutParams.Height = (int)Math.Floor(height); thumbnail.LayoutParameters = layoutParams; }); holder.DeleteBinding(thumbnail); var imageBinding = new Binding <string, string>(item, () => item.BigThumbnail).WhenSourceChanges(() => { ImageService.Instance.LoadUrl(item.BigThumbnail).Into(thumbnail); }); holder.SaveBinding(thumbnail, imageBinding); var title = holder.FindCachedViewById <TextView>(Resource.Id.TitleTextView); title.Text = item.Title; var ups = holder.FindCachedViewById <TextView>(Resource.Id.UpsTextView); ups.Text = item.Ups.ToString(); var comments = holder.FindCachedViewById <TextView>(Resource.Id.CommentsTextView); comments.Text = item.CommentCount.ToString(); }
private void BindViewHolder(CachingViewHolder holder, string item, int index) { var button = holder.FindCachedViewById <ImageView>(Resource.Id.DeleteButton); var EditTextView = holder.FindCachedViewById <EditText>(Resource.Id.EditTextView); if (index == 0 || index == 1) { EditTextView.Text = item; EditTextView.Enabled = false; button.Enabled = false; } else if (item != null && item != "") { EditTextView.Text = item; EditTextView.Enabled = false; } else { EditTextView.Text = ""; EditTextView.Hint = GetString(Resource.String.your_measurment_name_id); EditTextView.Enabled = true; } if (!button.HasOnClickListeners) { button.Click += (s, e) => { template.RemoveAt(holder.AdapterPosition); recyclerAdapter.NotifyItemRemoved(holder.AdapterPosition); }; } }
private void BindViewHolder(CachingViewHolder holder, GalleryItem item, int position) { var hasTitle = !string.IsNullOrEmpty(item.Title); var titleView = holder.FindCachedViewById <TextView>(Resource.Id.TitleTextView); if (hasTitle) { titleView.Text = item.Title; } else { titleView.Visibility = ViewStates.Gone; } var image = holder.FindCachedViewById <ImageControl>(Resource.Id.MainImage); //this.Activity.RegisterForContextMenu(image); image.RenderContent(item, InFragmentManager); var hasDescription = !string.IsNullOrEmpty(item.Description); var descView = holder.FindCachedViewById <TextView>(Resource.Id.DescriptionTextView); if (hasDescription) { descView.Text = item.Description; } else { descView.Visibility = ViewStates.Gone; } }
private void SetUpRecyclerViews(CachingViewHolder holder, AttendanceCard course) { RecyclerviewList = new List <RecyclerView> { holder.FindCachedViewById <RecyclerView>(Resource.Id.AttendancePenaltyListRecyclerView1), holder.FindCachedViewById <RecyclerView>(Resource.Id.AttendancePenaltyListRecyclerView2), holder.FindCachedViewById <RecyclerView>(Resource.Id.AttendancePenaltyListRecyclerView3), holder.FindCachedViewById <RecyclerView>(Resource.Id.AttendancePenaltyListRecyclerView4) }; /* Set adapters and linearlayoutmanagers to the recyclerviews */ Activity.RunOnUiThread(() => { for (int count = 0; count < 4; count++) { /* Set Adapters */ RecyclerviewList[count].SetAdapter ( course.AttendanceViolations[count].GetRecyclerAdapter (BindChildViewHolder, Resource.Layout.AttendancePenaltyLayout) ); /* Set Layout Managers */ RecyclerviewList[count].SetLayoutManager(new LinearLayoutManager(Activity)); } }); }
private void BindViewHolder(CachingViewHolder holder, PlaceDetailsViewModel placeDetails, int position) { var title = holder.FindCachedViewById <TextView>(Resource.Id.NameTextView); title.Text = placeDetails.Place.Name; title.SetTextColor(Color.Black); var desc = holder.FindCachedViewById <TextView>(Resource.Id.DescriptionTextView); desc.Text = placeDetails.Place.Vicinity; desc.SetTextColor(Color.Black); }
private void BindViewHolder(CachingViewHolder Holder, Events card, int position) { _position = position; TextView _eventName = Holder.FindCachedViewById <TextView>(Resource.Id.eventSignUpTitle); TextView _eventTime = Holder.FindCachedViewById <TextView>(Resource.Id.eventSignUpDateTime); TextView _eventDescription = Holder.FindCachedViewById <TextView>(Resource.Id.eventSignUpDescription); Button _eventSignupButton = Holder.FindCachedViewById <Button>(Resource.Id.eventSignUpButton); if (card.IsSignedUp) { _eventSignupButton.Text = "Signed Up"; _eventSignupButton.Enabled = false; } _eventSignupButton.Click += (sender, clickEvent) => { card.IsSignedUp = true; _eventSignupButton.Text = "Signed Up"; _eventSignupButton.Enabled = false; Activity.RunOnUiThread(async() => await ViewModel.Signup(card)); }; Holder.DeleteBinding(_eventName); Holder.DeleteBinding(_eventTime); Holder.DeleteBinding(_eventDescription); var nameBinding = new Binding <string, string>( card, () => card.EventName, _eventName, () => _eventName.Text, BindingMode.OneWay); var timeBinding = new Binding <string, string>( card, () => card.EventTime, _eventTime, () => _eventTime.Text, BindingMode.OneWay ); var descriptionBinding = new Binding <string, string>( card, () => card.EventDescription, _eventDescription, () => _eventDescription.Text, BindingMode.OneWay ); Holder.SaveBinding(_eventName, nameBinding); Holder.SaveBinding(_eventTime, timeBinding); Holder.SaveBinding(_eventDescription, descriptionBinding); }
private void BindViewHolder(CachingViewHolder holder, Task taskModel, int position) { var title = holder.FindCachedViewById <TextView>(Resource.Id.title); title.Text = taskModel.Title; var date = holder.FindCachedViewById <TextView>(Resource.Id.date); //date.Text = taskModel.Date.HasValue ? ((DateTime)taskModel.Date).ToShortDateString() : ""; date.Text = taskModel.Date.ToShortDateString(); }
private void BindViewHolder(CachingViewHolder holder, FlowerViewModel flower, int position) { var image = holder.FindCachedViewById <ImageView>(Resource.Id.FlowerImageView); ImageDownloader.AssignImageAsync(image, flower.Model.Image, this); var title = holder.FindCachedViewById <TextView>(Resource.Id.NameTextView); title.Text = flower.Model.Name; var desc = holder.FindCachedViewById <TextView>(Resource.Id.DescriptionTextView); desc.Text = flower.Model.Description; }
private void BindingViewHolderHourly(CachingViewHolder holder, DetailsViewModel.HourlyWeatherData viewModel, int position) { var day = holder.FindCachedViewById <TextView>(Resource.Id.tvHour); day.Text = viewModel.hour; var min = holder.FindCachedViewById <TextView>(Resource.Id.tvTemp); min.Text = viewModel.temperature.ToString(); var icon = holder.FindCachedViewById <ImageView>(Resource.Id.ivIcon); Picasso.With(this).Load(ViewModel.WeatherIconBasePath + viewModel.iconName + ".png").Into(icon); }
private void BindViewHolder(CachingViewHolder viewHolder, Picture item, int position) { var image = viewHolder.FindCachedViewById <ImageView>(Resource.Id.image); image.LayoutParameters = new ViewGroup.LayoutParams(_itemSize, _itemSize); Picasso.With(Activity).Load(new File(item.ThumbnailUri)).Into(image); }
/*********************************************************************/ /* Child BindViewHolder */ /*********************************************************************/ private void ChildBindViewHolder(CachingViewHolder holder, Assignment assignment, int position) { TextView _assignmentName = holder.FindCachedViewById <TextView>(Resource.Id.AssignmentName); TextView _assignmentDate = holder.FindCachedViewById <TextView>(Resource.Id.AssignmentDate); TextView _assignmentGrade = holder.FindCachedViewById <TextView>(Resource.Id.AssignmentGrade); /* Delete the previous binding */ holder.DeleteBinding(_assignmentName); holder.DeleteBinding(_assignmentDate); holder.DeleteBinding(_assignmentGrade); /* Create new bindings and and save them */ var _nameBinding = new Binding <string, string> ( assignment, () => assignment.AssignmentName, _assignmentName, () => _assignmentName.Text ); var _dateBinding = new Binding <string, string> ( assignment, () => assignment.AssignmentDate, _assignmentDate, () => _assignmentDate.Text ); var _gradeBinding = new Binding <string, string> ( assignment, () => assignment.GradeScore, _assignmentGrade, () => _assignmentGrade.Text ); /* Save the binding */ holder.SaveBinding(_assignmentName, _nameBinding); holder.SaveBinding(_assignmentDate, _dateBinding); holder.SaveBinding(_assignmentGrade, _gradeBinding); }
private void BindViewHolder(CachingViewHolder holder, Offense offenseCard, int position) { TextView _titleView = holder.FindCachedViewById <TextView>(Resource.Id.infractionTitle); TextView _dateView = holder.FindCachedViewById <TextView>(Resource.Id.infractionDate); TextView _timeView = holder.FindCachedViewById <TextView>(Resource.Id.infractionTime); holder.DeleteBinding(_titleView); holder.DeleteBinding(_dateView); holder.DeleteBinding(_timeView); var _titleBinding = new Binding <string, string> ( offenseCard, () => offenseCard.OffenseTitle, _titleView, () => _titleView.Text, BindingMode.OneWay ); var _dateBinding = new Binding <string, string> ( offenseCard, () => offenseCard.OffenseDate, _dateView, () => _dateView.Text, BindingMode.OneWay ); var _timeBinding = new Binding <string, string> ( offenseCard, () => offenseCard.OffenseTime, _timeView, () => _timeView.Text, BindingMode.OneWay ); holder.SaveBinding(_titleView, _titleBinding); holder.SaveBinding(_dateView, _dateBinding); holder.SaveBinding(_timeView, _timeBinding); }
private void BindViewHolderDelegate(CachingViewHolder holder, string item, int index) { switch (index) { case 0: holder.FindCachedViewById <TextInputLayout>(Resource.Id.ValueInputLayout).Hint = GetString(Resource.String.Temperature); break; case 1: holder.FindCachedViewById <TextInputLayout>(Resource.Id.ValueInputLayout).Hint = GetString(Resource.String.Level); break; default: holder.FindCachedViewById <TextInputLayout>(Resource.Id.ValueInputLayout).Hint = Boiler.Template[index - 2]; break; } }
private void BindViewHolder(CachingViewHolder holder, ForecastViewModel forecast, int position) { var image = holder.FindCachedViewById <ImageView>(Resource.Id.FCT_IconImageView); ImageDownloader.AssignImageAsync(image, forecast.Icon, this); var dayOfWeek = holder.FindCachedViewById <TextView>(Resource.Id.FCT_DayOfWeekTextView); dayOfWeek.Text = forecast.DayOfWeek; var description = holder.FindCachedViewById <TextView>(Resource.Id.FCT_DescriptionTextView); description.Text = forecast.Description; var dayTemp = holder.FindCachedViewById <TextView>(Resource.Id.FCT_DayTempTextView); dayTemp.Text = forecast.DayTemp; }
private void BindingViewHolderDaily(CachingViewHolder holder, DetailsViewModel.DailyWeatherData viewModel, int position) { var day = holder.FindCachedViewById <TextView>(Resource.Id.tvDay); day.Text = viewModel.dayOfWeek; var min = holder.FindCachedViewById <TextView>(Resource.Id.tvTempNight); min.Text = viewModel.nightTemperature.ToString(); var max = holder.FindCachedViewById <TextView>(Resource.Id.tvTempDay); max.Text = viewModel.dailyTemperature.ToString(); var icon = holder.FindCachedViewById <ImageView>(Resource.Id.icon); Picasso.With(this).Load(ViewModel.WeatherIconBasePath + viewModel.iconName + ".png").Into(icon); }
private void BindViewHolder(CachingViewHolder holder, FourWindsItem fourWindsItem, int position) { TextView _textview = holder.FindCachedViewById <TextView>(Resource.Id.listItem); holder.DeleteBinding(_textview); ImageView arrowIcon = holder.FindCachedViewById <ImageView>(Resource.Id.ShowGradesArrowIcon); var itemBinding = new Binding <string, string>( fourWindsItem, () => fourWindsItem.ItemName, _textview, () => _textview.Text, BindingMode.OneWay, "Closed" ); holder.SaveBinding(_textview, itemBinding); }
private void BindViewHolder(CachingViewHolder holder, StudentEvent studentEvent, int position) { TextView _time = holder.FindCachedViewById <TextView>(Resource.Id.studentScheduleEventTime); TextView _title = holder.FindCachedViewById <TextView>(Resource.Id.studentScheduleEventTitle); TextView _location = holder.FindCachedViewById <TextView>(Resource.Id.studentScheduleEventDescription); holder.DeleteBinding(_time); holder.DeleteBinding(_title); holder.DeleteBinding(_location); var _timeBinding = new Binding <string, string> ( studentEvent, () => studentEvent.EventTime, _time, () => _time.Text ); var _titleBinding = new Binding <string, string> ( studentEvent, () => studentEvent.Title, _title, () => _title.Text ); var _locationBinding = new Binding <string, string> ( studentEvent, () => studentEvent.Location, _location, () => _location.Text ); holder.SaveBinding(_time, _timeBinding); holder.SaveBinding(_title, _titleBinding); holder.SaveBinding(_location, _locationBinding); }
private void BindPostView(CachingViewHolder holder, GalleryItem item, int position) { var thumbnail = holder.FindCachedViewById <ImageViewAsync>(Resource.Id.Thumbnail); thumbnail.Post(() => { var height = item.BigThumbRatio * thumbnail.Width; var layoutParams = thumbnail.LayoutParameters; layoutParams.Height = (int)Math.Floor(height); thumbnail.LayoutParameters = layoutParams; }); ImageService.Instance.LoadUrl(item.BigThumbnail).Into(thumbnail); var title = holder.FindCachedViewById <TextView>(Resource.Id.TitleTextView); title.Text = item.Title; var ups = holder.FindCachedViewById <TextView>(Resource.Id.UpsTextView); ups.Text = item.Ups.ToString(); var comments = holder.FindCachedViewById <TextView>(Resource.Id.CommentsTextView); comments.Text = item.CommentCount.ToString(); }
private void BindChildViewHolder(CachingViewHolder holder, ClassAttendance violation, int position) { TextView _violation = holder.FindCachedViewById <TextView>(Resource.Id.AttendancePenaltyListItem); holder.DeleteBinding(_violation); var _violationBinding = new Binding <string, string> ( violation, () => violation.Date, _violation, () => _violation.Text ); holder.SaveBinding(_violation, _violationBinding); }
private void BindGifView(CachingViewHolder holder, GalleryItem item, int position) { var layoutRoot = holder.ItemView; layoutRoot.Post(() => { var width = layoutRoot.Width; var layoutParams = layoutRoot.LayoutParameters; layoutParams.Height = width; layoutRoot.LayoutParameters = layoutParams; }); var thumbnailView = holder.FindCachedViewById <ImageViewAsync>(Resource.Id.Thumbnail); ImageService.Instance.LoadUrl(item.Thumbnail).Into(thumbnailView); }
private void BindViewHolder(CachingViewHolder holder, GalleryItem item, int position) { var layoutRoot = holder.ItemView; layoutRoot.Post(() => { var width = layoutRoot.Width; var layoutParams = layoutRoot.LayoutParameters; layoutParams.Height = width; layoutRoot.LayoutParameters = layoutParams; }); var thumbnailView = holder.FindCachedViewById<ImageViewAsync>(Resource.Id.Thumbnail); holder.DeleteBinding(thumbnailView); var thumbnailBinding = new Binding<string, string>(item, () => item.Thumbnail) .WhenSourceChanges(() => ImageService.Instance.LoadUrl(item.Thumbnail).Into(thumbnailView)); holder.SaveBinding(thumbnailView, thumbnailBinding); }
private void BindViewHolder(CachingViewHolder holder, GrabAndGoItem grabAndGoItem, int position) { TextView _textview = holder.FindCachedViewById <TextView>(Resource.Id.listItem); holder.DeleteBinding(_textview); var itemBinding = new Binding <string, string>( grabAndGoItem, () => grabAndGoItem.ItemName, _textview, () => _textview.Text, BindingMode.OneWay, "Closed" ); holder.SaveBinding(_textview, itemBinding); }
private void BindViewHolder(CachingViewHolder holder, GalleryItem item, int position) { var layoutRoot = holder.ItemView; layoutRoot.Post(() => { var width = layoutRoot.Width; var layoutParams = layoutRoot.LayoutParameters; layoutParams.Height = width; layoutRoot.LayoutParameters = layoutParams; }); var thumbnailView = holder.FindCachedViewById <ImageViewAsync>(Resource.Id.Thumbnail); thumbnailView.SetImageResource(global::Android.Resource.Color.Transparent); holder.DeleteBinding(thumbnailView); var thumbnailBinding = new Binding <string, string>(item, () => item.Thumbnail) .WhenSourceChanges(() => ImageService.Instance.LoadUrl(item.Thumbnail).Into(thumbnailView)); holder.SaveBinding(thumbnailView, thumbnailBinding); }
private void BindViewHolder(CachingViewHolder holder, GalleryItem item, int position) { var thumbnail = holder.FindCachedViewById<ImageViewAsync>(Resource.Id.Thumbnail); thumbnail.Post(() => { var height = item.BigThumbRatio * thumbnail.Width; var layoutParams = thumbnail.LayoutParameters; layoutParams.Height = (int)Math.Floor(height); thumbnail.LayoutParameters = layoutParams; }); holder.DeleteBinding(thumbnail); var imageBinding = new Binding<string, string>(item, () => item.BigThumbnail).WhenSourceChanges(() => { ImageService.Instance.LoadUrl(item.BigThumbnail).Into(thumbnail); }); holder.SaveBinding(thumbnail, imageBinding); var title = holder.FindCachedViewById<TextView>(Resource.Id.TitleTextView); title.Text = item.Title; var ups = holder.FindCachedViewById<TextView>(Resource.Id.UpsTextView); ups.Text = item.Ups.ToString(); var comments = holder.FindCachedViewById<TextView>(Resource.Id.CommentsTextView); comments.Text = item.CommentCount.ToString(); }
private void BindRedditView(CachingViewHolder holder, SubredditItem item, int position) { holder.FindCachedViewById<TextView>(Resource.Id.TitleTextView).Text = item.Title.Replace("&", "&"); holder.FindCachedViewById<TextView>(Resource.Id.SubtitleTextView).Text = $"/r/{item.Url} • {item.Subscribers} Subscribers"; var addButton = holder.FindCachedViewById<View>(Resource.Id.AddButton); var addButtonVisibilityBinding = new Binding<bool, ViewStates>(item, () => item.IsFavorited, addButton, () => addButton.Visibility).ConvertSourceToTarget((flag) => flag ? ViewStates.Gone : ViewStates.Visible); holder.DeleteBinding(nameof(addButtonVisibilityBinding)); holder.SaveBinding(nameof(addButtonVisibilityBinding), addButtonVisibilityBinding); //addButton.SetCommand("Click", Vm.ToggleFavorite, item); var checkButton = holder.FindCachedViewById<View>(Resource.Id.CheckButton); var checkButtonVisibilityBinding = new Binding<bool, ViewStates>(item, () => item.IsFavorited, checkButton, () => checkButton.Visibility).ConvertSourceToTarget((flag) => !flag ? ViewStates.Gone : ViewStates.Visible); holder.DeleteBinding(nameof(checkButtonVisibilityBinding)); holder.SaveBinding(nameof(checkButtonVisibilityBinding), checkButtonVisibilityBinding); //checkButton.SetCommand("Click", Vm.ToggleFavorite, item); var toggleContainer = holder.FindCachedViewById<View>(Resource.Id.ToggleContainer); toggleContainer.SetCommand("Click", Vm.ToggleFavorite, item); }
private void BindViewHolder(CachingViewHolder holder, AttendanceCard course, int position) { TextView _classNameTextView = holder.FindCachedViewById <TextView>(Resource.Id.attendanceClassName); TextView _absenceNumber = holder.FindCachedViewById <TextView>(Resource.Id.attendanceClassUnexcusedNumber); TextView _pendingAbsenceNumber = holder.FindCachedViewById <TextView>(Resource.Id.AttendancePendingUnexcusedNumber); TextView _tardyNumber = holder.FindCachedViewById <TextView>(Resource.Id.AttendanceTardiesNumber); TextView _pendingTardyNumber = holder.FindCachedViewById <TextView>(Resource.Id.AttendancePendingTardiesNumber); /* Set up the children recyclerviews */ SetUpRecyclerViews(holder, course); /* Delete the binding */ holder.DeleteBinding(_classNameTextView); holder.DeleteBinding(_absenceNumber); holder.DeleteBinding(_pendingAbsenceNumber); holder.DeleteBinding(_tardyNumber); holder.DeleteBinding(_pendingTardyNumber); /* Create a new binding and save it */ var _classNameBinding = new Binding <string, string> ( course, () => course.CourseName, _classNameTextView, () => _classNameTextView.Text ); var _absenceNumberBinding = new Binding <string, string> ( course, () => course.Absences, _absenceNumber, () => _absenceNumber.Text ); var _pendingAbsenceNumberBinding = new Binding <string, string> ( course, () => course.PendingAbsences, _pendingAbsenceNumber, () => _pendingAbsenceNumber.Text ); var _tardyNumberBinding = new Binding <string, string> ( course, () => course.Tardies, _tardyNumber, () => _tardyNumber.Text ); var _pendingTardyNumberBinding = new Binding <string, string> ( course, () => course.PendingTardies, _pendingTardyNumber, () => _pendingTardyNumber.Text ); holder.SaveBinding(_classNameTextView, _classNameBinding); holder.SaveBinding(_absenceNumber, _absenceNumberBinding); holder.SaveBinding(_pendingAbsenceNumber, _pendingAbsenceNumberBinding); holder.SaveBinding(_tardyNumber, _tardyNumberBinding); holder.SaveBinding(_pendingTardyNumber, _pendingTardyNumberBinding); }
private void BindViewHolder(CachingViewHolder holder, Course section, int position) { _position = holder.AdapterPosition; TextView _courseNumber = holder.FindCachedViewById <TextView>(Resource.Id.examClassNumber); TextView _courseName = holder.FindCachedViewById <TextView>(Resource.Id.examClassName); TextView _examDate = holder.FindCachedViewById <TextView>(Resource.Id.examDate); TextView _examTime = holder.FindCachedViewById <TextView>(Resource.Id.examTime); TextView _examLocation = holder.FindCachedViewById <TextView>(Resource.Id.examRoomLocation); /* Set the binding for the course code */ holder.DeleteBinding(_courseNumber); var numberBinding = new Binding <string, string>( section, () => section.FormattedCourseCode, _courseNumber, () => _courseNumber.Text, BindingMode.OneWay); holder.SaveBinding(_courseNumber, numberBinding); /* Set binding for the coursename */ holder.DeleteBinding(_courseName); var nameBinding = new Binding <string, string>( section, () => section.CourseName, _courseName, () => _courseName.Text, BindingMode.OneWay); holder.SaveBinding(_courseName, nameBinding); /* Set binding for the exam date */ holder.DeleteBinding(_examDate); var dateBinding = new Binding <string, string>( section, () => section.ExamDay, _examDate, () => _examDate.Text, BindingMode.OneWay); holder.SaveBinding(_examDate, dateBinding); /* Set binding for exam time */ holder.DeleteBinding(_examTime); var timeBinding = new Binding <string, string>( section, () => section.ExamTime, _examTime, () => _examTime.Text, BindingMode.OneWay); holder.SaveBinding(_examTime, timeBinding); /*Set the binding for the exam location*/ holder.DeleteBinding(_examLocation); var locationBinding = new Binding <string, string>( section, () => section.Location, _examLocation, () => _examLocation.Text, BindingMode.OneWay); holder.SaveBinding(_examLocation, locationBinding); }
/*********************************************************************/ /* Bind ViewHolder */ /*********************************************************************/ private void BindViewHolder(CachingViewHolder holder, GradeCard gradeCard, int position) { _position = holder.AdapterPosition; LinearLayout _expandArea = holder.FindCachedViewById <LinearLayout>(Resource.Id.llExpandArea); /* Handle the closing of the previous recyclerview */ if (position == _expandedPosition) { /*DEBUG*/ //System.Diagnostics.Debug.Write("OPEN-POSITION(" + position + ")"); /*DEBUG*/ //System.Diagnostics.Debug.Write("OPEN-VH.POSITION(" + holder.AdapterPosition + ")"); holder.FindCachedViewById <ImageView>(Resource.Id.ShowGradesArrowIcon) .StartAnimation(_rotateArrow); _expandArea.Visibility = ViewStates.Visible; } else { /*DEBUG*/ //System.Diagnostics.Debug.Write("CLOSE-POSITION(" + position + ")"); /*DEBUG*/ //System.Diagnostics.Debug.Write("CLOSE-VH.POSITION(" + holder.AdapterPosition + ")"); Activity.RunOnUiThread(() => _expandArea.Visibility = ViewStates.Gone); } TextView _className = holder.FindCachedViewById <TextView>(Resource.Id.GradesCardClassName); TextView _courseGrade = holder.FindCachedViewById <TextView>(Resource.Id.CourseGrade); Button _showTeacher = holder.FindCachedViewById <Button>(Resource.Id.TeacherInfoButton); if (!_showTeacher.HasOnClickListeners) { _showTeacher.Tag = holder; _showTeacher.Click += ShowTeacherInfo; } Button _showGrades = holder.FindCachedViewById <Button>(Resource.Id.ShowGradesButton); if (!_showGrades.HasOnClickListeners) { _showGrades.Tag = holder; _showGrades.Click += ShowGrades; } /* Set up the child recyclerview for the assignments */ _assignmentsRecyclerView = holder.FindCachedViewById <RecyclerView>( Resource.Id.AssignmentsRecyclerView); /* Bind to the data */ _assignmentAdapter = gradeCard.ClassAssignments.GetRecyclerAdapter(ChildBindViewHolder, Resource.Layout.GradesAssignment); /* Set the nested recyclerview layout manager and adapter */ _assignmentsRecyclerView.SetLayoutManager(new LinearLayoutManager(Activity)); _assignmentsRecyclerView.SetAdapter(_assignmentAdapter); /* Delete the binding for memory purposes */ holder.DeleteBinding(_className); holder.DeleteBinding(_courseGrade); /* Create new binding and bind the properties to the view */ var _titleBinding = new Binding <string, string>( gradeCard, () => gradeCard.CourseTitle, _className, () => _className.Text, BindingMode.OneWay); var _gradeBinding = new Binding <string, string>( gradeCard, () => gradeCard.CourseGrade, _courseGrade, () => _courseGrade.Text, BindingMode.OneWay); /* Save the binding; remember to delete it later */ holder.SaveBinding(_className, _titleBinding); holder.SaveBinding(_courseGrade, _gradeBinding); }
private void BindViewHolder(CachingViewHolder holder, GalleryItem item, int position) { var hasTitle = !string.IsNullOrEmpty(item.Title); var titleView = holder.FindCachedViewById<TextView>(Resource.Id.TitleTextView); if (hasTitle) titleView.Text = item.Title; else titleView.Visibility = ViewStates.Gone; var image = holder.FindCachedViewById<ImageControl>(Resource.Id.MainImage); image.RenderContent(item); var hasDescription = !string.IsNullOrEmpty(item.Description); var descView = holder.FindCachedViewById<TextView>(Resource.Id.DescriptionTextView); if (hasDescription) descView.Text = item.Description; else descView.Visibility = ViewStates.Gone; }
private void BindGifView(CachingViewHolder holder, GalleryItem item, int position) { var layoutRoot = holder.ItemView; layoutRoot.Post(() => { var width = layoutRoot.Width; var layoutParams = layoutRoot.LayoutParameters; layoutParams.Height = width; layoutRoot.LayoutParameters = layoutParams; }); var thumbnailView = holder.FindCachedViewById<ImageViewAsync>(Resource.Id.Thumbnail); ImageService.Instance.LoadUrl(item.Thumbnail).Into(thumbnailView); }