コード例 #1
0
ファイル: VerseComposeDialog.cs プロジェクト: witheej/Verses
        private void SetupUI()
        {
            View.BackgroundColor = UIColor.White;

            verseReference = new UITextField {
                AutocapitalizationType = UITextAutocapitalizationType.Words,
                BackgroundColor        = UIColor.Clear,
                BorderStyle            = UITextBorderStyle.None,
                Font        = FontConstants.SourceSansProBold(17),
                Frame       = new RectangleF(0, 0, View.Bounds.Size.Width, 28f),
                Placeholder = "Verse"
            };
            verseReference.BecomeFirstResponder();

            blackLine = new UIView {
                BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(Images.BlackLine)),
                Frame           = new RectangleF(0, 28, View.Bounds.Width, 3f)
            };

            textViewDelegate = new ContentTextDelegate();
            verseComments    = new UITextView {
                Delegate           = textViewDelegate,
                Font               = FontConstants.SourceSansProBold(15),
                Frame              = new RectangleF(0, 31, View.Bounds.Width, 145f),
                KeyboardAppearance = UIKeyboardAppearance.Default,
                Text               = "Comments",
                TextAlignment      = UITextAlignment.Left,
                TextColor          = UIColor.LightGray
            };

            View.AddSubview(verseReference);
            View.AddSubview(blackLine);
            View.AddSubview(verseComments);
        }
コード例 #2
0
        private void SetupUI()
        {
            View.BackgroundColor = UIColor.White;

            PrayerTitle = new UITextField {
                BackgroundColor = UIColor.Clear,
                BorderStyle     = UITextBorderStyle.None,
                Font            = FontConstants.SourceSansProBold(15),
                Frame           = new RectangleF(0, 0, View.Bounds.Size.Width, 28f),
                Placeholder     = "Title"
            };
            PrayerTitle.BecomeFirstResponder();

            BlackLine = new UIView {
                BackgroundColor = UIColor.FromPatternImage(Images.BlackLine),
                Frame           = new RectangleF(0, 28, View.Bounds.Width, 1f)
            };

            TextViewDelegate = new ContentTextDelegate();
            PrayerContent    = new UITextView {
                Delegate           = TextViewDelegate,
                Font               = FontConstants.SourceSansProBold(13),
                Frame              = new RectangleF(0, 29, View.Bounds.Width, 165f),
                KeyboardAppearance = UIKeyboardAppearance.Default,
                Text               = "Content",
                TextAlignment      = UITextAlignment.Left,
                TextColor          = UIColor.LightGray
            };

            View.AddSubview(PrayerTitle);
            View.AddSubview(BlackLine);
            View.AddSubview(PrayerContent);
        }
コード例 #3
0
ファイル: VerseEditDialog.cs プロジェクト: witheej/Verses
        private void SetupUI()
        {
            View.BackgroundColor = UIColor.White;

            verseReference = new UITextField {
                BackgroundColor = UIColor.Clear,
                BorderStyle     = UITextBorderStyle.None,
                Enabled         = false,
                Font            = FontConstants.SourceSansProBold(17),
                Frame           = new RectangleF(0, 0, View.Bounds.Size.Width, 28f),
                Text            = verse.Title
            };

            blackLine = new UIView {
                BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(Images.BlackLine)),
                Frame           = new RectangleF(0, 28, View.Bounds.Width, 3f)
            };

            verseComments = new UITextView {
                Font  = FontConstants.SourceSansProRegular(15),
                Frame = new RectangleF(0, 31, View.Bounds.Width, 145f),
                KeyboardAppearance = UIKeyboardAppearance.Default,
                Text          = verse.Comments,
                TextAlignment = UITextAlignment.Left
            };
            verseComments.BecomeFirstResponder();

            View.AddSubview(verseReference);
            View.AddSubview(blackLine);
            View.AddSubview(verseComments);
        }
コード例 #4
0
        public override float GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
        {
            var content = Verses[Keys[indexPath.Section]][indexPath.Row].Content;
            var text    = new NSString(content);
            var size    = text.StringSize(FontConstants.SourceSansProRegular(13), new SizeF(278, 70));

            return(size.Height + 40);
        }
コード例 #5
0
ファイル: PrayerDetailDialog.cs プロジェクト: arsalan/Verses
        private void SetupUI()
        {
            ScrollView = new UIScrollView()
            {
                BackgroundColor = UIColor.FromPatternImage(Images.TableViewBackground),
                Frame           = new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height),
                PagingEnabled   = false,
                ScrollEnabled   = true
            };
            View.Add(ScrollView);

            TopBarArea = new UITextField()
            {
                BackgroundColor   = UIColor.White,
                Enabled           = false,
                Font              = FontConstants.SourceSansProRegular(13),
                Frame             = new RectangleF(14f, 22f, 294f, 32f),
                LeftView          = new UIImageView(Images.TimeIcon),
                LeftViewMode      = UITextFieldViewMode.Always,
                Text              = Prayer.Timestamp.ToShortDateString(),
                TextAlignment     = UITextAlignment.Left,
                VerticalAlignment = UIControlContentVerticalAlignment.Center
            };

            ContentArea = new UILabel()
            {
                BackgroundColor = UIColor.White,
                Font            = FontConstants.SourceSansProRegular(13),
                Frame           = new RectangleF(14f, 48f, 294f, 10f),
                LineBreakMode   = UILineBreakMode.TailTruncation,
                Lines           = 0,
                Text            = Prayer.Content,
                TextAlignment   = UITextAlignment.Left
            };
            ScrollView.Add(ContentArea);
            ContentArea.Frame = new RectangleF(14f, 52f, 294f,
                                               InterfaceHelper.ContentSize(ContentArea.Text, ContentArea.Frame.Width, ContentArea.Font));

            var height = ContentArea.Bounds.Height + 79f;

            ShareButton = new UIButton()
            {
                Frame = new RectangleF(33.5f, height, 253f, 33f)
            };
            ShareButton.SetBackgroundImage(Images.ShareButton, UIControlState.Normal);
            ShareButton.AddTarget(HandleShareTapped, UIControlEvent.TouchUpInside);

            ScrollView.Add(TopBarArea);
            ScrollView.Add(ShareButton);

            // ShareButton + NavBar + TabBar + (2 * 22f)
            var contentSize = ShareButton.Frame.Y + 170;

            ScrollView.ContentSize = new SizeF(320f, contentSize);
        }
コード例 #6
0
ファイル: ContentTextDelegate.cs プロジェクト: witheej/Verses
        public override void EditingStarted(UITextView textView)
        {
            if (textView.Text == "Content")
            {
                textView.Text      = "";
                textView.TextColor = UIColor.Black;
                textView.Font      = FontConstants.SourceSansProRegular(13);
            }

            textView.BecomeFirstResponder();
        }
コード例 #7
0
ファイル: ContentTextDelegate.cs プロジェクト: witheej/Verses
        public override void EditingEnded(UITextView textView)
        {
            if (textView.Text == "")
            {
                textView.Text      = "Content";
                textView.TextColor = UIColor.LightGray;
                textView.Font      = FontConstants.SourceSansProBold(13);
            }

            textView.ResignFirstResponder();
        }
コード例 #8
0
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            var text        = new NSString(VerseContent.Text);
            var maxSize     = new SizeF(278, 70);
            var currentSize = text.StringSize(FontConstants.SourceSansProRegular(15), maxSize);

            VerseReference.Frame = new RectangleF(22, 9, 278, 20);
            VerseContent.Frame   = new RectangleF(24, 30, 278, currentSize.Height);
        }
コード例 #9
0
ファイル: PrayerCell.cs プロジェクト: arsalan/Verses
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            var text        = new NSString(PrayerContent.Text);
            var maxSize     = new SizeF(278, 70);
            var currentSize = text.StringSize(FontConstants.SourceSansProRegular(13), maxSize);

            PrayerContent.Frame = new RectangleF(24f, 30, 278, currentSize.Height);
            PrayerTitle.Frame   = new RectangleF(22f, 7, 278, 20);
        }
コード例 #10
0
        void SetupUI()
        {
            copyrightView = new UITextView {
                BackgroundColor = UIColor.White,
                Editable        = false,
                Font            = FontConstants.SourceSansProRegular(15),
                Frame           = new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height),
                Text            = "Fetching copyright...",
                TextAlignment   = UITextAlignment.Left
            };

            View.Add(copyrightView);
        }
コード例 #11
0
ファイル: PrayerCell.cs プロジェクト: arsalan/Verses
        public PrayerCell(NSString reuseIdentifier) : base(UITableViewCellStyle.Default, reuseIdentifier)
        {
            SelectionStyle = UITableViewCellSelectionStyle.None;

            PrayerTitle = new UILabel {
                BackgroundColor = UIColor.FromPatternImage(Images.CellHeader),
                Font            = FontConstants.SourceSansProBold(15),
                TextAlignment   = UITextAlignment.Center,
                TextColor       = UIColor.White
            };

            PrayerContent = new UILabel {
                Font          = FontConstants.SourceSansProRegular(13),
                Lines         = 0,
                TextAlignment = UITextAlignment.Left,
                TextColor     = UIColor.Black,
            };

            ContentView.Add(PrayerTitle);
            ContentView.Add(PrayerContent);
        }
コード例 #12
0
        public VerseCell(string reuseIdentifier) : base(UITableViewCellStyle.Default, reuseIdentifier)
        {
            SelectionStyle = UITableViewCellSelectionStyle.None;

            VerseReference = new UILabel {
                BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(Images.CellHeader)),
                Font            = FontConstants.SourceSansProBold(17),
                TextAlignment   = UITextAlignment.Center,
                TextColor       = UIColor.White,
            };

            VerseContent = new UILabel {
                Font          = FontConstants.SourceSansProRegular(15),
                LineBreakMode = UILineBreakMode.TailTruncation,
                Lines         = 0,
                TextAlignment = UITextAlignment.Left,
                TextColor     = UIColor.Black
            };

            ContentView.Add(VerseReference);
            ContentView.Add(VerseContent);
        }
コード例 #13
0
ファイル: VerseDetailDialog.cs プロジェクト: witheej/Verses
        private void SetupUI()
        {
            View.BackgroundColor = UIColor.White;

            scrollView = new UIScrollView {
                BackgroundColor = UIColor.Clear,
                Frame           = new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height),
                PagingEnabled   = false,
                ScrollEnabled   = true
            };
            View.Add(scrollView);

            contentArea = new UILabel {
                BackgroundColor = UIColor.Clear,
                Font            = FontConstants.SourceSansProRegular(15),
                Frame           = new RectangleF(14f, 35f, 294f, 10f),
                LineBreakMode   = UILineBreakMode.TailTruncation,
                Lines           = 0,
                Text            = verse.Content,
                TextAlignment   = UITextAlignment.Left
            };
            scrollView.Add(contentArea);
            contentArea.Frame = new RectangleF(14f, 35f, 294f,
                                               InterfaceHelper.ContentSize(contentArea.Text, contentArea.Frame.Width, contentArea.Font));

            var height = contentArea.Bounds.Height + 45f;

            blackLine = new UIView {
                BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(Images.BlackLine)),
                Frame           = new RectangleF(24, height, 284f, 1f)
            };
            scrollView.Add(blackLine);

            height       = contentArea.Frame.Height + blackLine.Frame.Height + 50f;
            commentsArea = new UILabel {
                BackgroundColor = UIColor.Clear,
                Font            = FontConstants.SourceSansProRegular(15),
                Frame           = new RectangleF(14f, height, 294f, 10f),
                LineBreakMode   = UILineBreakMode.TailTruncation,
                Lines           = 0,
                Text            = verse.Comments,
                TextAlignment   = UITextAlignment.Left
            };
            scrollView.Add(commentsArea);

            if (verse.Comments.Length != 0)
            {
                commentsArea.Frame = new RectangleF(14f, height, 294f,
                                                    InterfaceHelper.ContentSize(commentsArea.Text, contentArea.Frame.Width, contentArea.Font));
            }
            else
            {
                commentsArea.Hidden = true;
                blackLine.Hidden    = true;
            }

            height      = contentArea.Bounds.Height + 45;
            shareButton = new UIButton {
                Frame = new RectangleF(33.5f, height, 253f, 33f)
            };
            shareButton.SetBackgroundImage(UIImage.FromFile(Images.ShareButton), UIControlState.Normal);

            copyrightButton = new UIButton {
                Enabled = true,
                Frame   = new RectangleF(282, 5, 25, 25),
                UserInteractionEnabled = true
            };
            copyrightButton.SetBackgroundImage(UIImage.FromFile(Images.CopyrightButton), UIControlState.Normal);

            scrollView.Add(shareButton);
            scrollView.Add(copyrightButton);

            var contentSize = shareButton.Frame.Y + 170;

            scrollView.ContentSize = new SizeF(320f, contentSize);
        }
コード例 #14
0
        private void SetupUI()
        {
            View.BackgroundColor = UIColor.FromPatternImage(Images.TableViewBackground);

            ScrollView = new UIScrollView {
                BackgroundColor = UIColor.FromPatternImage(Images.TableViewBackground),
                Frame           = new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height),
                PagingEnabled   = false,
                ScrollEnabled   = true
            };
            View.Add(ScrollView);

            TopBarArea = new UITextField {
                BackgroundColor        = UIColor.White,
                Enabled                = false,
                UserInteractionEnabled = false,
                Font              = FontConstants.SourceSansProRegular(13),
                Frame             = new RectangleF(14f, 22f, 294f, 32f),
                LeftView          = new UIImageView(Images.TimeIcon),
                LeftViewMode      = UITextFieldViewMode.Always,
                Text              = verse.Timestamp.ToShortDateString(),
                TextAlignment     = UITextAlignment.Left,
                VerticalAlignment = UIControlContentVerticalAlignment.Center
            };

            ContentArea = new UILabel {
                BackgroundColor = UIColor.White,
                Font            = FontConstants.SourceSansProRegular(13),
                Frame           = new RectangleF(14f, 48f, 294f, 10f),
                LineBreakMode   = UILineBreakMode.TailTruncation,
                Lines           = 0,
                Text            = verse.Content,
                TextAlignment   = UITextAlignment.Left
            };
            ScrollView.Add(ContentArea);
            ContentArea.Frame = new RectangleF(14f, 52f, 294f,
                                               InterfaceHelper.ContentSize(ContentArea.Text, ContentArea.Frame.Width, ContentArea.Font));

            var height = ContentArea.Bounds.Height + 50f;

            BlackLine = new UIView {
                BackgroundColor = UIColor.FromPatternImage(Images.BlackLine),
                Frame           = new RectangleF(24, height, 284f, 1f)
            };
            ScrollView.Add(BlackLine);

            height       = ContentArea.Frame.Height + BlackLine.Frame.Height + 50f;       // BlackLine.Frame.Height + 50f;
            CommentsArea = new UILabel {
                BackgroundColor = UIColor.White,
                Font            = FontConstants.SourceSansProRegular(13),
                Frame           = new RectangleF(14f, height, 294f, 10f),
                LineBreakMode   = UILineBreakMode.TailTruncation,
                Lines           = 0,
                Text            = verse.Comments,
                TextAlignment   = UITextAlignment.Left
            };
            ScrollView.Add(CommentsArea);

            if (verse.Comments.Length != 0)
            {
                CommentsArea.Frame = new RectangleF(14f, height, 294f,
                                                    InterfaceHelper.ContentSize(CommentsArea.Text, ContentArea.Frame.Width, ContentArea.Font));
            }
            else
            {
                CommentsArea.Hidden = true;
                BlackLine.Hidden    = true;
            }

            height      = CommentsArea.Frame.Bottom + 22f;
            ShareButton = new UIButton {
                Frame = new RectangleF(33.5f, height, 253f, 33f)
            };
            ShareButton.SetBackgroundImage(Images.ShareButton, UIControlState.Normal);
            ShareButton.AddTarget(HandleShareTapped, UIControlEvent.TouchUpInside);

            var toMemorizeHeight = ShareButton.Frame.Bottom + 10f;

            ToMemorizeButton = new UIButton {
                Frame = new RectangleF(33.5f, toMemorizeHeight, 253f, 33f)
            };
            ToMemorizeButton.AddTarget(HandleToMemorizeTapped, UIControlEvent.TouchUpInside);

            var memorizable = verse.Memorizable;

            if (memorizable)
            {
                ToMemorizeButton.SetBackgroundImage(Images.ToMemorizeGreenButton, UIControlState.Normal);
            }
            else
            {
                ToMemorizeButton.SetBackgroundImage(Images.ToMemorizeRedButton, UIControlState.Normal);
            }

            var memorizedHeight = ToMemorizeButton.Frame.Bottom + 10f;

            MemorizedButton = new UIButton {
                Frame = new RectangleF(33.5f, memorizedHeight, 253f, 33f)
            };
            MemorizedButton.AddTarget(HandleMemorizedTapped, UIControlEvent.TouchUpInside);

            var memorized = verse.Memorized;

            if (memorized)
            {
                MemorizedButton.SetBackgroundImage(Images.MemorizedGreenButton, UIControlState.Normal);
            }
            else
            {
                MemorizedButton.SetBackgroundImage(Images.MemorizedRedButton, UIControlState.Normal);
            }

            if (!verse.Memorizable)
            {
                MemorizedButton.Hidden = true;
            }

            CopyrightButton = new UIButton {
                Enabled = true,
                Frame   = new RectangleF(282, 22, 25, 25),
                UserInteractionEnabled = true
            };
            CopyrightButton.SetBackgroundImage(Images.CopyrightButton, UIControlState.Normal);
            CopyrightButton.AddTarget(HandleCopyrightButtonTapped, UIControlEvent.TouchUpInside);

            ScrollView.Add(TopBarArea);
            ScrollView.Add(ShareButton);
            ScrollView.Add(ToMemorizeButton);
            ScrollView.Add(MemorizedButton);
            ScrollView.Add(CopyrightButton);

            var contentSize = MemorizedButton.Frame.Y + 170;

            ScrollView.ContentSize = new SizeF(320f, contentSize);
        }