private void prepareSearchBar()
        {
            var image = MaterialIcon.CM.ArrowBack;

            //Back button.
            var backButton = new IconButton();

            backButton.TintColor = MaterialColor.BlueGrey.Darken4;
            backButton.SetImage(image, UIControlState.Normal);
            backButton.SetImage(image, UIControlState.Highlighted);

            //More button.
            image = MaterialIcon.CM.MoreHorizontal;
            var moreButton = new IconButton();

            moreButton.TintColor = MaterialColor.BlueGrey.Darken4;
            moreButton.SetImage(image, UIControlState.Normal);
            moreButton.SetImage(image, UIControlState.Highlighted);

            SearchBar.TextField.Delegate = new AppSearchBarControllerTextFieldDelegate(this);
            SearchBar.LeftControls       = new UIControl[] {
                backButton
            };

            SearchBar.RightControls = new UIControl[] {
                moreButton
            };
        }
Example #2
0
        private void prepareIconButtonExample()
        {
            nfloat w      = 64f;
            var    img    = Icon.CM.Search;
            var    button = new IconButton(new CGRect((View.Bounds.Width - w) / 2, 400, w, w));

            button.SetImage(image: img, forState: UIControlState.Normal);
            button.SetImage(image: img, forState: UIControlState.Highlighted);

            View.AddSubview(button);
        }
        private void prepareSearchBar()
        {
            searchBar = new SearchBar();
            containerView.AddSubview(searchBar);

            var image = MaterialIcon.CM.MoreVertical;

            var moreButton = new IconButton();

            moreButton.PulseColor = MaterialColor.Grey.Base;
            moreButton.TintColor  = MaterialColor.Grey.Darken4;
            moreButton.SetImage(image, UIControlState.Normal);
            moreButton.SetImage(image, UIControlState.Highlighted);

            searchBar.LeftControls = new UIControl[] {
                moreButton
            };
        }
Example #4
0
        void prepareToolbar()
        {
            toolbar = new Toolbar();
            containerView.AddSubview(toolbar);

            toolbar.Title = "Material";
            toolbar.TitleLabel.TextColor = MaterialColor.White;

            toolbar.Detail = "Build Beautiful Software";
            toolbar.DetailLabel.TextColor = MaterialColor.White;

            var image = MaterialIcon.CM.Menu;

            var menuButton = new IconButton();

            menuButton.PulseColor = MaterialColor.White;
            menuButton.TintColor  = MaterialColor.White;
            menuButton.SetImage(image, UIControlState.Normal);
            menuButton.SetImage(image, UIControlState.Highlighted);

            var switchControl = new MaterialSwitch(state: MaterialSwitchState.Off, style: MaterialSwitchStyle.LightContent, size: MaterialSwitchSize.Small);

            image = MaterialIcon.CM.Search;
            var searchButton = new IconButton();

            searchButton.PulseColor = MaterialColor.White;
            searchButton.TintColor  = MaterialColor.White;
            searchButton.SetImage(image, UIControlState.Normal);
            searchButton.SetImage(image, UIControlState.Highlighted);

            /*
             * To lighten the status bar - add the
             * "View controller-based status bar appearance = NO"
             * to your info.plist file and set the following property.
             */
            toolbar.BackgroundColor = MaterialColor.Blue.Base;
            toolbar.LeftControls    = new UIControl[] {
                menuButton
            };
            toolbar.RightControls = new UIControl[] {
                switchControl, searchButton
            };
        }
		void prepareCardView()
		{
			var cardView = new Card();
			cardView.BackgroundColor = Color.Grey.Lighten5;
			cardView.SetCornerRadiusPreset(CornerRadiusPreset.Radius1);
			cardView.Divider = false;
			cardView.ContentViewEdgeInsets = EdgeInsetsPreset.None;
			cardView.SetLayoutEdgeInsetsPreset(EdgeInsetsPreset.Square2;
			cardView.righ = EdgeInsetsPreset.Square2;
			cardView.ContentViewInsetPreset = EdgeInsetsPreset.None;

			var titleLabel = new UILabel();
			titleLabel.Font = RobotoFont.MediumWithSize(20);
			titleLabel.Text = "Messages";
			titleLabel.TextAlignment = UITextAlignment.Center;
			titleLabel.TextColor = MaterialColor.BlueGrey.Darken4;

			var v = new UIView();
			v.BackgroundColor = MaterialColor.Blue.Accent1;

			var closeButton = new FlatButton();
			closeButton.SetTitle("Close", UIControlState.Normal);
			closeButton.SetTitleColor(MaterialColor.Blue.Accent3, UIControlState.Normal);

			var image = MaterialIcon.CM.Settings;
			var settingButton = new IconButton();
			settingButton.TintColor = MaterialColor.Blue.Accent3;
			settingButton.SetImage(image, UIControlState.Normal);
			settingButton.SetImage(image, UIControlState.Highlighted);

			cardView.TitleLabel = titleLabel;
			cardView.ContentView = tableView;
			cardView.LeftButtons = new UIButton[] { closeButton};
			cardView.RightButtons = new UIButton[] { settingButton };

			View.Layout(cardView).Edges(left: 10f, right: 10f, top: 100f, bottom: 100f);
		}
        private void prepareLargeCardViewExample()
        {
            var image = UIImage.FromBundle(name: "CosmicMindInverted");


            var cardView = new MaterialPulseView(frame: new CGRect(16, 100, View.Bounds.Width - 32, 400));

            cardView.PulseColor = MaterialColor.BlueGrey.Base;
            cardView.Depth      = MaterialDepth.Depth1;
            View.AddSubview(cardView);


            var leftImageView = new MaterialView();

            leftImageView.Image = image;
            leftImageView.ContentsGravityPreset = MaterialGravity.ResizeAspectFill;
            cardView.AddSubview(leftImageView);

            var topImageView = new MaterialView();

            topImageView.Image = image;
            topImageView.ContentsGravityPreset = MaterialGravity.ResizeAspectFill;
            cardView.AddSubview(topImageView);

            var bottomImageView = new MaterialView();

            bottomImageView.Image = image;
            bottomImageView.ContentsGravityPreset = MaterialGravity.ResizeAspectFill;
            cardView.AddSubview(bottomImageView);

            var contentView = new MaterialView();

            contentView.BackgroundColor = MaterialColor.Clear;
            cardView.AddSubview(contentView);


            var titleLabel = new UILabel();

            titleLabel.Text            = "Material";
            titleLabel.TextColor       = MaterialColor.BlueGrey.Darken4;
            titleLabel.BackgroundColor = MaterialColor.Clear;
            contentView.AddSubview(titleLabel);


            image = MaterialIcon.CM.Add;
            var moreButton = new IconButton();

            moreButton.ContentEdgeInsetsPreset = MaterialEdgeInset.None;
            moreButton.PulseColor = MaterialColor.BlueGrey.Darken4;
            moreButton.TintColor  = MaterialColor.BlueGrey.Darken4;
            moreButton.SetImage(image: image, forState: UIControlState.Normal);
            moreButton.SetImage(image: image, forState: UIControlState.Highlighted);
            contentView.AddSubview(moreButton);

            var detailLabel = new UILabel();

            detailLabel.Lines           = 0;
            detailLabel.LineBreakMode   = UILineBreakMode.TailTruncation;
            detailLabel.Font            = RobotoFont.RegularWithSize(12);
            detailLabel.Text            = "Express your creativity with Material, an animation and graphics framework for Google's Material Design and Apple's Flat UI in Swift.";
            detailLabel.TextColor       = MaterialColor.BlueGrey.Darken4;
            detailLabel.BackgroundColor = MaterialColor.Clear;
            contentView.AddSubview(detailLabel);

            var alarmLabel = new UILabel();

            alarmLabel.Font            = RobotoFont.RegularWithSize(12);
            alarmLabel.Text            = "34 min";
            alarmLabel.TextColor       = MaterialColor.BlueGrey.Darken4;
            alarmLabel.BackgroundColor = MaterialColor.Clear;
            contentView.AddSubview(alarmLabel);


            image = UIImage.FromBundle(name: "ic_alarm_white").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
            var alarmButton = new IconButton();

            alarmButton.ContentEdgeInsetsPreset = MaterialEdgeInset.None;
            alarmButton.PulseColor = MaterialColor.BlueGrey.Darken4;
            alarmButton.TintColor  = MaterialColor.Red.Base;
            alarmButton.SetImage(image: image, forState: UIControlState.Normal);
            alarmButton.SetImage(image: image, forState: UIControlState.Highlighted);
            contentView.AddSubview(alarmButton);

            leftImageView.Grid().Rows    = 7;
            leftImageView.Grid().Columns = 6;


            topImageView.Grid().Rows = 4;
            topImageView.Grid().Columns = 6;
            topImageView.Grid().Offset.Columns = 6;


            bottomImageView.Grid().Rows = 3;
            bottomImageView.Grid().Offset.Rows = 4;
            bottomImageView.Grid().Columns = 6;
            bottomImageView.Grid().Offset.Columns = 6;


            contentView.Grid().Rows = 5;
            contentView.Grid().Offset.Rows = 7;


            cardView.Grid().Axis.Direction = GridAxisDirection.None;
            cardView.Grid().Spacing = 4;
            cardView.Grid().Views   = new List <UIView> {
                leftImageView,
                topImageView,
                bottomImageView,
                contentView
            };


            titleLabel.Grid().Rows    = 3;
            titleLabel.Grid().Columns = 8;


            moreButton.Grid().Rows = 3;
            moreButton.Grid().Columns = 2;
            moreButton.Grid().Offset.Columns = 10;


            detailLabel.Grid().Rows = 6;
            detailLabel.Grid().Offset.Rows = 3;


            alarmLabel.Grid().Rows = 3;
            alarmLabel.Grid().Columns = 8;
            alarmLabel.Grid().Offset.Rows = 9;


            alarmButton.Grid().Rows = 3;
            alarmButton.Grid().Offset.Rows = 9;
            alarmButton.Grid().Columns = 2;
            alarmButton.Grid().Offset.Columns = 10;


            contentView.Grid().Spacing = 8;
            contentView.Grid().Axis.Direction = GridAxisDirection.None;
            contentView.Grid().ContentInsetPreset = MaterialEdgeInset.Square3;
            contentView.Grid().Views              = new List <UIView> {
                titleLabel,
                moreButton,
                detailLabel,
                alarmLabel,
                alarmButton
            };
        }