private void InitializeUi() { var viewHolder = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.FromRGB(245, 241, 230) }; Add(viewHolder); viewHolder.LeftAnchor.ConstraintEqualTo(LeftAnchor, 8).Active = true; viewHolder.TopAnchor.ConstraintEqualTo(TopAnchor).Active = true; viewHolder.RightAnchor.ConstraintEqualTo(RightAnchor, -8).Active = true; viewHolder.BottomAnchor.ConstraintEqualTo(BottomAnchor).Active = true; viewHolder.Layer.CornerRadius = 8; bookThumbnail = new MvxCachedImageView { TranslatesAutoresizingMaskIntoConstraints = false }; viewHolder.Add(bookThumbnail); bookThumbnail.LeftAnchor.ConstraintEqualTo(viewHolder.LeftAnchor, 8).Active = true; bookThumbnail.CenterYAnchor.ConstraintEqualTo(viewHolder.CenterYAnchor).Active = true; bookThumbnail.HeightAnchor.ConstraintEqualTo(75).Active = true; bookThumbnail.WidthAnchor.ConstraintEqualTo(60).Active = true; bookThumbnail.Layer.MasksToBounds = true; bookThumbnail.Layer.CornerRadius = 4; var textContainer = new UIView { TranslatesAutoresizingMaskIntoConstraints = false }; viewHolder.Add(textContainer); textContainer.LeftAnchor.ConstraintEqualTo(bookThumbnail.RightAnchor, 8).Active = true; textContainer.RightAnchor.ConstraintEqualTo(viewHolder.RightAnchor, -8).Active = true; textContainer.TopAnchor.ConstraintEqualTo(bookThumbnail.TopAnchor).Active = true; bookName = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false }; textContainer.Add(bookName); bookName.LeftAnchor.ConstraintEqualTo(textContainer.LeftAnchor).Active = true; bookName.TopAnchor.ConstraintEqualTo(textContainer.TopAnchor).Active = true; bookName.RightAnchor.ConstraintEqualTo(textContainer.RightAnchor).Active = true; bookAuthor = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false }; textContainer.Add(bookAuthor); bookAuthor.LeftAnchor.ConstraintEqualTo(textContainer.LeftAnchor).Active = true; bookAuthor.TopAnchor.ConstraintEqualTo(bookName.BottomAnchor, 4).Active = true; bookAuthor.RightAnchor.ConstraintEqualTo(textContainer.RightAnchor).Active = true; bookAuthor.BottomAnchor.ConstraintEqualTo(textContainer.BottomAnchor).Active = true; }
public CustomTableViewCell(IntPtr handle) : base(handle) { _imageControl = new MvxCachedImageView(); _imageControl.BackgroundColor = UIColor.Red; ContentView.AddSubview(_imageControl); ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); SetNeedsUpdateConstraints(); this.DelayBind( () => { _imageControl.LoadingPlaceholderImagePath = "res:place.jpg"; _imageControl.ErrorPlaceholderImagePath = "res:place.jpg"; _imageControl.TransformPlaceholders = true; var set = this.CreateBindingSet <CustomTableViewCell, Image>(); set.Bind(_imageControl).For(v => v.DownsampleWidth).To(vm => vm.DownsampleWidth); set.Bind(_imageControl).For(v => v.Transformations).To(vm => vm.Transformations); set.Bind(_imageControl).For(v => v.ImagePath).To(vm => vm.Url); set.Apply(); } ); }
private void CreateUI() { SeparatorInset = UIEdgeInsets.Zero; _imageV = new MvxCachedImageView { TranslatesAutoresizingMaskIntoConstraints = false, ContentMode = UIViewContentMode.ScaleAspectFit }; ContentView.AddSubview(_imageV); ContentView.AddConstraint(NSLayoutConstraint.Create(_imageV, NSLayoutAttribute.Left, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Left, 1, 0)); ContentView.AddConstraint(NSLayoutConstraint.Create(_imageV, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1, 0)); ContentView.AddConstraint(NSLayoutConstraint.Create(_imageV, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Bottom, 1, 0)); ContentView.AddConstraint(NSLayoutConstraint.Create(_imageV, NSLayoutAttribute.Width, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Width, IMAGE_WIDTH, 0)); _priceL = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.BoldSystemFontOfSize(12), TextAlignment = UITextAlignment.Right }; _priceL.SetContentHuggingPriority((float)UILayoutPriority.Required, UILayoutConstraintAxis.Vertical); ContentView.AddSubview(_priceL); ContentView.AddConstraint(NSLayoutConstraint.Create(_priceL, NSLayoutAttribute.Left, NSLayoutRelation.Equal, _imageV, NSLayoutAttribute.Right, 1, MARGIN)); ContentView.AddConstraint(NSLayoutConstraint.Create(_priceL, NSLayoutAttribute.Right, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Right, 1, -MARGIN)); ContentView.AddConstraint(NSLayoutConstraint.Create(_priceL, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Bottom, 1, -MARGIN)); _titleL = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, Lines = 0 }; ContentView.AddSubview(_titleL); ContentView.AddConstraint(NSLayoutConstraint.Create(_titleL, NSLayoutAttribute.Left, NSLayoutRelation.Equal, _imageV, NSLayoutAttribute.Right, 1, MARGIN)); ContentView.AddConstraint(NSLayoutConstraint.Create(_titleL, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1, MARGIN)); ContentView.AddConstraint(NSLayoutConstraint.Create(_titleL, NSLayoutAttribute.Right, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Right, 1, -MARGIN)); ContentView.AddConstraint(NSLayoutConstraint.Create(_titleL, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, _priceL, NSLayoutAttribute.Top, 1, -MARGIN)); }
protected ProspectViewCell(IntPtr handle) : base(handle) { _imageControl = new MvxCachedImageView(); ContentView.AddSubview(_imageControl); ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); SetNeedsUpdateConstraints(); // Note: this .ctor should not contain any initialization logic. this.DelayBind(() => { var e = new Environment_iOS(); var theme = e.GetOperatingSystemTheme(); var set = this.CreateBindingSet <ProspectViewCell, Prospect>(); set.Bind(ProspectLabel).To(v => v.Name); set.Bind(ProspectLabel).For(v => v.TextColor).To(v => v).WithConversion("ProspectColor", theme); set.Bind(CommunityLabel).To(v => v.ProspectCommunity.Community.Description); set.Bind(SalespersonLabel).To(v => v.ProspectCommunity.SalespersonName); set.Bind(SystemActivityLabel).To(v => v.ProspectCommunity.SystemActivityDate).WithConversion(new DateOnlyConverter()); set.Bind(DayCountLabel).To(v => v.ProspectCommunity).WithConversion(new DayCountConverter()); //set.Bind(this).For(u => u.BackgroundColor).To(v => v).WithConversion(new ProspectBackgroundColorValueConverter()); set.Bind(_imageControl).For(i => i.ImagePath).To(v => v.ProspectCommunity.SalespersonAddressNumber).WithConversion(new ImageValueConverter()); set.Apply(); }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.file_detail); _userName = Intent.GetStringExtra(AppConstants.UserName); _ip = Intent.GetStringExtra(AppConstants.HostIp); _portNumber = Intent.GetIntExtra(AppConstants.PortNumber, 8080); _client = new FileSharingClient(_ip, _portNumber); _fileName = Intent.GetStringExtra(AppConstants.FileName); _image = FindViewById <MvxCachedImageView>(Resource.Id.imgMain); _image.SetImageDrawable(_fileName.HasImageExtension() ? ContextCompat.GetDrawable(Application.Context, Resource.Drawable.default_image) : ContextCompat.GetDrawable(Application.Context, Resource.Drawable.default_file)); _closeBtn = FindViewById <ImageView>(Resource.Id.closeBtn); _closeBtn.Click += CloseView; _downloadBtn = FindViewById <ImageView>(Resource.Id.downloadBtn); _downloadBtn.Click += Download; _imageData = _client.GetImage(_userName, _fileName).FileData; ImageService.Instance.LoadStream(GetStream).DownSample(500).Into(_image); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.admin_post_view); var appBarLayout = FindViewById <AppBarLayout>(Resource.Id.materialupAppbar); _mProfileImage = FindViewById <MvxCachedImageView>(Resource.Id.materialupProfileImage); var toolbar = FindViewById <Toolbar>(Resource.Id.materialupToolbar); toolbar.NavigationClick += (sender, args) => { OnBackPressed(); }; var recyclerView = FindViewById <MvxRecyclerView>(Resource.Id.pictureRecyclerView); if (recyclerView != null) { recyclerView.HasFixedSize = true; var layoutManager = new LinearLayoutManager(this) { Orientation = (int)Orientation.Horizontal }; recyclerView.SetLayoutManager(layoutManager); } appBarLayout.OffsetChanged += (sender, args) => { if (_mMaxScrollSize == 0) { _mMaxScrollSize = appBarLayout.TotalScrollRange; } var percentage = Math.Abs(args.VerticalOffset) * 100 / _mMaxScrollSize; if (percentage >= PercentageToAnimateAvatar && _mIsAvatarShown) { _mIsAvatarShown = false; _mProfileImage.Animate() .ScaleY(0).ScaleX(0) .SetDuration(200) .Start(); } if (percentage <= PercentageToAnimateAvatar && !_mIsAvatarShown) { _mIsAvatarShown = true; _mProfileImage.Animate() .ScaleY(1).ScaleX(1) .Start(); } }; }
public override void ViewDidLoad() { base.ViewDidLoad(); // ---------- BACKGROUND IMAGE --------- // var backgroundImage = new MvxCachedImageView { ContentMode = UIViewContentMode.ScaleAspectFill }; Add(backgroundImage); // Blur layer var blurEffect = UIBlurEffect.FromStyle(UIBlurEffectStyle.SystemThickMaterialDark); var blurredEffectView = new UIVisualEffectView(blurEffect); // Add the blur infront of the image Add(blurredEffectView); // ---------- TRACK IMAGE --------- // var trackImage = new MvxCachedImageView { ContentMode = UIViewContentMode.ScaleAspectFill, TranslatesAutoresizingMaskIntoConstraints = false }; trackImage.Layer.MasksToBounds = true; trackImage.Layer.CornerRadius = 6.0f; var shadowView = new UIView(); shadowView.Layer.ShadowOpacity = 0.4f; shadowView.Layer.ShadowColor = UIColor.Black.CGColor; shadowView.Layer.ShadowRadius = 26.0f; shadowView.Layer.ShadowOffset = new CGSize(0, 18); shadowView.AddSubview(trackImage); View.AddSubview(shadowView); // ---------- TITLE AND SUBTITLE --------- // var title = new UILabel { TextColor = UIColor.White, TextAlignment = UITextAlignment.Center, Font = UIFont.SystemFontOfSize(22f, UIFontWeight.Bold), LineBreakMode = UILineBreakMode.TailTruncation, Lines = 2 }; var subTitle = new UILabel { TextColor = UIColor.White, TextAlignment = UITextAlignment.Center, Font = UIFont.SystemFontOfSize(18f, UIFontWeight.Regular), LineBreakMode = UILineBreakMode.TailTruncation, Lines = 1, Alpha = 0.7f, }; Add(title); Add(subTitle);
protected override void OnCreate(Bundle savedInstanceState) { OverridePendingTransition(0, 0); SetTheme(StyleHelper.Style.CommonActivityStyle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_chat_details); _navigationBarView = FindViewById <NavigationBarView>(Resource.Id.activity_chat_details_navigation_bar); _navigationBarView.SetLeftButton(StyleHelper.Style.NavigationBarBackButtonIcon, ViewModel.BackCommand); _navigationBarView.SetTitle(ViewModel.LocalizedStrings.DetailsTitle); _navigationBarView.SetRightButton(ViewModel.LocalizedStrings.Save, new RelayCommand(OnSaveClick)); _navigationBarView.RightTextButton.Visibility = ViewStates.Gone; _chatPhotoImageView = FindViewById <MvxCachedImageView>(Resource.Id.iv_chat_photo); _chatEditedPhotoImageView = FindViewById <MvxCachedImageView>(Resource.Id.iv_chat_photo_edited); _chatNameText = FindViewById <TextView>(Resource.Id.activity_chat_details_chat_name); _chatNameEditText = FindViewById <EditText>(Resource.Id.activity_chat_details_chat_name_edit); _chatMembersCountTextView = FindViewById <TextView>(Resource.Id.tv_members_count); _addMemberContainer = FindViewById <LinearLayout>(Resource.Id.activity_chat_details_add_member_container); _addmemberImageView = FindViewById <ImageView>(Resource.Id.activity_chat_details_add_member_image); _addmemberImageView.SetImageResource(StyleHelper.Style.AddMemberIcon); _addMemberTextView = FindViewById <TextView>(Resource.Id.activity_chat_details_add_member_text); _addMemberTextView.Text = ViewModel.LocalizedStrings.AddMembers; _membersRecyclerView = FindViewById <RecyclerView>(Resource.Id.rv_contacts_list); _changeChatPhotoButton = FindViewById <Button>(Resource.Id.b_chat_change_photo); _changeChatPhotoButton.SetCommand(new RelayCommand(OpenImagePicker)); _changeChatPhotoButton.Text = ViewModel.LocalizedStrings.ChangePhoto; _muteNotificationsLabel = FindViewById <TextView>(Resource.Id.activity_chat_details_mute_label); _muteNotificationsLabel.Text = ViewModel.LocalizedStrings.Notifications; _muteNotificationsSwitch = FindViewById <SwitchCompat>(Resource.Id.activity_chat_details_mute_switch); _muteNotificationsSwitch.SetCommand(ViewModel.HeaderViewModel.ChangeMuteNotificationsCommand); InitializeMembersRecyclerView(); // TODO YP: remove ServiceLocator _imagePicker = new ImagePicker( Dependencies.Container.Resolve <IPermissionsManager>(), Dependencies.Container.Resolve <IImagePickerService>()) { MaxImageWidth = 300 }; _busyOverlayView = FindViewById <BusyOverlayView>(Resource.Id.activity_chat_details_busy_view); }
public ParallaxHeader(string imageUrl, CoreGraphics.CGRect frame) : base(frame) { this.AutosizesSubviews = true; this.ImageView = new MvxCachedImageView(new CoreGraphics.CGRect(0, 0, frame.Width, frame.Height)); this.ImageView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; this.ImageView.ContentMode = UIViewContentMode.ScaleAspectFill; this.ImageView.ImagePath = imageUrl; this.ImageView.ClipsToBounds = true; UIEdgeInsets newInset = this.ContentInset; newInset.Top = -UIApplication.SharedApplication.StatusBarFrame.Height; this.ContentInset = newInset; this.AddSubview(this.ImageView); }
protected override void OnCreate(Bundle savedInstanceState) { OverridePendingTransition(0, 0); SetTheme(StyleHelper.Style.CommonActivityStyle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_chat_create); _navigationBarView = FindViewById <NavigationBarView>(Resource.Id.activity_chat_create_navigation_bar); _navigationBarView.SetLeftButton(StyleHelper.Style.NavigationBarBackButtonIcon, ViewModel.BackCommand); _navigationBarView.SetTitle(ViewModel.LocalizedStrings.CreateGroup); _navigationBarView.SetRightButton(ViewModel.LocalizedStrings.Create, new RelayCommand(() => { KeyboardService.HideSoftKeyboard(_chatNameEditTextView); ViewModel.SaveCommand.Execute(_imagePicker.GetStreamFunc()); })); _navigationBarView.RightTextButton.SetBackgroundColor(Color.Transparent); _chatPhotoImageView = FindViewById <MvxCachedImageView>(Resource.Id.iv_chat_photo); _chatEditedPhotoImageView = FindViewById <MvxCachedImageView>(Resource.Id.iv_chat_photo_edited); _chatNameEditTextView = FindViewById <EditText>(Resource.Id.et_chat_name); _contactsRecyclerView = FindViewById <RecyclerView>(Resource.Id.rv_contacts_list); _membersCountTextView = FindViewById <TextView>(Resource.Id.tv_members_count); _changeChatPhotoButton = FindViewById <Button>(Resource.Id.b_chat_change_photo); _changeChatPhotoButton.SetCommand(new RelayCommand(ChangePhoto)); _changeChatPhotoButton.Text = ViewModel.LocalizedStrings.ChangePhoto; InitializeContactsRecyclerView(); _imagePicker = new ImagePicker(Dependencies.PermissionsManager, Dependencies.Container.Resolve <IImagePickerService>()) { MaxImageWidth = 300 }; _chatPhotoImageView.SetImageResource(StyleHelper.Style.ChatGroupNoAvatarIcon); _chatEditedPhotoImageView.Visibility = ViewStates.Gone; _addMembers = FindViewById <Button>(Resource.Id.activity_chat_create_add_member); _addMembers.Text = ViewModel.LocalizedStrings.AddMembers; _addMembers.SetCommand(ViewModel.AddMembersCommand); _chatNameEditTextView.Hint = ViewModel.LocalizedStrings.ChatName; _busyOverlayView = FindViewById <BusyOverlayView>(Resource.Id.activity_chat_create_busy_view); }
private void Init(Context context, IAttributeSet attrs = null) { ClipToOutline = true; //Elevation = TypedValue.ApplyDimension(ComplexUnitType.Dip, 18, context.Resources.DisplayMetrics); var layoutParams = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); layoutParams.AddRule(LayoutRules.CenterInParent); _imageView = new MvxCachedImageView(context) { LayoutParameters = layoutParams }; AddView(_imageView); }
public WeatherView() { _cityNameLabel = new MediumLabel(); _temperatureLabel = new LargeLabel(); _temperaturePanel = new UIView(); _dateLabel = new NormalLabel(); _synopsisLabel = new NormalLabel(); _weatherTableView = new UITableView(); _iconImage = new MvxCachedImageView(); this.DelayBind(() => { var delaySet = this.CreateBindingSet <WeatherView, WeatherViewModel>(); delaySet.Bind(_iconImage).For(v => v.ImagePath).To(vm => vm.IconUrl); delaySet.Apply(); }); }
public ChatViewHolder(View itemView, Action <ChatSummaryViewModel> selectChatAction) : base(itemView) { _selectChatAction = new WeakAction <ChatSummaryViewModel>(selectChatAction); _chatPhotoImageView = itemView.FindViewById <MvxCachedImageView>(Resource.Id.chat_photo_image_view); _chatNameTextView = itemView.FindViewById <TextView>(Resource.Id.chat_name_text_view); _userNameTextView = itemView.FindViewById <TextView>(Resource.Id.username_text_view); _messageBodyTextView = itemView.FindViewById <TextView>(Resource.Id.message_body_text_view); _dateTimeTextView = itemView.FindViewById <TextView>(Resource.Id.date_time_text_view); _unreadMessageCountTextView = itemView.FindViewById <TextView>(Resource.Id.unreaded_messages_count_text_view); _messageStatusIndicatorView = itemView.FindViewById <View>(Resource.Id.message_status_indicator); _messageBodyPhotoView = itemView.FindViewById <LinearLayout>(Resource.Id.chat_message_body_photo_view); _messageBodyPhotoImageView = itemView.FindViewById <ImageView>(Resource.Id.chat_message_body_photo_icon); _messageBodyPhotoLabel = itemView.FindViewById <TextView>(Resource.Id.chat_message_body_photo_label); itemView.SetCommand(nameof(itemView.Click), new RelayCommand(ChatClickHandler)); }
public static void LoadImageAsync( this MvxCachedImageView imageView, string bundleResourceName, string url, TransformationBase transformationBase = null) { if (string.IsNullOrEmpty(url)) { imageView.SetImageDrawable(null); if (!string.IsNullOrEmpty(bundleResourceName)) { var loadTask = ImageService.Instance .LoadCompiledResource(bundleResourceName); if (transformationBase != null) { loadTask = loadTask.Transform(transformationBase); } loadTask.IntoAsync(imageView); } return; } var expr = ImageService.Instance.LoadUrl(url); if (!string.IsNullOrEmpty(bundleResourceName)) { expr = expr.LoadingPlaceholder(bundleResourceName, ImageSource.CompiledResource) .ErrorPlaceholder(bundleResourceName, ImageSource.CompiledResource); } if (transformationBase != null) { expr = expr.Transform(transformationBase); } expr.IntoAsync(imageView); }
public static void LoadImageAsync(this MvxCachedImageView imageView, string boundleResource, string url) { if (string.IsNullOrEmpty(url)) { imageView.Image?.Dispose(); imageView.Image = null; if (!string.IsNullOrEmpty(boundleResource)) { imageView.Image = UIImage.FromBundle(boundleResource); } return; } var expr = ImageService.Instance.LoadUrl(url); if (!string.IsNullOrEmpty(boundleResource)) { expr = expr.LoadingPlaceholder(boundleResource, ImageSource.CompiledResource) .ErrorPlaceholder(boundleResource, ImageSource.CompiledResource); } expr.IntoAsync(imageView); }
public void LoadProfileDetails(int position, MvxCachedImageView image) { FeedItemModel item = (FeedItemModel)GetItem(position); Delegate.LoadProfileDetails(item, image); }
private void InitializeUi() { // Holds all the views var viewHolder = new UIView { TranslatesAutoresizingMaskIntoConstraints = false }; Add(viewHolder); // Track Thumbnail _imageControl = new MvxCachedImageView { TranslatesAutoresizingMaskIntoConstraints = false, ContentMode = UIViewContentMode.ScaleAspectFill }; _imageControl.Layer.MasksToBounds = true; _imageControl.Layer.CornerRadius = _imageCornerRadius; var shadowView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false }; shadowView.Layer.ShadowOpacity = 0.6f; shadowView.Layer.ShadowColor = UIColor.Black.CGColor; shadowView.Layer.ShadowRadius = 4.0f; shadowView.Layer.ShadowOffset = new CGSize(0, 3); shadowView.AddSubview(_imageControl); viewHolder.Add(shadowView); shadowView.LeftAnchor.ConstraintEqualTo(viewHolder.LeftAnchor, 4).Active = true; shadowView.TopAnchor.ConstraintEqualTo(viewHolder.TopAnchor, 4).Active = true; shadowView.HeightAnchor.ConstraintEqualTo(160).Active = true; shadowView.WidthAnchor.ConstraintEqualTo(160).Active = true; _imageControl.HeightAnchor.ConstraintEqualTo(160).Active = true; _imageControl.WidthAnchor.ConstraintEqualTo(160).Active = true; _imageControl.LeftAnchor.ConstraintEqualTo(shadowView.LeftAnchor).Active = true; _imageControl.TopAnchor.ConstraintEqualTo(shadowView.TopAnchor).Active = true; // Right Footer _rightFooter = new UILabel { TextColor = UIColor.White, TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.SystemFontOfSize(12f, UIFontWeight.Semibold) }; _imageControl.Add(_rightFooter); // Position the right footer _rightFooter.RightAnchor.ConstraintEqualTo(_imageControl.RightAnchor, -8).Active = true; _rightFooter.BottomAnchor.ConstraintEqualTo(_imageControl.BottomAnchor, -6).Active = true; // Left Footer _leftFooter = new UILabel { TextColor = UIColor.White, TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.FromName("FontAwesome5Pro-Light", 12) }; _imageControl.Add(_leftFooter); // Position the left footer _leftFooter.LeftAnchor.ConstraintEqualTo(_imageControl.LeftAnchor, 8).Active = true; _leftFooter.BottomAnchor.ConstraintEqualTo(_imageControl.BottomAnchor, -6).Active = true; // Title _title = new UILabel { TextColor = ColorHelper.Text0.ToPlatformColor(), TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.SystemFontOfSize(14f, UIFontWeight.Semibold), }; viewHolder.Add(_title); _title.LeftAnchor.ConstraintEqualTo(viewHolder.LeftAnchor, 6).Active = true; _title.TopAnchor.ConstraintEqualTo(viewHolder.TopAnchor, 174).Active = true; _title.WidthAnchor.ConstraintEqualTo(160).Active = true; // Subtitle _subtitle = new UILabel { TextColor = ColorHelper.Text0.ToPlatformColor(), TranslatesAutoresizingMaskIntoConstraints = false, Alpha = 0.8f, Font = UIFont.SystemFontOfSize(13f, UIFontWeight.Medium) }; viewHolder.Add(_subtitle); _subtitle.LeftAnchor.ConstraintEqualTo(viewHolder.LeftAnchor, 6).Active = true; _subtitle.TopAnchor.ConstraintEqualTo(viewHolder.TopAnchor, 194).Active = true; _subtitle.WidthAnchor.ConstraintEqualTo(160).Active = true; // The controller used for extra info _alertController = UIAlertController.Create("", "", UIAlertControllerStyle.ActionSheet); // Add the default close _alertController.AddAction(UIAlertAction.Create("Close", UIAlertActionStyle.Cancel, _ => _alertController.DismissViewController(true, null))); var gr = new UILongPressGestureRecognizer(); gr.AddTarget(() => LongPressed(gr)); AddGestureRecognizer(gr); }
public FeedCellHolder(View itemView, IMvxAndroidBindingContext bindingContext) : base(itemView, bindingContext) { _headerLayout = itemView.FindViewById <RelativeLayout>(Resource.Id.headerLayout); _mediaContent = itemView.FindViewById <RelativeLayout>(Resource.Id.mediaContentLayout); _invieToJoinLayout = itemView.FindViewById <RelativeLayout>(Resource.Id.itjFeedContentLayout); _eventNameTextView = itemView.FindViewById <TextView>(Resource.Id.titleTextView); _mvxImageView = itemView.FindViewById <MvxCachedImageView>(Resource.Id.contentImageView); _itbFeedContentLayout = itemView.FindViewById <RelativeLayout>(Resource.Id.itbFeedContentLayout); _mapLayout = itemView.FindViewById <ConstraintLayout>(Resource.Id.mapContentLayout); _readAllCommentsButton = itemView.FindViewById <Button>(Resource.Id.readCommentsButton); _commentsTextView = itemView.FindViewById <TextView>(Resource.Id.commentsTextView); _aggContentLayout = itemView.FindViewById <LinearLayout>(Resource.Id.aggFeedContentLayout); _rewardClaimed = itemView.FindViewById <RelativeLayout>(Resource.Id.rewardClaimedContent); _likesIcon = itemView.FindViewById <MvxCachedImageView>(Resource.Id.likesIcon); _commentIcon = itemView.FindViewById <MvxCachedImageView>(Resource.Id.commentsIcon); _aggregateRecyclerView = itemView.FindViewById <MvxRecyclerView>(Resource.Id.aggCollection); _footerRelativelayout = itemView.FindViewById <RelativeLayout>(Resource.Id.footerContentLayout); _feedImageOverlay = itemView.FindViewById <ImageView>(Resource.Id.gradient_overlay_image); _reportImageButton = itemView.FindViewById <ImageView>(Resource.Id.report_button); _actorImageView = itemView.FindViewById <MvxCachedImageView>(Resource.Id.ActorImage); _agg_background_image = itemView.FindViewById <MvxCachedImageView>(Resource.Id.agg_background_image); _agg_subIcon = itemView.FindViewById <ImageView>(Resource.Id.agg_sub_icon_image); _likeTextView = itemView.FindViewById <TextView>(Resource.Id.likesCountText); _mapView = itemView.FindViewById <MapView>(Resource.Id.map_view); _aggregate_text = itemView.FindViewById <TextView>(Resource.Id.aggregate_text); _actorNameTextView = itemView.FindViewById <TextView>(Resource.Id.actorNameTextView); _context = itemView.Context; _aggregateRecyclerView.Adapter = new AggFeedAdapter((IMvxAndroidBindingContext)BindingContext); var layoutManager = new LinearLayoutManager(_context); layoutManager.Orientation = LinearLayoutManager.Horizontal; _aggregateRecyclerView.SetLayoutManager(layoutManager); this.DelayBind(() => { var set = this.CreateBindingSet <FeedCellHolder, FeedItemModel>(); set.Bind(_commentsTextView).For(x => x.TextFormatted).To(x => x.FilteredEngagementList).OneTime().WithConversion(new ListEngagementToCommentsConverter(), 3); set.Bind(_aggregateRecyclerView).For(x => x.ItemsSource).To(x => x.AggregateProfileImageUrls); set.Apply(); }); //_readAllCommentsButton.Click += OnReadCommentButtonClick; //_likesIcon.Click += OnLikeButtonClick; //_commentIcon.Click += OnCommentButtonClick; //_actorImageView.Click += OnLoadFriendFeedButtonClick; AddEvents(); _reportImageButton.Click += ((sender, e) => { Delegate.PostReportIt(AdapterPosition); }); var tnnITB = itemView.FindViewById <Button>(Resource.Id.inviteToBuyBtn); tnnITB.Click += (s, e) => { Delegate.InviteToBuyClick(AdapterPosition); }; var btnITJ = itemView.FindViewById <Button>(Resource.Id.inviteToJoinBtn); btnITJ.Click += (s, e) => { Delegate.InviteToJoinClick(AdapterPosition); }; UpdateFonts(); }
public void LoadProfileDetails(FeedItemModel feedItem, MvxCachedImageView image) { AnimatedUserImage = image; AnimatedUserImagePath = AnimatedUserImage.ImagePath; ViewModel.LoadFeedByUrlCommand.Execute(feedItem); }
private void CreateView() { // Root View with the shadow var rootView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = ColorHelper.Background4DP.ToPlatformColor(), UserInteractionEnabled = true }; rootView.Layer.ShadowOpacity = 0.6f; rootView.Layer.ShadowColor = UIColor.Black.CGColor; rootView.Layer.ShadowRadius = 4.0f; rootView.Layer.ShadowOffset = new CGSize(0, 2); rootView.Layer.CornerRadius = 6.0f; // Thumbnail var imageControl = new MvxCachedImageView { TranslatesAutoresizingMaskIntoConstraints = false, ContentMode = UIViewContentMode.ScaleAspectFill }; imageControl.Layer.MasksToBounds = true; imageControl.Layer.CornerRadius = 6.0f; rootView.AddSubview(imageControl); imageControl.HeightAnchor.ConstraintEqualTo(Height - 8).Active = true; imageControl.WidthAnchor.ConstraintEqualTo(Height - 8).Active = true; imageControl.LeftAnchor.ConstraintEqualTo(rootView.LeftAnchor, 4).Active = true; imageControl.TopAnchor.ConstraintEqualTo(rootView.TopAnchor, 4).Active = true; // Title var title = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, TextColor = ColorHelper.Text0.ToPlatformColor(), Font = UIFont.SystemFontOfSize(14f, UIFontWeight.Bold), LineBreakMode = UILineBreakMode.TailTruncation, Lines = 1 }; // Subtitle var subTitle = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, TextColor = ColorHelper.Text0.ToPlatformColor(), Alpha = 0.7f, Font = UIFont.SystemFontOfSize(13f, UIFontWeight.Regular), LineBreakMode = UILineBreakMode.TailTruncation, Lines = 1 }; rootView.AddSubview(title); rootView.AddSubview(subTitle); // Constraints title.TopAnchor.ConstraintEqualTo(rootView.TopAnchor, 14).Active = true; title.LeftAnchor.ConstraintEqualTo(imageControl.RightAnchor, 10).Active = true; title.RightAnchor.ConstraintEqualTo(rootView.RightAnchor, 0); // Ensure the label is fully set title.PreferredMaxLayoutWidth = title.Frame.Size.Width; title.SizeToFit(); subTitle.TopAnchor.ConstraintEqualTo(title.BottomAnchor, 3).Active = true; subTitle.LeftAnchor.ConstraintEqualTo(imageControl.RightAnchor, 10).Active = true; subTitle.RightAnchor.ConstraintEqualTo(rootView.RightAnchor, 0); // Ensure the label is fully set subTitle.PreferredMaxLayoutWidth = subTitle.Frame.Size.Width; subTitle.SizeToFit(); // Add root Add(rootView); // Root view constraints rootView.TranslatesAutoresizingMaskIntoConstraints = false; rootView.TopAnchor.ConstraintEqualTo(TopAnchor).Active = true; rootView.BottomAnchor.ConstraintEqualTo(BottomAnchor).Active = true; rootView.LeftAnchor.ConstraintEqualTo(LeftAnchor).Active = true; rootView.RightAnchor.ConstraintEqualTo(RightAnchor).Active = true; this.DelayBind(() => { var set = this.CreateBindingSet <NowPlayingBar, PlaybackViewModel>(); set.Bind(title).For(x => x.Text).To(vm => vm.CurrentTrack.Title); set.Bind(subTitle).For(x => x.Text).To(vm => vm.CurrentTrack.User.Username); set.Bind(imageControl).For(x => x.ImagePath).To(vm => vm.CurrentTrack.ArtworkUrl); set.Apply(); }); }
private void InitializeUi() { // Root View with the shadow var rootView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false }; Add(rootView); // Root view constraints rootView.HeightAnchor.ConstraintEqualTo(CellHeight).Active = true; rootView.LeftAnchor.ConstraintEqualTo(LeftAnchor, 18).Active = true; rootView.TopAnchor.ConstraintEqualTo(TopAnchor).Active = true; rootView.RightAnchor.ConstraintEqualTo(RightAnchor, -18).Active = true; // Thumbnail _imageControl = new MvxCachedImageView { TranslatesAutoresizingMaskIntoConstraints = false, ContentMode = UIViewContentMode.ScaleAspectFill }; _imageControl.Layer.MasksToBounds = true; _imageControl.Layer.CornerRadius = 6.0f; var shadowView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false }; shadowView.Layer.ShadowOpacity = 0.6f; shadowView.Layer.ShadowColor = UIColor.Black.CGColor; shadowView.Layer.ShadowRadius = 4.0f; shadowView.Layer.ShadowOffset = new CGSize(0, 3); shadowView.AddSubview(_imageControl); rootView.Add(shadowView); shadowView.HeightAnchor.ConstraintEqualTo(CellHeight - 18).Active = true; shadowView.WidthAnchor.ConstraintEqualTo(CellHeight - 18).Active = true; shadowView.LeftAnchor.ConstraintEqualTo(rootView.LeftAnchor).Active = true; shadowView.TopAnchor.ConstraintEqualTo(rootView.TopAnchor, 18).Active = true; // Make sure the image is correctly sized _imageControl.HeightAnchor.ConstraintEqualTo(shadowView.HeightAnchor).Active = true; _imageControl.WidthAnchor.ConstraintEqualTo(shadowView.WidthAnchor).Active = true; _imageControl.LeftAnchor.ConstraintEqualTo(shadowView.LeftAnchor).Active = true; _imageControl.TopAnchor.ConstraintEqualTo(shadowView.TopAnchor).Active = true; // Right Footer _rightFooter = new UILabel { TextColor = UIColor.White, TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.SystemFontOfSize(11, UIFontWeight.Semibold) }; _imageControl.Add(_rightFooter); // Position the right footer _rightFooter.RightAnchor.ConstraintEqualTo(_imageControl.RightAnchor, -6).Active = true; _rightFooter.BottomAnchor.ConstraintEqualTo(_imageControl.BottomAnchor, -4).Active = true; // Left Footer _leftFooter = new UILabel { TextColor = UIColor.White, TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.FromName("FontAwesome5Pro-Light", 11) }; _imageControl.Add(_leftFooter); // Position the left footer _leftFooter.LeftAnchor.ConstraintEqualTo(_imageControl.LeftAnchor, 8).Active = true; _leftFooter.BottomAnchor.ConstraintEqualTo(_imageControl.BottomAnchor, -6).Active = true; // Title _title = new UILabel { TextColor = ColorHelper.Text0.ToPlatformColor(), TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.SystemFontOfSize(16f, UIFontWeight.Bold), LineBreakMode = UILineBreakMode.TailTruncation, Lines = 1, }; rootView.Add(_title); _title.LeftAnchor.ConstraintEqualTo(shadowView.RightAnchor, 12).Active = true; _title.RightAnchor.ConstraintEqualTo(rootView.RightAnchor).Active = true; _title.TopAnchor.ConstraintEqualTo(rootView.TopAnchor, 34).Active = true; // Ensure the label is fully set _title.PreferredMaxLayoutWidth = _title.Frame.Size.Width; _title.SizeToFit(); // Subtitle _subtitle = new UILabel { TextColor = ColorHelper.Text0.ToPlatformColor(), TranslatesAutoresizingMaskIntoConstraints = false, Alpha = 0.7f, Font = UIFont.SystemFontOfSize(15f, UIFontWeight.Regular), LineBreakMode = UILineBreakMode.TailTruncation, Lines = 1, }; rootView.Add(_subtitle); _subtitle.LeftAnchor.ConstraintEqualTo(shadowView.RightAnchor, 12).Active = true; _subtitle.RightAnchor.ConstraintEqualTo(rootView.RightAnchor).Active = true; _subtitle.TopAnchor.ConstraintEqualTo(_title.BottomAnchor, 4).Active = true; // Ensure the label is fully set _subtitle.PreferredMaxLayoutWidth = _subtitle.Frame.Size.Width; _subtitle.SizeToFit(); }
public AggFeedCellHolder(View itemView, IMvxAndroidBindingContext context, string imageUrl = null) : base(itemView, context) { _actorIcon = itemView.FindViewById <MvxCachedImageView>(Resource.Id.agg_actor_iconImageView); _countText = itemView.FindViewById <TextView>(Resource.Id.count_more_text); }
public void Include(MvxCachedImageView v) { ImageService.Instance.LoadCompiledResource("@drawable/matreshka7").Into(v); }