protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView (Resource.Layout.dialog_color_picker);

            mHuePicker =  FindViewById<HueBarSlider>(Resource.Id.hue_slider);
            mColorAreaPicker =  FindViewById<ColorAreaPicker>(Resource.Id.color_area_picker);
            Button okButton =  FindViewById<Button>(Resource.Id.ok_button);
            Button cancelButton =  FindViewById<Button>(Resource.Id.cancel_button);
            mCurrentColorPreview = FindViewById(Resource.Id.current_color);
            mSelectedColorPreview = FindViewById(Resource.Id.selected_color);

            mCurrentColorPreview.SetBackgroundColor(mInitialColor);
            mSelectedColorPreview.SetBackgroundColor(mInitialColor);

            mColorAreaPicker.ColorChanged += (sender, args) =>
            {
                mSelectedColor = args.Color;
                mSelectedColorPreview.SetBackgroundColor(mSelectedColor);
            };
            mColorAreaPicker.SetHuePicker(mHuePicker);
            mColorAreaPicker.SetColor(mInitialColor);

            okButton.Click += delegate
            {
                OnColorSelected(new ColorChangedEventArgs(mSelectedColor));
                Dismiss();
            };

            cancelButton.Click += delegate
            {
                Cancel();
            };
        }
        protected override Android.Views.View GetCellCore(Cell item,
                                                          Android.Views.View convertView,
                                                          ViewGroup parent,
                                                          Context context)
        {
            _cellCore = base.GetCellCore(item, convertView, parent, context);
            try
            {
                _selected = ((Menus)item.BindingContext).isSelected;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }

            _unselectedBackground = _cellCore.Background;

            if (_selected)
            {
                ExtendedViewCell extendedViewCell = item as ExtendedViewCell;
                _cellCore.SetBackgroundColor(extendedViewCell.SelectedBackgroundColor.ToAndroid());
            }
            else
            {
                ExtendedViewCell extendedViewCell = item as ExtendedViewCell;
                _cellCore.SetBackgroundColor(Color.White.ToAndroid());
            }

            return(_cellCore);
        }
        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnCellPropertyChanged(sender, e);
            if (e.PropertyName == "IsSelected")
            {
                _selected = !_selected;

                if (_selected)
                {
                    var extendedViewCell = sender as FastCell;

                    if (extendedViewCell.SelectionMode)
                    {
                        _cellCore.SetBackgroundColor(extendedViewCell.SelectedBackgroundColor.ToAndroid());
                    }
                    else
                    {
                        _cellCore.SetBackgroundColor(Xamarin.Forms.Color.Transparent.ToAndroid());
                    }
                }
                else
                {
                    _cellCore.SetBackground(_unselectedBackground);
                }
            }
        }
Exemple #4
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.View> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
            {
                Android.Views.View v = new Android.Views.View(Context);
                v.Click += new EventHandler((o, ee) =>
                {
                    ((LNListViewItem)Element).OnTap();
                });
                v.LongClick += new EventHandler <LongClickEventArgs>((o, ee) =>
                {
                    v.SetBackgroundColor(Android.Graphics.Color.White);
                    ((LNListViewItem)Element).OnLongTap();
                });
                v.Touch += new EventHandler <TouchEventArgs>((o, ee) =>
                {
                    bool contains = (ee.Event.GetX() < v.Width) && (ee.Event.GetY() < v.Height);

                    if (ee.Event.Action == MotionEventActions.Down)
                    {
                        v.SetBackgroundColor(((LNListViewItem)Element).TouchDownBackground.ToAndroid());
                    }
                    else if (ee.Event.Action == MotionEventActions.Up || ee.Event.Action == MotionEventActions.Cancel)
                    {
                        v.SetBackgroundColor(Android.Graphics.Color.White);
                    }

                    ee.Handled = false;
                });
                SetNativeControl(v);
            }
        }
 public virtual Com.Zhy.Adapter.Abslistview.ViewHolder SetBackgroundColor(int viewId
                                                                          , int color)
 {
     Android.Views.View view = GetView <View>(viewId);
     view.SetBackgroundColor(new Android.Graphics.Color(color));
     return(this);
 }
 protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
 {
     _cellCore = base.GetCellCore(item, convertView, parent, context);
     _selected = false;
     _cellCore.SetBackgroundColor(_cellCore.Selected ? (Cell as BetterViewCell).SelectedBackgroundColor.ToAndroid() : (Cell as BetterViewCell).DefualtBackgroundColor.ToAndroid());
     return(_cellCore);
 }
Exemple #7
0
        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs args)

        {
            base.OnCellPropertyChanged(sender, args);



            if (args.PropertyName == "IsSelected")

            {
                // Had to create a property to track the selection because cellCore.Selected is always false.

                _selected = !_selected;



                if (_selected)

                {
                    var extendedViewCell = sender as ExtendedViewCell;

                    _cellCore.SetBackgroundColor(extendedViewCell.SelectedBackgroundColor.ToAndroid());
                }

                else

                {
                    _cellCore.SetBackground(_unselectedBackground);
                }
            }
        }
        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs args)
        {
            base.OnCellPropertyChanged(sender, args);
            var extendedViewCell = sender as CustomViewCell;

            _cellCore.SetBackgroundColor(extendedViewCell.BackgroundColor.ToAndroid());
        }
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            var template = _templateMap[viewType];

            var content = (View)template.CreateContent();

            content.Parent = _shellContext.Shell;

            var linearLayout = new LinearLayoutWithFocus(parent.Context)
            {
                Orientation      = Orientation.Vertical,
                LayoutParameters = new RecyclerView.LayoutParams(LP.MatchParent, LP.WrapContent),
                Content          = content
            };

            var bar = new AView(parent.Context);

            bar.SetBackgroundColor(Color.Black.MultiplyAlpha(0.14).ToAndroid());
            bar.LayoutParameters = new LP(LP.MatchParent, (int)parent.Context.ToPixels(1));
            linearLayout.AddView(bar);

            var container = new ContainerView(parent.Context, content);

            container.MatchWidth       = true;
            container.LayoutParameters = new LP(LP.MatchParent, LP.WrapContent);
            linearLayout.AddView(container);

            return(new ElementViewHolder(content, linearLayout, bar, _selectedCallback));
        }
 protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     base.OnCellPropertyChanged(sender, e);
     if (e.PropertyName == "IsSelected")
     {
         _selected = !_selected;
         if (_selected)
         {
             var extendedViewCell = sender as CustomViewCell;
             _cellCore.SetBackgroundColor(Android.Graphics.Color.Brown);
         }
         else
         {
             _cellCore.SetBackgroundColor(Android.Graphics.Color.Brown);
         }
     }
 }
Exemple #11
0
        AView CreateEmptyContent()
        {
            var emptyContentView = new AView(_context);

            emptyContentView.SetBackgroundColor(Colors.Transparent.ToPlatform());

            return(emptyContentView);
        }
Exemple #12
0
        protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
        {
            _cell = base.GetCellCore(item, convertView, parent, context);
            _cell.SetBackgroundColor(Android.Graphics.Color.Transparent);
            _isSelected = false;

            return(_cell);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState, Resource.Layout.product_list_activity);

            SetTitle(Resource.String.choose_product);

            useProductDetailsActivity = false;
            theme = new ProductDetailsTheme(Resources);

            if (Intent.HasExtra(ExtraCollectionId))
            {
                collectionId = Intent.GetStringExtra(ExtraCollectionId);
            }

            productViewOptionsContainer = FindViewById(Resource.Id.product_view_options_container);
            productViewOptionsContainer.Visibility = ViewStates.Gone;

            FindViewById<Switch>(Resource.Id.product_details_activity_switch).CheckedChange += (sender, e) =>
            {
                useProductDetailsActivity = e.IsChecked;
                productViewOptionsContainer.Visibility = e.IsChecked ? ViewStates.Visible : ViewStates.Gone;
            };

            FindViewById<Switch>(Resource.Id.theme_style_switch).CheckedChange += (sender, e) =>
            {
                theme.SetStyle(e.IsChecked ? ProductDetailsTheme.Style.Light : ProductDetailsTheme.Style.Dark);
            };

            FindViewById<Switch>(Resource.Id.product_image_bg_switch).CheckedChange += (sender, e) =>
            {
                theme.SetShowProductImageBackground(e.IsChecked);
            };

            accentColorView = FindViewById(Resource.Id.accent_color_view);
            accentColorView.SetBackgroundColor(new Color(theme.AccentColor));
            accentColorView.Click += delegate
            {
                var cpd = new HSVColorPickerDialog(this, new Color(theme.AccentColor), (color) =>
                {
                    theme.AccentColor = color;
                    accentColorView.SetBackgroundColor(color);
                });
                cpd.SetTitle(Resource.String.choose_accent_color);
                cpd.Show();
            };
        }
Exemple #14
0
 protected override void OnCellPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs args)
 {
     base.OnCellPropertyChanged(sender, args);
     if (args.PropertyName == "IsSelected")
     {
         _selected = !_selected;
         var extendedViewCell = sender as ViewCell;
         if (_selected)
         {
             _cellCore.SetBackgroundColor(Android.Graphics.Color.Red);
         }
         else
         {
             _cellCore.SetBackgroundColor(Android.Graphics.Color.Transparent);
         }
     }
 }
 protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs args)
 {
     base.OnCellPropertyChanged(sender, args);
     if (args.PropertyName == "IsSelected")
     {
         _selected = !_selected;
         if (_selected)
         {
             BetterViewCell extendedViewCell = sender as BetterViewCell;
             _cellCore.SetBackgroundColor(extendedViewCell.SelectedBackgroundColor.ToAndroid());
         }
         else
         {
             BetterViewCell extendedViewCell = sender as BetterViewCell;
             _cellCore.SetBackgroundColor(extendedViewCell.DefualtBackgroundColor.ToAndroid());
         }
     }
 }
Exemple #16
0
 protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
 {
     Android.Views.View view = base.GetCellCore(item, convertView, parent, context);
     if (view != null)
     {
         view.SetBackgroundColor(Xamarin.Forms.Color.Transparent.ToAndroid());
     }
     return(view);
 }
        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnCellPropertyChanged(sender, e);

            if (e.PropertyName == "IsSelected")
            {
                _cellCore.SetBackgroundColor(Android.Graphics.Color.White);
            }
        }
Exemple #18
0
        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnCellPropertyChanged(sender, e);

            if (e.PropertyName == "IsSelected")
            {
                _isSelected = !_isSelected;

                if (_isSelected)
                {
                    _cell.SetBackgroundColor(Android.Graphics.Color.LightGray);
                }
                else
                {
                    _cell.SetBackgroundColor(Android.Graphics.Color.Transparent);
                }
            }
        }
Exemple #19
0
 public WaveFormTouchListener(WaveformViewExtended waveformView, FrameLayout fragmentContainer, WaveView element) :
     this()
 {
     mWaveformView          = waveformView;
     _fragmentContainer     = fragmentContainer;
     _element               = element;
     seekableBackgroundView = new AView(Application.Context);
     seekableBackgroundView.SetBackgroundColor(Android.Graphics.Color.ParseColor("#85000000"));
 }
        protected override void OnElementChanged(ElementChangedEventArgs <Page> e)
        {
            base.OnElementChanged(e);
            MessagingCenter.Subscribe <RootPage, AlertArguments> (this, "DisplayAlert", (sender, arguments) => {
                //If you would like to use style attributes, you can pass this into the builder
//				ContextThemeWrapper customDialog = new ContextThemeWrapper(Context, Resource.Style.AlertDialogCustom);
//				AlertDialog.Builder builder = new AlertDialog.Builder(customDialog);

                //Create instance of AlertDialog.Builder and create the alert
                AlertDialog.Builder builder = new AlertDialog.Builder(Context);
                var alert = builder.Create();

                //Utilize context to get LayoutInflator to set the view used for the dialog
                var layoutInflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);
                alert.SetView(layoutInflater.Inflate(Resource.Layout.CustomDialog, null));

                //Create a custom title element
                TextView title = new TextView(Context)
                {
                    Text = arguments.Title,
                };
                title.SetTextColor(Android.Graphics.Color.DodgerBlue);
                title.SetBackgroundColor(Android.Graphics.Color.White);
                //Add the custom title to the AlertDialog
                alert.SetCustomTitle(title);

                //Set the buttons text and click handler events
                if (arguments.Accept != null)
                {
                    alert.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(true));
                }
                alert.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(false));
                alert.CancelEvent += (o, args) => { arguments.SetResult(false); };
                alert.Show();

                //This code grabs the line that separates the title and dialog.
                int titleDividerId = Resources.GetIdentifier("titleDivider", "id", "android");
                Android.Views.View titleDivider = alert.FindViewById(titleDividerId);
                if (titleDivider != null)
                {
                    titleDivider.SetBackgroundColor(Android.Graphics.Color.DarkRed);
                }

                //Set properties of the buttons
                Android.Widget.Button positiveButton = alert.GetButton((int)DialogButtonType.Positive);
                positiveButton.SetTextColor(Android.Graphics.Color.Green);
                positiveButton.SetBackgroundColor(Android.Graphics.Color.White);

                Android.Widget.Button negativeButton = alert.GetButton((int)DialogButtonType.Negative);
                negativeButton.SetTextColor(Android.Graphics.Color.Red);
                negativeButton.SetBackgroundColor(Android.Graphics.Color.White);

                //Set the text of the TextView in the dialog
                var textView = alert.FindViewById <TextView>(Resource.Id.textview);
                textView.SetText(arguments.Message, null);
            });
        }
        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs args)
        {
            base.OnCellPropertyChanged(sender, args);
            if (args.PropertyName == "IsSelected")
            {
                _selected = !_selected;
                if (_selected)
                {
                    var extendedViewCell = sender as CustomViewCell;

                    _cellCore.SetBackgroundColor(extendedViewCell.SelectedItemBackgroundColor.ToAndroid());
                }
                else
                {
                    _cellCore.SetBackgroundColor(Color.Silver.ToAndroid());
                }
            }
        }
        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnCellPropertyChanged(sender, e);

            if (e.PropertyName == "IsSelected")
            {
                isSelected = !isSelected;
                var viewcell = sender as ViewCell;
                if (isSelected)
                {
                    core.SetBackgroundColor(Android.Graphics.Color.Transparent);
                }
                else
                {
                    core.SetBackgroundColor(Android.Graphics.Color.Transparent);
                }
            }
        }
        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnCellPropertyChanged(sender, e);

            if (e.PropertyName == "IsSelected")
            {
                _isSelected = !_isSelected;

                if (_isSelected)
                {
                    _cell.SetBackgroundColor(Color.FromHex("#E6E6E6").ToAndroid());
                }
                else
                {
                    //? _cell.Background = _defaultBackground;
                    _cell.SetBackgroundColor(Android.Graphics.Color.Transparent);
                }
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            //create a new beacon manager to handle starting and stopping ranging
            beaconManager = new BeaconManager (this);

            //major and minor are optional, pass in null if you don't need them
            beaconRegion = new EstimoteSdk.Region (beaconId, uuid, null, null);

            var v = FindViewById<WatchViewStub> (Resource.Id.watch_view_stub);

            v.LayoutInflated += delegate {

                // Get our button from the layout resource,
                // and attach an event to it
                background = FindViewById<View> (Resource.Id.main);
                count = FindViewById<TextView>(Resource.Id.text);
            };

            beaconManager.Ranging += (object sender, BeaconManager.RangingEventArgs e) => RunOnUiThread (() => {

                background.SetBackgroundColor(Color.Black);
                count.Text = e.Beacons.Count.ToString();
                if(e.Beacons.Count == 0)
                    return;

                var prox = Utils.ComputeProximity(e.Beacons[0]);
                if(prox == Utils.Proximity.Far)
                    background.SetBackgroundColor(Color.Blue);
                else if(prox == Utils.Proximity.Near)
                    background.SetBackgroundColor(Color.Yellow);
                else if(prox == Utils.Proximity.Immediate)
                    background.SetBackgroundColor(Color.Green);
                else
                    background.SetBackgroundColor(Color.Black);

            });
        }
        public HSVColorPickerDialog(Context context, Color initialColor, Action<Color> listener)
            : base(context)
        {
            this.selectedColor = initialColor;
            this.listener = listener;

            colorWheel = new HSVColorWheel(context);
            valueSlider = new HSVValueSlider(context);
            var padding = (int)(context.Resources.DisplayMetrics.Density * PADDING_DP);
            var borderSize = (int)(context.Resources.DisplayMetrics.Density * BORDER_DP);
            var layout = new RelativeLayout(context);

            var lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP);
            colorWheel.setListener((color) => valueSlider.SetColor(color, true));
            colorWheel.setColor(initialColor);
            colorWheel.Id = (1);
            layout.AddView(colorWheel, lp);

            int selectedColorHeight = (int)(context.Resources.DisplayMetrics.Density * SELECTED_COLOR_HEIGHT_DP);

            var valueSliderBorder = new FrameLayout(context);
            valueSliderBorder.SetBackgroundColor(BORDER_COLOR);
            valueSliderBorder.SetPadding(borderSize, borderSize, borderSize, borderSize);
            valueSliderBorder.Id = (2);
            lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize);
            lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP);
            lp.AddRule(LayoutRules.Below, 1);
            layout.AddView(valueSliderBorder, lp);

            valueSlider.SetColor(initialColor, false);
            valueSlider.SetListener((color) =>
            {
                selectedColor = color;
                selectedColorView.SetBackgroundColor(color);
            });
            valueSliderBorder.AddView(valueSlider);

            var selectedColorborder = new FrameLayout(context);
            selectedColorborder.SetBackgroundColor(BORDER_COLOR);
            lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize);
            selectedColorborder.SetPadding(borderSize, borderSize, borderSize, borderSize);
            lp.AddRule(LayoutRules.Below, 2);
            layout.AddView(selectedColorborder, lp);

            selectedColorView = new View(context);
            selectedColorView.SetBackgroundColor(selectedColor);
            selectedColorborder.AddView(selectedColorView);

            SetButton((int)DialogButtonType.Negative, context.GetString(Android.Resource.String.Cancel), ClickListener);
            SetButton((int)DialogButtonType.Positive, context.GetString(Android.Resource.String.Ok), ClickListener);

            SetView(layout, padding, padding, padding, padding);
        }
Exemple #26
0
        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnCellPropertyChanged(sender, e);

            var cell = sender as TextCell;

            if (e.PropertyName == "IsSelected")
            {
                _isSelected = !_isSelected;

                if (_isSelected)
                {
                    _cell.SetBackgroundColor(Color.FromHex("#8bd3cf").ToAndroid());
                }
                else
                {
                    _cell.SetBackgroundColor(Android.Graphics.Color.Transparent);
                }
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> args)
        {
            base.OnElementChanged(args);
            // Get native control (background set in shared code, but can use SetBackgroundColor here)
            SearchView searchView = (base.Control as SearchView);

            searchView.SetInputType(InputTypes.ClassText | InputTypes.TextVariationNormal);

            // Access search textview within control
            int      textViewId = searchView.Context.Resources.GetIdentifier("android:id/search_src_text", null, null);
            EditText textView   = (searchView.FindViewById(textViewId) as EditText);

            // Set custom colors
            // textView.SetBackgroundColor(G.Color.Rgb(25, 25, 25));
            textView.SetBackgroundColor(Settings.BlackBg ? G.Color.Rgb(12, 12, 12) : G.Color.Rgb(25, 25, 25));

            textView.SetHintTextColor(G.Color.Rgb(64, 64, 64));
            textView.SetTextColor(G.Color.Rgb(200, 200, 200));

            /*
             * textView.SetTextColor(G.Color.Rgb(32, 32, 32));
             * textView.SetHintTextColor(G.Color.Rgb(128, 128, 128));*/


            // Customize frame color
            int frameId = searchView.Context.Resources.GetIdentifier("android:id/search_plate", null, null);

            Android.Views.View frameView = (searchView.FindViewById(frameId) as Android.Views.View);
            frameView.SetBackgroundColor(G.Color.ParseColor(CloudStreamForms.Settings.MainBackgroundColor));
            //frameView.SetBackgroundColor(G.Color.Rgb(96, 96, 96));

            /*
             * // Get native control (background set in shared code, but can use SetBackgroundColor here)
             * SearchView searchView = (base.Control as SearchView);
             * //  searchView.SetBackgroundColor(new G.Color() { A = 1, R = 1, B = 255, G = 1 });
             * searchView.SetInputType(InputTypes.ClassText | InputTypes.TextVariationNormal);
             *
             * // Access search textview within control
             * int textViewId = searchView.Context.Resources.GetIdentifier("android:id/search_src_text", null, null);
             * EditText textView = (searchView.FindViewById(textViewId) as EditText);
             *
             * // Set custom colors
             * //textView.SetBackgroundColor(G.Color.Rgb(225, 225, 225));
             * textView.SetHintTextColor(G.Color.Rgb(64, 64, 64));
             * textView.SetTextColor(G.Color.Rgb(200, 200, 200));
             * textView.SetBackgroundColor(new G.Color() { A = 1, R = 1, B = 255, G = 1 });
             *
             *
             * // Customize frame color
             * int frameId = searchView.Context.Resources.GetIdentifier("android:id/search_plate", null, null);
             * Android.Views.View frameView = (searchView.FindViewById(frameId) as Android.Views.View);
             * Main.print(CloudStreamForms.Settings.MainBackgroundColor);
             * //  frameView.SetBackgroundColor(G.Color.ParseColor(CloudStreamForms.Settings.MainBackgroundColor));*/
        }
Exemple #28
0
                #pragma warning disable RECS0133
        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs args)
        {
            base.OnCellPropertyChanged(sender, args);

            if (args.PropertyName == "IsSelected")
            {
                _selected = !_selected;

                ViewCellBase extendedViewCell = sender as ViewCellBase;
                if (_selected)
                {
                    _cellCore.SetBackgroundColor(extendedViewCell.SelectedBackgroundColor.ToAndroid());
                }
                else
                {
                    _cellCore.SetBackground(_unselectedBackground);
                }

                _cellCore.SetBackgroundColor(extendedViewCell.SelectedBackgroundColor.ToAndroid());
            }
        }
        public TestResultsGroupView(Context context, TestRunInfo testRunInfo) : base(context)
        {
            var indicatorView = new View(context)
            {
                LayoutParameters = new LayoutParams(18, 18)
                {
                    LeftMargin = 60,
                    RightMargin = 14,
                    TopMargin = 14,
                    BottomMargin = 14,
                    Gravity = GravityFlags.CenterVertical
                }
            };
            indicatorView.SetBackgroundColor(
                testRunInfo.IsIgnored ? Color.Yellow
                : testRunInfo.Running ? Color.Gray
                : testRunInfo.Passed ? Color.Green
                : Color.Red);
            AddView(indicatorView);

            var container = new LinearLayout(context)
            {
                Orientation = Orientation.Vertical,
                LayoutParameters =
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
            };
            AddView(container);

            var text1 = new TextView(context)
            {
                Text = testRunInfo.Description,
                Ellipsize = TextUtils.TruncateAt.Marquee,
                LayoutParameters =
                    new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };
            text1.SetTextSize(ComplexUnitType.Sp, 22);
            text1.SetSingleLine(true);
            text1.SetPadding(2, 2, 2, 2);
            container.AddView(text1);

            var text2 = new TextView(context)
            {
                Text = testRunInfo.TestCaseName,
                Ellipsize = TextUtils.TruncateAt.Marquee,
                LayoutParameters =
                    new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };
            text2.SetTextSize(ComplexUnitType.Sp, 14);
            text2.SetSingleLine(true);
            text2.SetPadding(2, 2, 2, 2);
            container.AddView(text2);
        }
Exemple #30
0
            void UpdateBackgroundColor()
            {
                Color modalBkgndColor = _modal.BackgroundColor;

                if (modalBkgndColor == null)
                {
                    _backgroundView.SetWindowBackground();
                }
                else
                {
                    _backgroundView.SetBackgroundColor(modalBkgndColor.ToNative());
                }
            }
 protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "IsSelected")
     {
         var contactViewCell = sender as ContactViewCell;
         cellCore.SetBackgroundColor(contactViewCell.SelectedItemBackgroundColor.ToAndroid());
         selected = !selected;
         if (!selected)
         {
             cellCore.SetBackground(unselectedBackground);
         }
     }
 }
Exemple #32
0
            void UpdateBackgroundColor()
            {
                Color modalBkgndColor = _modal.BackgroundColor;

                if (modalBkgndColor.IsDefault)
                {
                    _backgroundView.SetWindowBackground();
                }
                else
                {
                    _backgroundView.SetBackgroundColor(modalBkgndColor.ToAndroid());
                }
            }
Exemple #33
0
        void AddCustomMenuView()
        {
            try
            {
                if (isCustomViewAdded)
                {
                    this.RemoveView(actionBarCustomView);
                    this.RemoveViewInLayout(actionBarCustomView);
                }

                //var layout = new Android.Widget.RelativeLayout.LayoutParams(
                //    Android.Widget.RelativeLayout.LayoutParams.MatchParent, Android.Widget.RelativeLayout.LayoutParams.WrapContent);
                //actionBarCustomView.Id = 2;
                //layout.AddRule(LayoutRules.CenterInParent, actionBarCustomView.Id);

                //Display display = _activity.WindowManager.DefaultDisplay;
                //Android.Graphics.Point size = new Android.Graphics.Point();
                //display.GetSize(size);
                //int height = size.Y;

                var layout = new Android.Widget.LinearLayout.LayoutParams(
                    ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                layout.Gravity = GravityFlags.Bottom;

                //layout.SetMargins(0, height, 0, 0);

                //var windowManager = this.Context.GetSystemService(Context.WindowService).JavaCast<IWindowManager>();
                //var layout = new WindowManagerLayoutParams(
                //    0, 500,
                //    ViewGroup.LayoutParams.MatchParent,
                //    ViewGroup.LayoutParams.WrapContent,
                //    WindowManagerTypes.Phone,
                //    WindowManagerFlags.Fullscreen,
                //    Format.Translucent);
                //layout.Gravity = GravityFlags.Bottom;


                actionBarCustomView.SetBackgroundColor(myTabbedPage.TabBackgroundColor.ToAndroid());

                this.AddView(actionBarCustomView, layout);

                isCustomViewAdded = true;
            }
            catch (Exception)
            {
                this.RemoveView(actionBarCustomView);
                this.RemoveViewInLayout(actionBarCustomView);

                AddCustomMenuView();
            }
        }
Exemple #34
0
        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnCellPropertyChanged(sender, e);

            if (e.PropertyName == "IsSelected")
            {
                _isSelected = !_isSelected;

                if (_isSelected)
                {
                    var customTextCell = sender as CustomTextCell;
                    if (customTextCell == null)
                    {
                        return;
                    }
                    _cell.SetBackgroundColor(customTextCell.SelectedBackgroundColor.ToAndroid());
                }
                else
                {
                    _cell.SetBackgroundColor(Android.Graphics.Color.Transparent);
                }
            }
        }
Exemple #35
0
        public void SnackbarShowIndefininte(string message)
        {
            Activity activity = CrossCurrentActivity.Current.Activity;

            Android.Views.View view = activity.FindViewById(Android.Resource.Id.Content);

            Snackbar snacks = Snackbar.Make(view, message, Snackbar.LengthIndefinite);

            Android.Views.View       v     = snacks.View;
            FrameLayout.LayoutParams param = (FrameLayout.LayoutParams)v.LayoutParameters;
            param.Gravity      = GravityFlags.Top;
            v.LayoutParameters = param;
            v.SetBackgroundColor(Android.Graphics.Color.Rgb(128, 117, 116));
            snacks.Show();
        }
		public override View GetView (int position, View convertView, ViewGroup parent)
		{
			if (convertView == null) {
				convertView = layoutInflater.Inflate (Resource.Layout.item_category, parent, false);
				convertView.Tag = new CategoryViewHolder ((LinearLayout)convertView);
			}
			var holder = (CategoryViewHolder)convertView.Tag;
			var category = (Category)GetItem (position);
			var theme = category.Theme;
			SetCategoryIcon (category, holder.Icon);
			convertView.SetBackgroundColor (GetColor (theme.WindowBackgroundColor));
			holder.Title.Text = category.Name;
			holder.Title.SetTextColor (GetColor ((theme.TextPrimaryColor)));
			holder.Title.SetBackgroundColor (GetColor (theme.PrimaryColor));
			return convertView;
		}
        public static void StyleBGLayer( View backgroundLayout )
        {
            backgroundLayout.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );

            View borderView = backgroundLayout.FindViewById<View>( Resource.Id.top_border );
            if ( borderView != null )
            {
                borderView.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
            }

            borderView = backgroundLayout.FindViewById<View>( Resource.Id.bottom_border );
            if ( borderView != null )
            {
                borderView.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            SetContentView(Resource.Layout.ColorSelect);

            r = FindViewById<SeekBar>(Resource.Id.seekBarR);
            g = FindViewById<SeekBar>(Resource.Id.seekBarG);
            b = FindViewById<SeekBar>(Resource.Id.seekBarB);
            col = FindViewById<View>(Resource.Id.viewColor);
            ImageButton back = FindViewById<ImageButton>(Resource.Id.imageButtonBack);

            Bundle bun = Intent.GetBundleExtra("color");
            byte[] rgb = bun.GetByteArray("color");
            color = new Color(rgb.ElementAt(0), rgb.ElementAt(1), rgb.ElementAt(2));
            col.SetBackgroundColor(color);
            r.Progress = (color.R * 100) / 255;
            g.Progress = (color.G * 100) / 255;
            b.Progress = (color.B * 100) / 255;

            back.Click += BackToMain;
            r.ProgressChanged += UpdateColor;
        }
 private void setupNavBarView(Context context, ViewGroup decorViewGroup)
 {
     mNavBarTintView = new View(context);
     FrameLayout.LayoutParams lparams;
     if (mConfig.isNavigationAtBottom())
     {
         lparams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, mConfig.getNavigationBarHeight());
         lparams.Gravity = GravityFlags.Bottom;
     }
     else
     {
         lparams = new FrameLayout.LayoutParams(mConfig.getNavigationBarWidth(), FrameLayout.LayoutParams.MatchParent);
         lparams.Gravity = GravityFlags.Right;
     }
     mNavBarTintView.LayoutParameters = lparams;
     mNavBarTintView.SetBackgroundColor(DEFAULT_TINT_COLOR);
     mNavBarTintView.Visibility = ViewStates.Gone;
     decorViewGroup.AddView(mNavBarTintView);
 }
        public TestResultsListView(Context context, TestRunInfo itemContent) : base(context)
        {
            Orientation = Orientation.Horizontal;
            
            var indicatorView = new View(context);
            indicatorView.SetBackgroundColor(
                itemContent.IsIgnored ? Color.Yellow
                : itemContent.Running ? Color.Gray
                : itemContent.Passed ? Color.Green
                : Color.Red);

            var descriptionView = new TextView(context)
            {
                Ellipsize = Android.Text.TextUtils.TruncateAt.Start,
                Gravity = GravityFlags.CenterVertical,
                Text = itemContent.Description
            };

            if(itemContent.IsTestSuite)
            {
                SetBackgroundColor(Color.Argb(255,50,50,50));
                
                indicatorView.LayoutParameters = new LayoutParams(18, 18)
                {
                    LeftMargin = 14,
                    RightMargin = 14,
                    TopMargin = 14,
                    BottomMargin = 14,
                    Gravity = GravityFlags.CenterVertical
                };

                descriptionView.LayoutParameters = new LayoutParams(
                    ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)
                {
                    BottomMargin = 14,
                    TopMargin = 14,
                    RightMargin = 14,
                    Height = 48,
                    Gravity = GravityFlags.CenterVertical
                };
            }
            else
            {
                indicatorView.LayoutParameters = new LayoutParams(
                    18, ViewGroup.LayoutParams.FillParent)
                {
                    RightMargin = 20
                };

                descriptionView.LayoutParameters = new LayoutParams(
                    ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)
                {
                    BottomMargin = 20,
                    TopMargin = 20,
                    RightMargin = 20,
                    Gravity = GravityFlags.CenterVertical
                };
            }

            AddView(indicatorView);
            AddView(descriptionView);
        }
		protected override async void OnElementChanged (ElementChangedEventArgs<Page> e)
		{
			base.OnElementChanged (e);

			var metrics = Resources.DisplayMetrics;
			var activity = this.Context as Activity;

			relativeLayout = new RelLayout (activity);
			var relativeLayoutParams = new RelLayout.LayoutParams (
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);

			// Create topTextView - "Scan QR code to swap contact info"
			topTextView = new TextView (activity);
			topTextView.Text = "Scan QR code to swap contact info";
			topTextView.Gravity = GravityFlags.Center;
			topTextView.SetTextColor (AColor.Rgb (38, 173, 230));
			topTextView.TextSize = 14f;
			topTextView.Typeface = Typeface.CreateFromAsset (Forms.Context.Assets, "OpenSans-Bold.ttf");

			RelLayout.LayoutParams topTVLayoutParams = new RelLayout.LayoutParams(
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);

			relativeLayout.AddView (topTextView, topTVLayoutParams);
			/* * * * * * * * * * * * * * * * * * * * * * * * * * * */

			/* Create the Barcode Picker View */
			barcodePicker = new ScanditSDKBarcodePicker (activity, "EeQ6GjLtEeSWsF/zcFfsWC8RqIt/+skbdZJ/MWpLIR8");
			barcodePicker.OverlayView.AddListener (this);

			// disable all codes except QR for scanning
			barcodePicker.Set1DScanningEnabled (false);
			barcodePicker.Set2DScanningEnabled (false);
			barcodePicker.SetCode128Enabled (false);
			barcodePicker.SetCode39Enabled (false);
			barcodePicker.SetCode93Enabled (false);
			barcodePicker.SetDataMatrixEnabled (false);
			barcodePicker.SetEan13AndUpc12Enabled (false);
			barcodePicker.SetEan8Enabled (false);
			barcodePicker.SetItfEnabled (false);
			barcodePicker.SetMicroDataMatrixEnabled (false);
			barcodePicker.SetUpceEnabled (false);
			/* - * - * - * - * - * - * - */
			barcodePicker.SetQrEnabled (true);
			/* - * - * - * - * - * - * - */

			RelLayout.LayoutParams bpLayoutParams = new RelLayout.LayoutParams(
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);
			bpLayoutParams.AddRule(LayoutRules.CenterHorizontal);

			relativeLayout.AddView (barcodePicker, bpLayoutParams);
			/* * * * * * * * * * * * * * * * * * * * * * * * * * * */

			/* Create the overlay view -- this is to cover the bottom part of the barcode scanner view */
			overlay = new AView(activity);
			overlay.SetBackgroundColor (AColor.White);

			RelLayout.LayoutParams oLayoutParams = new RelLayout.LayoutParams(
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);
			oLayoutParams.AddRule(LayoutRules.AlignParentBottom);

			relativeLayout.AddView (overlay, oLayoutParams);
			/* * * * * * * * * * * * * * * * * * * * * * * * * * * */

			// Create bottomTextView - "Share your contact info"
			bottomTextView = new TextView (activity);
			bottomTextView.Text = "Share your contact info";
			bottomTextView.Gravity = GravityFlags.Center;
			bottomTextView.SetTextColor (AColor.Rgb (38, 173, 230));
			bottomTextView.TextSize = 14f;
			bottomTextView.Typeface = Typeface.CreateFromAsset (Forms.Context.Assets, "OpenSans-Bold.ttf");

			RelLayout.LayoutParams bottomTVLayoutParams = new RelLayout.LayoutParams(
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);

			relativeLayout.AddView (bottomTextView, bottomTVLayoutParams);
			/* * * * * * * * * * * * * * * * * * * * * * * * * * * */

			/* * * Generating QR code * * */
			IBarcodeWriter barcodeWriter = new BarcodeWriter 
			{ 
				Format = BarcodeFormat.QR_CODE,
				Options = new ZXing.Common.EncodingOptions
				{
					Width = 175,
					Height = 175
				}
			};

			// TODO: temp code - move to view model
			var service = TinyIoC.TinyIoCContainer.Current.Resolve<CouchbaseConnect2014.Services.ICouchbaseService> ();
			var contactId = service.GetUserId ();
			var repo = TinyIoC.TinyIoCContainer.Current.Resolve<CouchbaseConnect2014.Services.IRepository> ();
			var localUser = await repo.GetProfile ();
			// end of temp code

			var qrContent = string.Format ("{0},{1},{2}", contactId, localUser.First, localUser.Last);

			var result = barcodeWriter.Write (qrContent);
			qrImageView = new ImageView (activity);
			qrImageView.SetImageBitmap (result);

			RelLayout.LayoutParams qrLayoutParams = new RelLayout.LayoutParams (
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);
			qrLayoutParams.AddRule (LayoutRules.CenterHorizontal);

			relativeLayout.AddView (qrImageView, qrLayoutParams);
			/* * * * * * * * * * * * * * * * * * * * * * * * * * * */

			AddView (relativeLayout, relativeLayoutParams);

			barcodePicker.SetScanningHotSpot (0.5f, 0.2f);
			barcodePicker.OverlayView.SetViewfinderDimension (0.4f, 0.28f);
			barcodePicker.OverlayView.SetTorchEnabled (false);

			barcodePicker.StartScanning();
		}
		public void OnGenerated (Palette palette)
		{
			
			//Pallet has been generated with 6 coors to pick from:
			//Vibrant: palette.VibrantColor
			//Vibrant dark: palette.DarkVibrantColor
			//Vibrant light: palette.LightVibrantColor
			//Muted: palette.MutedColor
			//Muted dark: palette.DarkMutedColor
			//Muted light: palette.LightMutedColor
			if (palette == null)
				return;
				

			//must check each palette as there is no guarantee
			//that it was generated.
			if (palette.LightVibrantSwatch != null) {
				var lightVibrant = new Color (palette.LightVibrantSwatch.Rgb);
				name.SetBackgroundColor(lightVibrant);
				var color = new Color (lightVibrant);
				SupportActionBar.SetBackgroundDrawable (new ColorDrawable(color));
				if ((int)Build.VERSION.SdkInt >= 21)
					Window.SetStatusBarColor (color);
			}

			if (palette.DarkVibrantSwatch != null) {
				var darkVibrant = new Color (palette.DarkVibrantSwatch.Rgb);
				name.SetTextColor (darkVibrant);

				var view = FindViewById (Resource.Id.main_layout);
				view.SetBackgroundColor (darkVibrant);
			}

			var layoutParams = new LinearLayout.LayoutParams(30,30);
			//Loop through each of the palettes available
			//and put them as a small square
			foreach (var p in palette.Swatches) {
				if (p == null)
					continue;

				var view = new View (this);
				view.SetBackgroundColor (new Color (p.Rgb));
				view.LayoutParameters = layoutParams;
				colors.AddView (view, 0);
			}
		}
        private List<PieSlice> GetPieSlices( float unallocated)
        {
            int i = 0;
            mLLayoutModel.RemoveAllViews();

            List<PieSlice> return_slices = new List<PieSlice>();
            /*This needs to be corrected*/
            TextView mainlabel = new TextView(this);
            mainlabel.TextSize = 14;
            LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            llp.SetMargins(5, 0, 0, 5);
            mainlabel.LayoutParameters = llp;
            mainlabel.SetTextColor(Android.Graphics.Color.Black);
            mainlabel.Text = "Legends for reference:";

            mLLayoutModel.AddView(mainlabel);

            foreach (var item in m_sortedlist)
            {
                if (i >= colors.Length)
                {
                    i = 0;
                }
                return_slices.Add(new PieSlice(item.ItemBrief, item.ItemCost) { Fill = OxyColor.Parse(colors[i]), IsExploded = true });

                LinearLayout hLayot = new LinearLayout(this);
                hLayot.Orientation = Android.Widget.Orientation.Horizontal;
                LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
                hLayot.LayoutParameters = param;

                //Add views with colors
                LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(30, 30);

                View mView = new View(this);

                lp.TopMargin = 7;
                mView.LayoutParameters = lp;
                mView.SetBackgroundColor(Android.Graphics.Color.ParseColor(colors[i++]));

                //Add titles
                TextView label = new TextView(this);
                label.TextSize = 14;
                label.SetTextColor(Android.Graphics.Color.Black);
                string textlabel = item.ItemBrief + ": $" + item.ItemCost;
                label.Text = string.Join(" ", textlabel);
                param.LeftMargin = 10;
                label.LayoutParameters = param;

                hLayot.Tag = item.ID.ToString();
                hLayot.AddView(mView);
                hLayot.AddView(label);

                hLayot.Click += HLayot_Click;
                mLLayoutModel.AddView(hLayot);
            }
            return return_slices;
        }
		public void OnGenerated (Palette palette)
		{
			//Pallet has been generated with 6 coors to pick from:
			//Vibrant: palette.VibrantColor
			//Vibrant dark: palette.DarkVibrantColor
			//Vibrant light: palette.LightVibrantColor
			//Muted: palette.MutedColor
			//Muted dark: palette.DarkMutedColor
			//Muted light: palette.LightMutedColor
			if (palette == null)
				return;
				

			//must check each palette as there is no guarantee
			//that it was generated.
			if (palette.LightVibrantSwatch != null) {
				var lightVibrant = new Color (palette.LightVibrantSwatch.Rgb);
				name.SetBackgroundColor(lightVibrant);
				ActionBar.SetBackgroundDrawable (new ColorDrawable (new Color(lightVibrant)));
			}

			if (palette.DarkVibrantSwatch != null) {
				var darkVibrant = new Color (palette.DarkVibrantSwatch.Rgb);

				var actionBarTitleId = Android.Content.Res.Resources.System.GetIdentifier ("action_bar_title", "id", "android");
				if (actionBarTitleId > 0) {
					var title = FindViewById<TextView> (actionBarTitleId);
					if (title != null)
						title.SetTextColor (darkVibrant);
				}

				var view = FindViewById (Resource.Id.main_layout);
				view.SetBackgroundColor (darkVibrant);
			}

			var layoutParams = new LinearLayout.LayoutParams(30,30);
			//Loop through each of the palettes available
			//and put them as a small square
			foreach (var p in palette.Swatches) {
				if (p == null)
					continue;

				var view = new View (this);
				view.SetBackgroundColor (new Color (p.Rgb));
				view.LayoutParameters = layoutParams;
				colors.AddView (view, 0);
			}
		}
Exemple #45
0
    public bool OnDrag(View view, DragEvent dragEvent)
    {
      bool result = true;

      MoveDragData dragData = null;
      if (dragEvent.LocalState is MoveDragData)
      {
        dragData = dragEvent.LocalState as MoveDragData;
      }
      else
      {
        if (Successor is View.IOnDragListener)
        {
          return (Successor as View.IOnDragListener).OnDrag(view, dragEvent);
        }
      }

      switch (dragEvent.Action)
      {
        case DragEvent.ACTION_DRAG_STARTED:
          break;
        case DragEvent.ACTION_DRAG_ENTERED:

          view.SetBackgroundColor(view.Context.Resources.GetColor(R.Color.accent_blue));
          //float[] single = { 1.0F, 0.5F };
          //anim = ObjectAnimator.OfFloat((Object)view, "alpha", single);
          //anim.SetInterpolator(new CycleInterpolator(40));
          //anim.SetDuration(30 * 1000); // 30 seconds
          //anim.Start();
          break;
        case DragEvent.ACTION_DRAG_ENDED:
        case DragEvent.ACTION_DRAG_EXITED:
          view.SetBackgroundColor(view.Context.Resources.GetColor(R.Color.light_blue));
          //if (anim != null)
          //{
          //  anim.End();
          //  anim = null;
          //}
          break;
        case DragEvent.ACTION_DROP:
          view.SetBackgroundColor(view.Context.Resources.GetColor(R.Color.light_blue));
          //if (anim != null)
          //{
          //  anim.End();
          //  anim = null;
          //}

          // Dropped, reassign View to ViewGroup
          var dragedView = dragData.draggedView;
          ViewGroup owner = (ViewGroup)dragedView.Parent;
          owner.RemoveView(dragedView);
          //LinearLayout container = (LinearLayout)view;
          HorizontalFlowLayout container = (HorizontalFlowLayout)view;
          container.AddView(dragedView);
          dragedView.Visibility = (View.VISIBLE);

          // Inform all listeners
          OnMoveDropAccepted(dragData.dragHandler.CurrentContainer, Id, (dragData as MoveDragData).dragHandler.CheckerData);
          // Set as currentContainer
          dragData.dragHandler.CurrentContainer = Id;

          break;
        case DragEvent.ACTION_DRAG_LOCATION:
          break;
        default:
          break;
      }

      return result;
    }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {

            if (convertView == null)
            {
                LayoutInflater inflater = mActivity.LayoutInflater;
                convertView = inflater.Inflate(Resource.Layout.details_show_season_list_item, parent, false);
            }

            var myTextView = convertView.FindViewById<TextView>(Resource.Id.detailsShowSeasonListItemTitle);
           myTextView.Text = "Season "+_myShow.Seasons[position].SeasonNumber;

            

           var episodesWatchedTextView = convertView.FindViewById<TextView>(Resource.Id.detailsShowEpisodesWatched);

            int numEpisodesWatched = 0;

            foreach (var tvEpisode in _myShow.Seasons[position].Episodes)
            {
                if (tvEpisode.isEpisodeTrakked)
                {
                    numEpisodesWatched++;
                }
            }

            episodesWatchedTextView.Text = numEpisodesWatched + " Episodes Watched / "
                                           + _myShow.Seasons[position].Episodes.Count + " total";


            var seasonThumbnail = convertView.FindViewById<ImageView>(Resource.Id.seasonThumbnail);

            Koush.UrlImageViewHelper.SetUrlDrawable(seasonThumbnail,
                "http://image.tmdb.org/t/p/w92" + _myShow.Seasons[position].PosterPath);

            if (_showSetSelectedIndex && selectedIndex != -1 && position == selectedIndex)
            {
                convertView.SetBackgroundColor(Android.Graphics.Color.Blue);
            }
            else
            {
                convertView.SetBackgroundColor(Android.Graphics.Color.Black);
            }

            return convertView;


        }
                public ListItem( Context context ) : base( context )
                {
                    Orientation = Android.Widget.Orientation.Vertical;

                    SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) );

                    LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    contentLayout.Orientation = Android.Widget.Orientation.Horizontal;
                    contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent );
                    AddView( contentLayout );

                    Thumbnail = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Thumbnail.LayoutParameters = new LinearLayout.LayoutParams( (int)Rock.Mobile.Graphics.Util.UnitToPx( PrivateConnectConfig.MainPage_ThumbnailDimension ), (int)Rock.Mobile.Graphics.Util.UnitToPx( PrivateConnectConfig.MainPage_ThumbnailDimension ) );
                    ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    Thumbnail.SetScaleType( ImageView.ScaleType.CenterCrop );
                    contentLayout.AddView( Thumbnail );

                    TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TitleLayout.Orientation = Android.Widget.Orientation.Vertical;
                    TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    contentLayout.AddView( TitleLayout );



                    Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
                    Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
                    Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) );
                    Title.SetSingleLine( );
                    Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
                    ( (LinearLayout.LayoutParams)Title.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 );
                    TitleLayout.AddView( Title );

                    SubTitle = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SubTitle.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    SubTitle.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    SubTitle.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    SubTitle.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    ( (LinearLayout.LayoutParams)SubTitle.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
                    ( (LinearLayout.LayoutParams)SubTitle.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 );
                    TitleLayout.AddView( SubTitle );

                    // fill the remaining space with a dummy view, and that will align our chevron to the right
                    View dummyView = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    dummyView.LayoutParameters = new LinearLayout.LayoutParams( 0, 0 );
                    ( (LinearLayout.LayoutParams)dummyView.LayoutParameters ).Weight = 1;
                    contentLayout.AddView( dummyView );

                    Chevron = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Chevron.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)Chevron.LayoutParameters ).Gravity = GravityFlags.CenterVertical | GravityFlags.Right;
                    Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
                    Chevron.SetTypeface(  fontFace, TypefaceStyle.Normal );
                    Chevron.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateConnectConfig.MainPage_Table_IconSize );
                    Chevron.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    Chevron.Text = PrivateConnectConfig.MainPage_Table_Navigate_Icon;
                    contentLayout.AddView( Chevron );

                    // add our own custom seperator at the bottom
                    Seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
                    Seperator.LayoutParameters.Height = 2;
                    Seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
                    AddView( Seperator );
                }
Exemple #48
0
        TableRow GetDelim(Android.Graphics.Color color)
        {
            TableRow.LayoutParams lpDelim = new TableRow.LayoutParams ();
            lpDelim.Height = TableLayout.LayoutParams.WrapContent;
            lpDelim.Width = TableLayout.LayoutParams.WrapContent;
            lpDelim.SetMargins (ToDIP(2), ToDIP(1), ToDIP(2), ToDIP(1));
            //			lpDelim.Span = currentAttendances.Count + 2;
            lpDelim.Span = newAttendanceResults.Count + 2;

            TableRow rDelim = new TableRow (Activity);
            View vDelim = new View (Activity);
            vDelim.SetMinimumHeight (ToDIP(3));
            vDelim.SetBackgroundColor (color);
            vDelim.LayoutParameters = lpDelim;
            rDelim.AddView (vDelim);

            return rDelim;
        }
        private View CreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            FrameLayout parent = new FrameLayout(Activity);
            parent.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent);
            mBg = new View(Activity);
            mBg.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent);
            mBg.SetBackgroundColor(Color.Argb(160, 0, 0, 0));
            mBg.SetOnClickListener(this);

            mPanel = new LinearLayout(Activity);
            FrameLayout.LayoutParams param = new FrameLayout.LayoutParams(
                FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.WrapContent);
            param.Gravity = GravityFlags.Bottom;
            mPanel.LayoutParameters = param;
            mPanel.Orientation = Android.Widget.Orientation.Vertical;
            View child = OnCreateChildView(inflater, container, savedInstanceState);

            parent.AddView(mBg);
            parent.AddView(mPanel);
            mPanel.AddView(child);
            return parent;
        }
                public MessageListItem( Context context ) : base( context )
                {
                    SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) );
                    LayoutParameters = new AbsListView.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );

                    Orientation = Orientation.Vertical;

                    LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
                    contentLayout.Orientation = Orientation.Horizontal;
                    AddView( contentLayout );

                    TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.WrapContent );
                    TitleLayout.Orientation = Orientation.Vertical;
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Weight = 1;
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    contentLayout.AddView( TitleLayout );

                    Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
                    Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
                    Title.SetSingleLine( );
                    Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
                    Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
                    TitleLayout.AddView( Title );

                    Date = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Date.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    Date.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    Date.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    Date.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    ( (LinearLayout.LayoutParams)Date.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
                    TitleLayout.AddView( Date );

                    Speaker = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Speaker.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    Speaker.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    Speaker.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    Speaker.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    ( (LinearLayout.LayoutParams)Speaker.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
                    Speaker.SetMaxLines( 1 );
                    TitleLayout.AddView( Speaker );

                    // add our own custom seperator at the bottom
                    View seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
                    seperator.LayoutParameters.Height = 2;
                    seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
                    AddView( seperator );


                    // setup the buttons
                    LinearLayout buttonLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    buttonLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
                    ( (LinearLayout.LayoutParams)buttonLayout.LayoutParameters ).Weight = 1;
                    buttonLayout.Orientation = Orientation.Horizontal;
                    contentLayout.AddView( buttonLayout );

                    Typeface buttonFontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );

                    ListenButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ListenButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Weight = 1;
                    ( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    ListenButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
                    ListenButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
                    ListenButton.Text = PrivateNoteConfig.Series_Table_Listen_Icon;
                    ListenButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
                    ListenButton.Background = null;
                    buttonLayout.AddView( ListenButton );

                    WatchButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    WatchButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Weight = 1;
                    ( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    WatchButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
                    WatchButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
                    WatchButton.Text = PrivateNoteConfig.Series_Table_Watch_Icon;
                    WatchButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
                    WatchButton.Background = null;
                    buttonLayout.AddView( WatchButton );

                    TakeNotesButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TakeNotesButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Weight = 1;
                    ( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    TakeNotesButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
                    TakeNotesButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
                    TakeNotesButton.Text = PrivateNoteConfig.Series_Table_TakeNotes_Icon;
                    TakeNotesButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
                    TakeNotesButton.Background = null;
                    buttonLayout.AddView( TakeNotesButton );

                    ListenButton.Click += (object sender, EventArgs e ) =>
                        {
                            ParentAdapter.OnClick( Position, 0 );
                        };

                    WatchButton.Click += (object sender, EventArgs e ) =>
                        {
                            ParentAdapter.OnClick( Position, 1 );
                        };

                    TakeNotesButton.Click += (object sender, EventArgs e ) =>
                        {
                            ParentAdapter.OnClick( Position, 2 );
                        };
                }
 public override void OnClick(View widget)
 {
     widget.SetBackgroundColor (Color.Transparent);
     if (Click != null)
         Click();
 }
 public override void OnClick(View widget)
 {
     widget.SetBackgroundColor (Color.White);
     if (Click != null)
         Click();
 }
Exemple #53
0
        private static AppMsg MakeText(Activity context, String text, Style style, View view, bool floating, float textSize, View.IOnClickListener clickListener)
        {
            AppMsg result = new AppMsg(context);

            view.SetBackgroundColor(style.BackgroundColor);
            view.Clickable = true;

            TextView tv = view.FindViewById<TextView>(Android.Resource.Id.Message);
            if (textSize > 0)
            {
                tv.SetTextSize(Android.Util.ComplexUnitType.Sp, textSize);
            }
            else
            {
                tv.SetTextSize(Android.Util.ComplexUnitType.Dip, TEXTSIZE);
            }
            tv.Text = text;
            tv.SetTextColor(style.TextColor);

            result.mView = view;
            result.mDuration = style.Duration;
            result.mFloating = floating;

            view.SetOnClickListener(clickListener);
            return result;
        }
                public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
                {
                    if (container == null)
                    {
                        // Currently in a layout without a container, so no reason to create our view.
                        return null;
                    }

                    GroupEntries = new List<GroupFinder.GroupEntry>();
                    MarkerList = new List<Android.Gms.Maps.Model.Marker>();
                    SourceLocation = new GroupFinder.GroupEntry();

                    // limit the address to 90% of the screen so it doesn't conflict with the progress bar.
                    Point displaySize = new Point( );
                    Activity.WindowManager.DefaultDisplay.GetSize( displaySize );
                    //float fixedWidth = displaySize.X / 4.0f;

                    // catch any exceptions thrown, as they'll be related to no map API key
                    try
                    {
                        MapView = new Android.Gms.Maps.MapView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                        MapView.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                        MapView.LayoutParameters.Height = (int) (displaySize.Y * .50f);
                        MapView.GetMapAsync( this );
                        MapView.SetBackgroundColor( Color.Black );

                        MapView.OnCreate( savedInstanceState );
                    }
                    catch
                    {
                        MapView = null;
                        Rock.Mobile.Util.Debug.WriteLine( "GOOGLE MAPS: Unable to create. Verify you have a valid API KEY." );
                    }


                    SearchAddressButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchAddressButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
                    ControlStyling.StyleButton( SearchAddressButton, ConnectStrings.GroupFinder_SearchButtonLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize );
                    SearchAddressButton.Click += (object sender, EventArgs e ) =>
                    {
                            SearchPage.Show( );
                    };


                    // setup the linear layout containing the "Your Neighborhood is: Horizon" text
                    SearchLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchLayout.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
                    SearchLayout.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );
                    SearchLayout.SetGravity( GravityFlags.Center );

                    SearchResultPrefix = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchResultPrefix.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    SearchResultPrefix.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    SearchResultPrefix.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    SearchResultPrefix.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    SearchResultPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound;

                    SearchResultNeighborhood = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchResultNeighborhood.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    SearchResultNeighborhood.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    SearchResultNeighborhood.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    SearchResultNeighborhood.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) );
                    SearchResultNeighborhood.Text = "";


                    Seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
                    Seperator.LayoutParameters.Height = 2;
                    Seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );

                    ListView = new ListView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ListView.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                    ListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e ) =>
                        {
                            OnClick( e.Position, 0 );
                        };
                    ListView.SetOnTouchListener( this );
                    ListView.Adapter = new GroupArrayAdapter( this );

                    View view = inflater.Inflate(Resource.Layout.Connect_GroupFinder, container, false);
                    view.SetOnTouchListener( this );

                    view.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );

                    LinearLayout groupLayout = view.FindViewById<LinearLayout>( Resource.Id.groupFrame ) as LinearLayout;

                    // setup the address layout, which has the address text, padding, and finally the progress bar.
                    if ( MapView != null )
                    {
                        ( (LinearLayout)groupLayout ).AddView( MapView );
                    }

                    ((LinearLayout)groupLayout).AddView( SearchAddressButton );

                    ((LinearLayout)groupLayout).AddView( SearchLayout );
                    ((LinearLayout)SearchLayout).AddView( SearchResultPrefix );
                    ((LinearLayout)SearchLayout).AddView( SearchResultNeighborhood );

                    ((LinearLayout)groupLayout).AddView( Seperator );
                    ((LinearLayout)groupLayout).AddView( ListView );

                    BlockerView = new UIBlockerView( view, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ) );

                    SearchPage = new UIGroupFinderSearch();
                    SearchPage.Create( view, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ), 
                        delegate
                        {
                            SearchPage.Hide( true );
                            GetGroups( SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text );
                        } );
                    SearchPage.SetTitle( ConnectStrings.GroupFinder_SearchPageHeader, ConnectStrings.GroupFinder_SearchPageDetails );
                    SearchPage.LayoutChanged( new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ) );
                    SearchPage.Hide( false );

                    // if we should automatically show the search page...
                    if ( ShowSearchOnAppear == true )
                    {
                        // don't allow them to tap the address button until we reveal the search page.
                        SearchAddressButton.Enabled = false;

                        // wait a couple seconds before revealing the search page.
                        System.Timers.Timer timer = new System.Timers.Timer();
                        timer.AutoReset = false;
                        timer.Interval = 1000;
                        timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e ) =>
                        {
                            Rock.Mobile.Threading.Util.PerformOnUIThread( delegate
                                {
                                    SearchAddressButton.Enabled = true;
                                    SearchPage.Show( );
                                } );
                        };
                        timer.Start( );
                    }
                    else
                    {
                        // otherwise, just allow the seach button
                        SearchAddressButton.Enabled = true;
                    }

                    // hook into the search page as its listener
                    ((View)SearchPage.View.PlatformNativeObject).SetOnTouchListener( this );
                    ((EditText)SearchPage.Street.PlatformNativeObject).SetOnEditorActionListener( this );
                    ((EditText)SearchPage.City.PlatformNativeObject).SetOnEditorActionListener( this );
                    ((EditText)SearchPage.State.PlatformNativeObject).SetOnEditorActionListener( this );
                    ((EditText)SearchPage.ZipCode.PlatformNativeObject).SetOnEditorActionListener( this );
                    return view;
                }
		void Initialize ()
		{
			BackgroundColor = Color.Black;
			strokeColor = Color.White;
			StrokeWidth = 2f;

			canvasView = new SignatureCanvasView (this.context);
			canvasView.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);

			//Set the attributes for painting the lines on the screen.
			paint = new Paint ();
			paint.Color = strokeColor;
			paint.StrokeWidth = StrokeWidth;
			paint.SetStyle (Paint.Style.Stroke);
			paint.StrokeJoin = Paint.Join.Round;
			paint.StrokeCap = Paint.Cap.Round;
			paint.AntiAlias = true;

			#region Add Subviews
			RelativeLayout.LayoutParams layout;

			BackgroundImageView = new ImageView (this.context);
			BackgroundImageView.Id = generateId ();
			AddView (BackgroundImageView);

			//Add an image that covers the entire signature view, used to display already drawn
			//elements instead of having to redraw them every time the user touches the screen.
			imageView = new ClearingImageView (context);
			imageView.SetBackgroundColor (Color.Transparent);
			imageView.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);
			AddView (imageView);

			lblSign = new TextView (context);
			lblSign.Id = generateId ();
			lblSign.SetIncludeFontPadding (true);
			lblSign.Text = "Sign Here";
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.AlignWithParent = true;
			layout.BottomMargin = 6;
			layout.AddRule (LayoutRules.AlignBottom);
			layout.AddRule (LayoutRules.CenterHorizontal);
			lblSign.LayoutParameters = layout;
			lblSign.SetPadding (0, 0, 0, 6);
			AddView (lblSign);

			//Display the base line for the user to sign on.
			signatureLine = new View (context);
			signatureLine.Id = generateId ();
			signatureLine.SetBackgroundColor (Color.Gray);
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, 1);
			layout.SetMargins (10, 0, 10, 5);
			layout.AddRule (LayoutRules.Above, lblSign.Id);
            signatureLine.LayoutParameters = layout;
			AddView (signatureLine);

			//Display the X on the left hand side of the line where the user signs.
			xLabel = new TextView (context);
			xLabel.Id = generateId ();
			xLabel.Text = "X";
			xLabel.SetTypeface (null, TypefaceStyle.Bold);
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.LeftMargin = 11;
			layout.AddRule (LayoutRules.Above, signatureLine.Id);
			xLabel.LayoutParameters = layout;
			AddView (xLabel);

			AddView (canvasView);

			lblClear = new TextView (context);
			lblClear.Id = generateId ();
			lblClear.Text = "Clear";
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.SetMargins (0, 10, 22, 0);
			layout.AlignWithParent = true;
			layout.AddRule (LayoutRules.AlignRight);
			layout.AddRule (LayoutRules.AlignTop);
			lblClear.LayoutParameters = layout;
			lblClear.Visibility = ViewStates.Invisible;
			lblClear.Click += (object sender, EventArgs e) => {
				Clear ();
			};
			AddView (lblClear);
			#endregion

			paths = new List<Path> ();
			points = new List<System.Drawing.PointF[]> ();
			currentPoints = new List<System.Drawing.PointF> ();

			dirtyRect = new RectF ();
		}
                public GroupListItem( Context context ) : base( context )
                {
                    SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) );
                    LayoutParameters = new AbsListView.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );

                    Orientation = Orientation.Vertical;

                    LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
                    contentLayout.Orientation = Orientation.Horizontal;
                    AddView( contentLayout );

                    TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent );
                    TitleLayout.Orientation = Orientation.Vertical;
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Weight = 1;
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
                    contentLayout.AddView( TitleLayout );

                    Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
                    Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
                    Title.SetSingleLine( );
                    Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
                    Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
                    TitleLayout.AddView( Title );

                    Typeface buttonFontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );

                    JoinButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    JoinButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)JoinButton.LayoutParameters ).Weight = 0;
                    ( (LinearLayout.LayoutParams)JoinButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    JoinButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
                    JoinButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateConnectConfig.GroupFinder_Join_IconSize );
                    JoinButton.Text = PrivateConnectConfig.GroupFinder_JoinIcon;
                    JoinButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    JoinButton.Background = null;
                    JoinButton.FocusableInTouchMode = false;
                    JoinButton.Focusable = false;
                    contentLayout.AddView( JoinButton );

                    JoinButton.Click += (object sender, EventArgs e ) =>
                        {
                            ParentAdapter.OnClick( Position, 1 );
                        };
                    
                    MeetingTime = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    MeetingTime.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    MeetingTime.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal );
                    MeetingTime.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    MeetingTime.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
                    TitleLayout.AddView( MeetingTime );

                    Distance  = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Distance.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    Distance.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal );
                    Distance.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    Distance.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
                    TitleLayout.AddView( Distance );

                    // add our own custom seperator at the bottom
                    View seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
                    seperator.LayoutParameters.Height = 2;
                    seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
                    AddView( seperator );
                }
Exemple #57
0
            internal void SelectView(View view)
            {
                if (view != lastSelectedView)
                {
                    if (lastSelectedView != null)
                        lastSelectedView
                            .SetBackgroundColor(Android.Graphics.Color.Transparent);

                    lastSelectedView = view;
                    view.SetBackgroundColor(Android.Graphics.Color.ParseColor("#33b5e5"));
                }
            }
        /**
         * 创建基本的背景视图
         */
        private View CreateView()
        {
            FrameLayout parent = new FrameLayout(_mContext);
            FrameLayout.LayoutParams parentParams =
                new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
                {
                    Gravity = GravityFlags.Bottom
                };
            parent.LayoutParameters = parentParams;
            _mBg = new View(_mContext)
            {
                LayoutParameters =
                    new ActionBar.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
            };
            _mBg.SetBackgroundColor(Color.Argb(136, 0, 0, 0));
            _mBg.Id = BgViewId;
            _mBg.SetOnClickListener(this);

            _mPanel = new LinearLayout(_mContext);
            FrameLayout.LayoutParams mPanelParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
            {
                Gravity = GravityFlags.Bottom
            };
            _mPanel.LayoutParameters = mPanelParams;
            //mPanel.setOrientation(LinearLayout.VERTICAL);
            //mPanel.Orientation = Linear
            parent.AddView(_mBg);
            parent.AddView(_mPanel);
            return parent;
        }
		void Initialize ()
		{
			this.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			this.Orientation = Orientation.Vertical;

			linea_separador = new View (context);
			linea_separador.LayoutParameters = new ViewGroup.LayoutParams (-1, 5);
			linea_separador.SetBackgroundColor (Color.ParseColor ("#eeeeee"));

			imgUser = new ImageView (context);
			scrollImage = new HorizontalScrollView (context);
			scrollImage.HorizontalScrollBarEnabled = false;
			linearImage = new LinearLayout (context);
			linearPanelScroll = new LinearLayout (context);
			linearContainer = new LinearLayout (context);
			linearAll = new LinearLayout (context);

			txtAuthor = new TextView (context);
			txtContainer = new TextView (context);
			txtTitle = new TextView (context);


			linearAll.LayoutParameters = new LinearLayout.LayoutParams (-1,-2);
			linearImage.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(140),-2);
			linearContainer.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(500),-2);
			linearPanelScroll.LayoutParameters = new LinearLayout.LayoutParams (-2,-2);
			scrollImage.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (500), -2);


			linearAll.Orientation = Orientation.Horizontal;
			linearImage.Orientation = Orientation.Vertical;
			linearContainer.Orientation = Orientation.Vertical;

			txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight(40));
			txtAuthor.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (30));
			txtContainer.SetTextSize(ComplexUnitType.Px, Configuration.getHeight (45));
			txtAuthor.SetTextColor (Color.ParseColor("#3c3c3c"));
			txtContainer.SetTextColor (Color.ParseColor("#3c3c3c"));

			txtTitle.SetSingleLine (true);
			txtAuthor.SetSingleLine (true);
			txtContainer.SetSingleLine (false);
			txtContainer.SetPadding (0, 0, 20, 0);
			txtContainer.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeueLight.ttf");
			txtAuthor.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeueLight.ttf");

			scrollImage.AddView (linearPanelScroll);
			linearAll.AddView (linearImage);
			linearAll.AddView (linearContainer);

			linearImage.AddView (imgUser);

			linearContainer.AddView (txtTitle);
			linearContainer.AddView (txtAuthor);
			linearContainer.AddView (txtContainer);
			linearContainer.AddView (scrollImage);

			int space = Configuration.getHeight (50);



			scrollImage.SetPadding (0, 0, 0, space);
			this.AddView (linearAll);
			this.AddView (linea_separador);
			this.SetPadding (0, 0,0, space);


		}
                public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
                {
                    base.OnCreateView( inflater, container, savedInstanceState );

                    // get the root control from our .axml
                    var layout = inflater.Inflate(Resource.Layout.Notes, container, false) as RelativeLayout;

                    // get the refresh button from the layout
                    RefreshButton = layout.FindViewById<Button>( Resource.Id.refreshButton );

                    // create our overridden lockable scroll view
                    ScrollView = new LockableScrollView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ScrollView.ScrollBarStyle = ScrollbarStyles.InsideInset;
                    ScrollView.OverScrollMode = OverScrollMode.Always;
                    ScrollView.VerticalScrollbarPosition = ScrollbarPosition.Default;
                    ScrollView.LayoutParameters = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                    ScrollView.Notes = this;
                    ((RelativeLayout.LayoutParams)ScrollView.LayoutParameters).AddRule(LayoutRules.CenterHorizontal);
                    ((RelativeLayout.LayoutParams)ScrollView.LayoutParameters).AddRule(LayoutRules.Below, Resource.Id.refreshButton);

                    // add it to our main layout.
                    layout.AddView( ScrollView );

                    Indicator = layout.FindViewById<ProgressBar>( Resource.Id.progressBar );
                    Indicator.Visibility = ViewStates.Gone;
                    Indicator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( 0 ) );
                    Indicator.BringToFront();

                    // create the layout that will contain the notes
                    ScrollViewLayout = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ScrollView.AddView( ScrollViewLayout );
                    ScrollViewLayout.SetOnTouchListener( this );

                    RefreshButton.Click += (object sender, EventArgs e ) =>
                    {
                        DeleteNote( );

                        PrepareCreateNotes(  );
                    };

                    // if the refresh button isn't enabled, hide it
                    if ( App.Shared.Network.RockGeneralData.Instance.Data.DeveloperModeEnabled == false )
                    {
                        RefreshButton.Visibility = ViewStates.Gone;
                    }

                    // get our power management control
                    PowerManager pm = PowerManager.FromContext( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    WakeLock = pm.NewWakeLock(WakeLockFlags.Full, "Notes");

                    ResultView = new UIResultView( layout, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ), OnResultViewDone );

                    ResultView.Hide( );

                    // setup the tutorial overlay
                    TutorialBacker = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TutorialBacker.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                    TutorialBacker.Alpha = 0;
                    TutorialBacker.SetBackgroundColor( Android.Graphics.Color.Black );
                    layout.AddView( TutorialBacker );

                    AnimatingTutorial = false;
                    TutorialOverlay = new ImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TutorialOverlay.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ((RelativeLayout.LayoutParams)TutorialOverlay.LayoutParameters ).AddRule( LayoutRules.CenterInParent );
                    TutorialOverlay.Alpha = 0;
                    TutorialOverlay.SetBackgroundColor( Android.Graphics.Color.Transparent );
                    layout.AddView( TutorialOverlay );

                    NavBarRevealTracker = new NavBarReveal( );

                    return layout;
                }