public void ClickOnShareButton() { if (ShareButton.Displayed) { ShareButton.Click(); } else { throw new Exception("Element is not found or not clickable"); } }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Button> e) { base.OnElementChanged(e); RegisterForShare(); if (Control != null) { ShareButton share = e.NewElement as ShareButton; share.Clicked += ShareClick; } }
protected override void OnElementChanged(ElementChangedEventArgs <Button> e) { base.OnElementChanged(e); if (Control != null) { ShareButton share = e.NewElement as ShareButton; _path = share.Path; Control.TouchUpInside += ShareClick; } }
public override void OnViewCreated(View view, Bundle savedInstanceState) { RenderHeader(Item); if (isAlbum) { RenderAlbum(Item); } else { RenderImage(Item); } BindVotes(); ShareButton.SetCommand("Click", Item.ShareCommand); base.OnViewCreated(view, savedInstanceState); AnalyticsHelper.SendView("BrowserItem"); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); FacebookSdk.SdkInitialize(this.ApplicationContext); // Set our view from the "main" layout resource mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChanged += MProfileTracker_mOnProfileChanged; mProfileTracker.StartTracking(); SetContentView(Resource.Layout.Main); Button faceBookButton = FindViewById <Button>(Resource.Id.button); mTxtFirstName = FindViewById <TextView>(Resource.Id.txtFirstName); mTxtLastName = FindViewById <TextView>(Resource.Id.txtLastName); mTxtName = FindViewById <TextView>(Resource.Id.txtName); mProfilePic = FindViewById <ProfilePictureView>(Resource.Id.profilePic); mBtnShared = FindViewById <ShareButton>(Resource.Id.btnShare); mBtnGetEmail = FindViewById <Button>(Resource.Id.btnGetEmail); LoginButton button = FindViewById <LoginButton>(Resource.Id.login_button); button.SetReadPermissions(new List <string> { "public_profile", "user_friends", "email" }); mCallBackManager = CallbackManagerFactory.Create(); button.RegisterCallback(mCallBackManager, this); mBtnGetEmail.Click += (o, e) => { GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,name,age_range,email"); request.Parameters = parameters; request.ExecuteAsync(); }; ShareLinkContent content = new ShareLinkContent.Builder().Build(); mBtnShared.ShareContent = content; }
void OnPropertyChanged(object sender, PropertyChangedEventArgs args) { var name = args.PropertyName; if (name.Equals("IsLikedByUser")) { LikeButton.SetTitleColor(ViewModel.LikeButtonTextColor.ToUIColor(), UIControlState.Normal); LikeButton.SetTitle(ViewModel.LikeButtonText, UIControlState.Normal); } else if (name.Equals("IsCommentedByUser")) { CommentButton.SetTitleColor(ViewModel.CommentButtonTextColor.ToUIColor(), UIControlState.Normal); CommentButton.SetTitle(ViewModel.CommentButtonText, UIControlState.Normal); } else if (name.Equals("IsSharedByUser")) { ShareButton.SetTitleColor(ViewModel.ShareButtonTextColor.ToUIColor(), UIControlState.Normal); ShareButton.SetTitle(ViewModel.ShareButtonText, UIControlState.Normal); } }
void ReleaseDesignerOutlets() { if (RandomizeButton != null) { RandomizeButton.Dispose(); RandomizeButton = null; } if (ShareButton != null) { ShareButton.Dispose(); ShareButton = null; } if (Viewer != null) { Viewer.Dispose(); Viewer = null; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.endgame_activity); string winnerText = Intent.GetStringExtra(StringConstants.END_MESSAGE); figure = (Figures)Intent.GetIntExtra(StringConstants.FIGURE, (int)Figures.X); buttonRestart = FindViewById <Button>(Resource.Id.RestartButton); textViewWinnerName = FindViewById <TextView>(Resource.Id.TextViewWinnerName); shareButton = FindViewById <ShareButton>(Resource.Id.fb_share_button); textViewWinnerName.Text = winnerText; //Share content to FB ShareLinkContent.Builder builder = new ShareLinkContent.Builder(); builder.SetContentUrl(Android.Net.Uri.Parse("DI.FM")); ShareContent content = builder.Build(); shareButton.ShareContent = content; }
void InitUI() { // Adjust constraints as needed PhotoImageViewHeightConstraint.Constant = ViewModel.ShowImage ? _photoImageViewDefaultHeightConstraint : 0; // Map values to UI elements BodyTextView.Text = null; BodyTextView.Text = ViewModel.Text; BodyTextViewHeightConstraint.Constant = BodyTextView.SizeThatFits(new CGSize(BodyTextView.Frame.Width, nfloat.MaxValue)).Height; TimeLabel.Text = ViewModel.ShowDateTime ? ViewModel.DisplayDateTime : string.Empty; NameLabel.SetHighlightText(ViewModel.UserName, ViewModel.UserName.IndexOf("@"), UIColor.LightGray); LikeButton.SetTitle(ViewModel.LikeButtonText, UIControlState.Normal); LikeButton.SetTitleColor(ViewModel.LikeButtonTextColor.ToUIColor(), UIControlState.Normal); CommentButton.SetTitle(ViewModel.CommentButtonText, UIControlState.Normal); CommentButton.SetTitleColor(ViewModel.CommentButtonTextColor.ToUIColor(), UIControlState.Normal); ShareButton.SetTitle(ViewModel.ShareButtonText, UIControlState.Normal); ShareButton.SetTitleColor(ViewModel.ShareButtonTextColor.ToUIColor(), UIControlState.Normal); if (ViewModel.ShowImage) { ActivityIndicator.StartAnimating(); } else { ActivityIndicator.StopAnimating(); } SocialTypeImageView.Image = UIImage.FromBundle(ViewModel.SocialMediaImage); SocialTypeImageView.Hidden = !ViewModel.ShowSocialMediaImage; UserImageView.SetImage( url: new NSUrl(ViewModel.UserImageUrl), placeholder: UIImage.FromBundle(ViewModel.UserImagePlaceholder) ); if (ViewModel.ShowImage) { PhotoImageView.SetImage( url: new NSUrl(ViewModel.ImageUrl), completionHandler: ((UIImage image, NSError error, SDImageCacheType cacheType, NSUrl imageUrl) => { ActivityIndicator.StopAnimating(); }) ); } else { PhotoImageView.Image = null; } if (ViewModel.ShowTimeline) { ContainerViewLeadingConstraint.Constant = _containerViewTimelineLeadingConstraint; TimelineView.Hidden = false; } else { ContainerViewLeadingConstraint.Constant = _containerViewDefaultLeadingConstraint; TimelineView.Hidden = true; } CommentButton.Hidden = !ViewModel.ShowCommentButton; ShareButton.Hidden = !ViewModel.ShowShareButton; // TODO: Remove this when we're ready to support sharing ShareButton.Hidden = true; }
void ReleaseDesignerOutlets() { if (EditAnnotationButton != null) { EditAnnotationButton.Dispose(); EditAnnotationButton = null; } if (HistoryButton != null) { HistoryButton.Dispose(); HistoryButton = null; } if (InfoButton != null) { InfoButton.Dispose(); InfoButton = null; } if (MainView != null) { MainView.Dispose(); MainView = null; } if (MainWindow != null) { MainWindow.Dispose(); MainWindow = null; } if (SearchField != null) { SearchField.Dispose(); SearchField = null; } if (SegmentContol != null) { SegmentContol.Dispose(); SegmentContol = null; } if (ShareButton != null) { ShareButton.Dispose(); ShareButton = null; } if (SplitSwithButton != null) { SplitSwithButton.Dispose(); SplitSwithButton = null; } if (TitleTField != null) { TitleTField.Dispose(); TitleTField = null; } if (ShareCustomMenu != null) { ShareCustomMenu.Dispose(); ShareCustomMenu = null; } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // create a timer that can be used to autohide this toolbar. NavBarTimer = new System.Timers.Timer(); NavBarTimer.AutoReset = false; NavBarTimer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { // when the timer fires, hide the toolbar. // Although the timer fires on a seperate thread, because we queue the reveal // on the main (UI) thread, we don't have to worry about race conditions. Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { InternalReveal(false); }); }; ButtonLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); ButtonLayout.BaselineAligned = false; // set the nav subBar color (including opacity) Color navColor = Rock.Mobile.UI.Util.GetUIColor(PrivateSubNavToolbarConfig.BackgroundColor); navColor.A = (Byte)((float)navColor.A * PrivateSubNavToolbarConfig.Opacity); ButtonLayout.SetBackgroundColor(navColor); ButtonLayout.LayoutParameters.Height = (int)Rock.Mobile.Graphics.Util.UnitToPx(50.0f); uint disabledColor = Rock.Mobile.Graphics.Util.ScaleRGBAColor(ControlStylingConfig.TextField_PlaceholderTextColor, 4, false); // create the back button BackButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)BackButton.LayoutParameters).Gravity = GravityFlags.Top; // set the back button's font Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(PrivateControlStylingConfig.Icon_Font_Secondary); BackButton.SetTypeface(fontFace, TypefaceStyle.Normal); BackButton.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateSubNavToolbarConfig.BackButton_Size); BackButton.Text = PrivateSubNavToolbarConfig.BackButton_Text; BackButton.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(0)); BackButton.SetPadding(0, 0, 0, 0); BackButton.Click += delegate { Activity.OnBackPressed(); }; // default to NOT enabled BackButton.Enabled = false; // use the completely overcomplicated color states to set the normal vs pressed color state. int [][] states = new int[][] { new int[] { Android.Resource.Attribute.StatePressed }, new int[] { Android.Resource.Attribute.StateEnabled }, new int[] { -Android.Resource.Attribute.StateEnabled }, }; int [] colors = new int[] { Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor), Rock.Mobile.UI.Util.GetUIColor(disabledColor), }; BackButton.SetTextColor(new Android.Content.Res.ColorStateList(states, colors)); // create the share button ShareButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)ShareButton.LayoutParameters).Gravity = GravityFlags.Top; // set the share button's font fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(PrivateControlStylingConfig.Icon_Font_Secondary); ShareButton.SetTypeface(fontFace, TypefaceStyle.Normal); ShareButton.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateSubNavToolbarConfig.ShareButton_Size); ShareButton.SetPadding(0, 0, 0, 0); ShareButton.Text = PrivateSubNavToolbarConfig.ShareButton_Text; ShareButton.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(0)); // default to NOT enabled ShareButton.Enabled = false; // use the completely overcomplicated color states to set the normal vs pressed color state. states = new int[][] { new int[] { Android.Resource.Attribute.StatePressed }, new int[] { Android.Resource.Attribute.StateEnabled }, new int[] { -Android.Resource.Attribute.StateEnabled }, }; colors = new int[] { Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor), Rock.Mobile.UI.Util.GetUIColor(disabledColor), }; ShareButton.SetTextColor(new Android.Content.Res.ColorStateList(states, colors)); // create the "create" button CreateButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)CreateButton.LayoutParameters).Gravity = GravityFlags.Top; // set the create button's font fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(PrivateControlStylingConfig.Icon_Font_Secondary); CreateButton.SetTypeface(fontFace, TypefaceStyle.Normal); CreateButton.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateSubNavToolbarConfig.CreateButton_Size); CreateButton.SetPadding(0, 0, 0, 0); CreateButton.Text = PrivateSubNavToolbarConfig.CreateButton_Text; CreateButton.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(0)); // default to NOT enabled CreateButton.Enabled = false; // use the completely overcomplicated color states to set the normal vs pressed color state. states = new int[][] { new int[] { Android.Resource.Attribute.StatePressed }, new int[] { Android.Resource.Attribute.StateEnabled }, new int[] { -Android.Resource.Attribute.StateEnabled }, }; colors = new int[] { Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor), Rock.Mobile.UI.Util.GetUIColor(disabledColor), }; CreateButton.SetTextColor(new Android.Content.Res.ColorStateList(states, colors)); // default its position to hidden Revealed = false; ButtonLayout.SetY((int)Rock.Mobile.Graphics.Util.UnitToPx(50.0f)); return(ButtonLayout); }
void ReleaseDesignerOutlets() { if (TimelineView != null) { TimelineView.Dispose(); TimelineView = null; } if (ActivityIndicator != null) { ActivityIndicator.Dispose(); ActivityIndicator = null; } if (BodyTextView != null) { BodyTextView.Dispose(); BodyTextView = null; } if (BodyTextViewHeightConstraint != null) { BodyTextViewHeightConstraint.Dispose(); BodyTextViewHeightConstraint = null; } if (CommentButton != null) { CommentButton.Dispose(); CommentButton = null; } if (ContainerView != null) { ContainerView.Dispose(); ContainerView = null; } if (LikeButton != null) { LikeButton.Dispose(); LikeButton = null; } if (NameLabel != null) { NameLabel.Dispose(); NameLabel = null; } if (PhotoImageView != null) { PhotoImageView.Dispose(); PhotoImageView = null; } if (PhotoImageViewHeightConstraint != null) { PhotoImageViewHeightConstraint.Dispose(); PhotoImageViewHeightConstraint = null; } if (ShareButton != null) { ShareButton.Dispose(); ShareButton = null; } if (SocialTypeImageView != null) { SocialTypeImageView.Dispose(); SocialTypeImageView = null; } if (TimeLabel != null) { TimeLabel.Dispose(); TimeLabel = null; } if (UserImageView != null) { UserImageView.Dispose(); UserImageView = null; } if (ContainerViewLeadingConstraint != null) { ContainerViewLeadingConstraint.Dispose(); ContainerViewLeadingConstraint = null; } }
void ReleaseDesignerOutlets() { if (AnnotationButton != null) { AnnotationButton.Dispose(); AnnotationButton = null; } if (AnnotationView != null) { AnnotationView.Dispose(); AnnotationView = null; } if (BackgroudView != null) { BackgroudView.Dispose(); BackgroudView = null; } if (BookContentView != null) { BookContentView.Dispose(); BookContentView = null; } if (ContentButton != null) { ContentButton.Dispose(); ContentButton = null; } if (FunctionButtonView != null) { FunctionButtonView.Dispose(); FunctionButtonView = null; } if (HistoryButton != null) { HistoryButton.Dispose(); HistoryButton = null; } if (IndexButton != null) { IndexButton.Dispose(); IndexButton = null; } if (IndexCustomView != null) { IndexCustomView.Dispose(); IndexCustomView = null; } if (IndexViewController != null) { IndexViewController.Dispose(); IndexViewController = null; } if (InfoButton != null) { InfoButton.Dispose(); InfoButton = null; } if (LeftButton != null) { LeftButton.Dispose(); LeftButton = null; } if (PageNumber != null) { PageNumber.Dispose(); PageNumber = null; } if (PageViewController != null) { PageViewController.Dispose(); PageViewController = null; } if (RightButton != null) { RightButton.Dispose(); RightButton = null; } if (SearchField != null) { SearchField.Dispose(); SearchField = null; } if (SegmentContol != null) { SegmentContol.Dispose(); SegmentContol = null; } if (ShareButton != null) { ShareButton.Dispose(); ShareButton = null; } if (SplitSwithButton != null) { SplitSwithButton.Dispose(); SplitSwithButton = null; } if (TitleTField != null) { TitleTField.Dispose(); TitleTField = null; } if (TocCustomView != null) { TocCustomView.Dispose(); TocCustomView = null; } if (TOCViewController != null) { TOCViewController.Dispose(); TOCViewController = null; } if (GotoButton != null) { GotoButton.Dispose(); GotoButton = null; } }