Example #1
0
        private void InflateResolved()
        {
            try
            {
                var view = LayoutInflater.Inflate(Resource.Layout.ProblemSolvingResolvedItemLayout, null);

                if (view != null)
                {
                    var mainView = view.FindViewById <LinearLayout>(Resource.Id.linProblemSolvingStepsResolvedMain);
                    if (mainView != null)
                    {
                        mainView.SetBackgroundColor(Color.Argb(255, 113, 196, 228));
                    }
                    var solveText = view.FindViewById <TextView>(Resource.Id.txtProblemSolvingStepsResolvedText);
                    if (solveText != null)
                    {
                        solveText.SetBackgroundColor(Color.Argb(255, 113, 196, 228));
                    }

                    //view will be part of the header/footer, so apply that style
                    view.SetBackgroundColor(Color.Argb(255, 113, 196, 228));
                    var placeholder = FindViewById <LinearLayout>(Resource.Id.linProblemProsAndConsResolved);
                    if (placeholder != null)
                    {
                        placeholder.AddView(view);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error(TAG, "InflateResolved: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorProblemSolvingProConActivityInflate), "ProblemSolvingProsAndConsActivity.InflateResolved");
                }
            }
        }
Example #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            weakActivity = new WeakReference <DualityActivity>(this);

            CrashHandlerActivity.Register(this);

            Window.AddFlags(WindowManagerFlags.KeepScreenOn);

            try {
                View decorView = Window.DecorView;
                decorView.SystemUiVisibility |= (StatusBarVisibility)SystemUiFlags.LayoutStable;
                decorView.SystemUiVisibility |= (StatusBarVisibility)SystemUiFlags.LayoutFullscreen;
                decorView.SystemUiVisibility |= (StatusBarVisibility)SystemUiFlags.Immersive;

                // Minimal supported SDK is already 18
                //if ((int)Build.VERSION.SdkInt < 18)
                //    RequestedOrientation = ScreenOrientation.SensorLandscape;

                Window.ClearFlags(WindowManagerFlags.TranslucentStatus);
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);

                if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
                {
                    Window.SetStatusBarColor(Color.Argb(0x22, 0x00, 0x00, 0x00));
                }
            } catch /*(Exception ex)*/ {
#if DEBUG
                throw;
#endif
            }

            // Create our OpenGL view and show it
            InnerView = new InnerView(this);
            SetContentView(InnerView);
        }
Example #3
0
            private int rotateColor(int color, float rad)
            {
                float deg = rad * 180 / (float)Math.PI;
                int   r   = Color.GetRedComponent(color);
                int   g   = Color.GetGreenComponent(color);
                int   b   = Color.GetBlueComponent(color);

                ColorMatrix cm  = new ColorMatrix();
                ColorMatrix tmp = new ColorMatrix();

                cm.SetRGB2YUV();
                tmp.SetRotate(0, deg);
                cm.PostConcat(tmp);
                tmp.SetYUV2RGB();
                cm.PostConcat(tmp);

                float[] a = cm.GetArray();

                int ir = floatToByte(a[0] * r + a[1] * g + a[2] * b);
                int ig = floatToByte(a[5] * r + a[6] * g + a[7] * b);
                int ib = floatToByte(a[10] * r + a[11] * g + a[12] * b);

                return(Color.Argb(Color.GetAlphaComponent(color), pinToByte(ir), pinToByte(ig), pinToByte(ib)));
            }
        void AddPolyline1()
        {
            var existingPolyline = mMapView.FindPolylineByTag(1000);

            if (existingPolyline != null)
            {
                mMapView.RemovePolyline(existingPolyline);
            }

            var polyline1 = new MapPolyline();

            polyline1.Tag       = 1000;
            polyline1.LineColor = Color.Argb(128, 255, 51, 0);
            polyline1.AddPoint(MapPoint.MapPointWithGeoCoord(37.537229, 127.005515));
            polyline1.AddPoint(MapPoint.MapPointWithGeoCoord(37.545024, 127.03923));
            polyline1.AddPoint(MapPoint.MapPointWithGeoCoord(37.527896, 127.036245));
            polyline1.AddPoint(MapPoint.MapPointWithGeoCoord(37.541889, 127.095388));
            mMapView.AddPolyline(polyline1);

            var mapPointBounds = new MapPointBounds(polyline1.GetMapPoints());
            int padding        = 100; // px

            mMapView.MoveCamera(CameraUpdateFactory.NewMapPointBounds(mapPointBounds, padding));
        }
Example #5
0
        public Task <BrowserResult> InvokeAsync(string url)
        {
            if (string.IsNullOrWhiteSpace(url))
            {
                throw new ArgumentException("Missing url", nameof(url));
            }

            // Use a TCS to set the task result after the intent finishes
            var tcs = new TaskCompletionSource <BrowserResult>();

            customTabs = new CustomTabsActivityManager(activity);
            var builder = new CustomTabsIntent.Builder(customTabs.Session)
                          .SetToolbarColor(Color.Argb(255, 52, 152, 219))
                          .SetShowTitle(true)
                          .EnableUrlBarHiding();

            var customTabsIntent = builder.Build();

            // Ensure the intent is not kept in the history stack, which ensures navigating away will close it
            customTabsIntent.Intent.AddFlags(ActivityFlags.NoHistory);

            MainActivity.CustomUrlSchemeCallbackHandler = (response) =>
            {
                activity.StartActivity(typeof(MainActivity));

                tcs.SetResult(new BrowserResult
                {
                    Response   = response,
                    ResultType = BrowserResultType.Success
                });
            };

            customTabsIntent.LaunchUrl(activity, Android.Net.Uri.Parse(url));

            return(tcs.Task);
        }
Example #6
0
        public static Player Default(long accountId, long characterId, int mapId, string name = "Default")
        {
            PlayerStats stats = PlayerStats.Default();

            stats.Hp         = new PlayerStat(1000, 0, 1000);
            stats.CurrentHp  = new PlayerStat(0, 1000, 0);
            stats.Spirit     = new PlayerStat(100, 100, 100);
            stats.Stamina    = new PlayerStat(120, 120, 120);
            stats.AtkSpd     = new PlayerStat(120, 100, 130);
            stats.MoveSpd    = new PlayerStat(110, 100, 150);
            stats.JumpHeight = new PlayerStat(110, 100, 130);

            return(new Player
            {
                MapId = mapId,//2000062,
                AccountId = accountId,
                CharacterId = characterId,
                Level = 80,
                Name = name,
                Gender = 1,
                Motto = "Motto",
                HomeName = "HomeName",
                Coord = CoordF.From(2850, 2550, 1800),
                JobGroupId = 50,
                SkinColor = new SkinColor()
                {
                    Primary = Color.Argb(0xFF, 0xEA, 0xBF, 0xAE)
                },
                CreationTime = DateTimeOffset.Now.ToUnixTimeSeconds(),
                Equip = new Dictionary <EquipSlot, Item> {
                },
                Stats = stats,
                GameOptions = new GameOptions(),
                Mesos = 10,
            });
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.AppIntro);
            DinamikStatusBarColor dinamikStatusBarColor = new DinamikStatusBarColor();

            dinamikStatusBarColor.Pembe(this);
            Transformiew = FindViewById <RelativeLayout>(Resource.Id.rootview);
            viewpager    = FindViewById <ViewPager>(Resource.Id.viewPager1);
            viepageratama();
            _indicator = FindViewById <CirclePageIndicator>(Resource.Id.circlePageIndicator1);
            _indicator.SetViewPager(viewpager);
            ((CirclePageIndicator)_indicator).Snap = true;
            var density = Resources.DisplayMetrics.Density;

            //((CirclePageIndicator)_indicator).SetBackgroundColor(Color.Argb(255, 204, 204, 204));
            ((CirclePageIndicator)_indicator).Radius      = 5 * density;
            ((CirclePageIndicator)_indicator).PageColor   = Color.Argb(255, 255, 255, 255);
            ((CirclePageIndicator)_indicator).FillColor   = Color.Transparent;
            ((CirclePageIndicator)_indicator).StrokeColor = Color.White;
            ((CirclePageIndicator)_indicator).StrokeWidth = 2f;

            //BaslangicIslemleri();
        }
Example #8
0
        private void PolygonDemo(HuaweiMap hMap)
        {
            hMap.Clear();

            Polygon        polygon1;
            PolygonOptions polygon1Options = new PolygonOptions()
                                             .Add(new LatLng(41.01929, 28.967267), new LatLng(41.016785, 28.986971), new LatLng(41.014623, 28.999753), new LatLng(41.001917, 28.978743), new LatLng(41.002298, 28.954132));

            polygon1Options.InvokeFillColor(Color.Argb(60, 255, 200, 0));
            polygon1Options.InvokeStrokeColor(Color.Yellow);
            polygon1Options.InvokeStrokeWidth(30);
            polygon1Options.Clickable(true);
            polygon1Options.InvokeZIndex(2);
            polygon1 = hMap.AddPolygon(polygon1Options);

            Polygon        polygon2;
            PolygonOptions polygon2Options = new PolygonOptions()
                                             .Add(new LatLng(41.035243, 29.026812), new LatLng(41.022122, 29.00653), new LatLng(41.00415, 29.012449), new LatLng(41.001699, 28.978743), new LatLng(41.017384, 28.986827), new LatLng(41.037711, 28.996791));

            polygon2Options.InvokeFillColor(Color.Argb(60, 0, 0, 255));
            polygon2Options.InvokeStrokeColor(Color.Blue);
            polygon2Options.Clickable(true);
            polygon2 = hMap.AddPolygon(polygon2Options);
        }
Example #9
0
        private View CreateView()
        {
            FrameLayout parent = new FrameLayout(Activity);

            parent.LayoutParameters = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent,
                                                                   FrameLayout.LayoutParams.MatchParent);
            viewBg = new View(Activity);
            viewBg.LayoutParameters = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent,
                                                                   FrameLayout.LayoutParams.MatchParent);
            viewBg.SetBackgroundColor(Color.Argb(136, 0, 0, 0));
            viewBg.Id = ActionSheet.BG_VIEW_ID;
            viewBg.SetOnClickListener(this);

            panel = new LinearLayout(Activity);
            FrameLayout.LayoutParams layoutParams =
                new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.WrapContent);
            layoutParams.Gravity   = GravityFlags.Bottom;
            panel.LayoutParameters = layoutParams;
            panel.Orientation      = AWD_O.Vertical;
            parent.SetPadding(0, 0, 0, GetNavBarHeight(Activity));
            parent.AddView(viewBg);
            parent.AddView(panel);
            return(parent);
        }
Example #10
0
        protected virtual void DrawOnCanvas(Canvas canvas, RectF rect)
        {
            var rectHeight = rect.Height();
            var rectWidth  = rect.Width();
            var paint      = new Paint();
            var scale      = Math.Min(1, rectWidth / Width);

            // draw background
            paint.Color = _options.BackgroundColor;
            canvas.DrawRect(rect, paint);

            // draw Text
            paint.Color     = Color.Argb((int)(255 * scale), 255, 255, 255);
            paint.TextSize  = _options.TextSize * scale;
            paint.TextAlign = Paint.Align.Left;

            var textRect = new Rect();

            paint.GetTextBounds(_text, 0, _text.Length, textRect);
            float x = rectWidth / 2f - textRect.Width() / 2f - textRect.Left;
            float y = rectHeight / 2f + textRect.Height() / 2f - textRect.Bottom;

            canvas.DrawText(_text, rect.Left + x, rect.Top + y, paint);
        }
Example #11
0
        private void BtnNE_Click(object sender, System.EventArgs e, Button btnNE, string Username, bool LoginCheck, int mUserID)
        {
            btnNE.SetBackgroundColor(Color.Argb(255, 175, 83, 42));
            btn_selected = "Noord Europa";
            if (btn_selected != "")
            {
                Intent nextActivity = new Intent(this, typeof(LandenActivity));
                nextActivity.PutExtra("DeelEuropa", btn_selected);
                nextActivity.PutExtra("mUserID", mUserID);
                nextActivity.PutExtra("Username", Username);

                if (LoginCheck == true)
                {
                    nextActivity.PutExtra("LoginCheck", true);
                }
                else
                {
                    nextActivity.PutExtra("LoginCheck", false);
                }

                StartActivity(nextActivity);
                btn_reset();
            }
        }
Example #12
0
        /// <summary>
        /// This method updates the sample layout; including creating new map with default themes.
        /// </summary>
        public void UpdateSampleLayout()
        {
            try
            {
                FrameLayout mapContainerView = sampleView.FindViewById <FrameLayout>(Resource.Id.MapContainerView);
                mapContainerView.RemoveAllViews();

                mapView              = new MapView(Application.Context);
                mapView.MapUnit      = GeographyUnit.Meter;
                mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet();
                mapView.SetBackgroundColor(Color.Argb(255, 244, 242, 238));
                mapContainerView.AddView(mapView);

                InitializeBackgroundMap();
                InitializeMap();
            }
            catch (Exception ex)
            {
                Log.Debug("Sample Changed", ex.Message);
            }

            // Customize the sample layout with specific sample.
            UpdateSampleLayoutCore();
        }
Example #13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.simple_titles);

            _adapter = new TestFragmentAdapter(SupportFragmentManager);

            _pager         = FindViewById <ViewPager>(Resource.Id.pager);
            _pager.Adapter = _adapter;

            var density   = Resources.DisplayMetrics.Density;
            var indicator = FindViewById <TitlePageIndicator>(Resource.Id.indicator);

            indicator.SetViewPager(_pager);
            indicator.SetBackgroundColor(Color.Argb(0x18, 0xFF, 0x00, 0x00));
            indicator.FooterColor           = Color.Argb(0xFF, 0xAA, 0x22, 0x22);
            indicator.FooterLineHeight      = 1 * density;
            indicator.FooterIndicatorHeight = 3 * density;
            indicator.FooterIndicatorStyle  = TitlePageIndicator.IndicatorStyle.Underline;
            indicator.TextColor             = Color.Argb(0xAA, 0xFF, 0xFF, 0xFF);
            indicator.SelectedColor         = Color.Argb(0xFF, 0xFF, 0xFF, 0xFF);
            indicator.IsSelectedBold        = true;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            _cloudService.Connect();

            SetContentView(Resource.Layout.Snake);

            _handlerThread = new HandlerThread("background");
            _handlerThread.Start();
            _handler = new Handler(_handlerThread.Looper);

            _paints[PositionState.Empty] = new Paint {
                Color = Color.Argb(50, 255, 255, 255)
            };
            _paints[PositionState.Snake] = new Paint {
                Color = Color.Argb(255, 0, 100, 0)
            };
            _paints[PositionState.Food] = new Paint {
                Color = Color.Argb(100, 255, 255, 0)
            };

            _joystickInputDriver = new JoystickInputDriver(new[] { Keycode.Button10, Keycode.Button11, Keycode.Button12, Keycode.Button13, Keycode.Button14 });
        }
Example #15
0
        private void SetupEvents()
        {
            BrushSize.ProgressChanged += delegate
            {
                strokeWidth = BrushSize.Progress;
                dv.UpdateStrokeWidth(strokeWidth);
                WidthText.Text = $"Width: {strokeWidth.ToString()}";
            };

            //add transparency in the drawing
            Highlight.CheckedChange += (t, f) =>
            {
                if (f.IsChecked)
                {
                    WidgetHelper.mPaint.Color = Color.Argb(126, WidgetHelper.mPaint.Color.R, WidgetHelper.mPaint.Color.G, WidgetHelper.mPaint.Color.B);
                }
                else
                {
                    WidgetHelper.mPaint.Color = Color.Argb(255, WidgetHelper.mPaint.Color.R, WidgetHelper.mPaint.Color.G, WidgetHelper.mPaint.Color.B);
                }

                IsHighlighted = f.IsChecked;
            };
        }
Example #16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.simple_circles);

            _adapter = new TestFragmentAdapter(SupportFragmentManager);

            _pager         = FindViewById <ViewPager>(Resource.Id.pager);
            _pager.Adapter = _adapter;

            _indicator = FindViewById <CirclePageIndicator>(Resource.Id.indicator);
            _indicator.SetViewPager(_pager);

            var density   = Resources.DisplayMetrics.Density;
            var indicator = (CirclePageIndicator)_indicator;

            indicator.SetBackgroundColor(Color.Argb(255, 204, 204, 204));
            indicator.Radius      = 10 * density;
            indicator.PageColor   = Color.Argb(136, 0, 0, 255);
            indicator.FillColor   = Color.Argb(255, 136, 136, 136);
            indicator.StrokeColor = Color.Argb(255, 0, 0, 0);
            indicator.StrokeWidth = 2 * density;
        }
        public void AddItem(long time, double latitude, double longitude)
        {
            LatLng       location = new LatLng(latitude, longitude);
            LocationItem item     = new LocationItem();

            item.time      = time;
            item.latitude  = latitude;
            item.longitude = longitude;
            item.inApp     = true;

            if (selectedPos == 0 && locationList.Count > 0)
            {
                item.isSelected = true;
                locationList[selectedPos].isSelected = false;
                AddCircle(location);
                MoveMap(location, false);
            }
            else if (locationList.Count == 0)
            {
                item.isSelected = true;
                AddCircle(location);
                MoveMap(location, true);
            }
            else
            {
                item.isSelected = false;
                selectedPos++;
            }

            locationList.Insert(0, item);
            adapter.NotifyDataSetChanged();

            if (locationList.Count >= 2)
            {
                AddLine(location, new LatLng(locationList[1].latitude, locationList[1].longitude), Color.Argb(255, 0, 255, 0));
            }
        }
Example #18
0
        public static void Flash(Color color)
        {
            var c = Color.Argb(0xFF, 0x00, 0x00, 0x00) | color;

            Scene.FadeIn(new Color(c), true);
        }
Example #19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_zones);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = GetString(Resource.String.zones);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            // initializing widget
            mChart           = this.FindViewById <FlexChart>(Resource.Id.zonesFlexchart);
            mChart.BindingX  = "Number";
            mChart.ChartType = ChartType.Scatter;

            int            nStudents  = 20;
            int            nMaxPoints = 100;
            IList <object> data       = ZonesData.getZonesList(nStudents, nMaxPoints);

            mChart.ItemsSource = data;

            mChart.Tapped     += MChart_Tapped;
            mChart.AxisX.Title = "student number";
            mChart.AxisY.Title = "student accumulated points";

            double        mean   = this.FindMean(data);
            double        stdDev = this.FindStdDev(data, mean);
            List <double> scores = new List <double>();

            foreach (ZonesData item in data)
            {
                scores.Add(item.Score);
            }
            scores.Sort((x, y) => y.CompareTo(x));

            var zones = new double[]
            {
                scores[this.GetBoundingIndex(scores, 0.85)],
                scores[this.GetBoundingIndex(scores, 0.75)],
                scores[this.GetBoundingIndex(scores, 0.25)],
                scores[this.GetBoundingIndex(scores, 0.05)]
            };

            Integer[] colors = new Integer[]
            {
                new Integer(Color.Argb(255, 255, 192, 192)),
                new Integer(Color.Argb(255, 55, 228, 228)),
                new Integer(Color.Argb(255, 255, 228, 128)),
                new Integer(Color.Argb(255, 128, 255, 128)),
                new Integer(Color.Argb(255, 128, 128, 255)),
            };
            for (var i = 4; i >= 0; i--)
            {
                float    y     = (float)(i == 4 ? mean + 2 * stdDev : zones[i]);
                PointF[] sdata = new PointF[data.Count];

                for (int j = 0; j < data.Count; j++)
                {
                    sdata[j] = new PointF(j, y);
                    if (i == 0)
                    {
                        System.Console.WriteLine(j + "=" + y);
                    }
                }

                string seriesName = ((char)((short)'A' + 4 - i)).ToString();

                var series = new ChartSeries();
                series.Chart      = mChart;
                series.SeriesName = seriesName;
                series.Binding    = "Y";

                series.ItemsSource = sdata;
                series.BindingX    = "X";
                series.ChartType   = ChartType.Area;
                series.Style       = new ChartStyle();
                series.Style.Fill  = new Color(colors[i].IntValue());

                mChart.Series.Add(series);
            }

            ChartSeries scoreSeries = new ChartSeries();

            scoreSeries.Chart      = mChart;
            scoreSeries.SeriesName = "raw score";
            scoreSeries.Binding    = "Score";
            scoreSeries.BindingX   = "Number";
            mChart.Series.Add(scoreSeries);

            for (var i = -2; i <= 2; i++)
            {
                var    y          = mean + i * stdDev;
                string seriesName = string.Empty;
                if (i > 0)
                {
                    seriesName = "m+" + i + "s";
                }
                else if (i < 0)
                {
                    seriesName = "m" + i + "s";
                }
                else
                {
                    seriesName = "mean";
                }
                PointF[] sdata = new PointF[data.Count];
                for (int j = 0; j < data.Count; j++)
                {
                    sdata[j] = new PointF(j, (float)y);
                }
                var series = new ChartSeries();
                series.Chart      = mChart;
                series.SeriesName = seriesName;
                series.Binding    = "Y";

                series.ItemsSource           = sdata;
                series.BindingX              = "X";
                series.ChartType             = ChartType.Line;
                series.Style                 = new ChartStyle();
                series.Style.StrokeThickness = 2;

                series.Style.Stroke = Color.Rgb(0x20, 0x20, 0x20);

                mChart.Series.Add(series);
            }
        }
Example #20
0
 /**
  * Set the alpha value of the {@code color} to be the given {@code alpha} value.
  */
 private static int SetColorAlpha(int color, byte Alpha)
 {
     return(Color.Argb(Alpha, Color.Red, Color.Green, Color.Blue));
 }
Example #21
0
        private void SamplePageContent(Context con)
        {
            /*************
            **Adj Label**
            *************/
            adjLabel           = new TextView(con);
            adjLabel7          = new TextView(con);
            adjLabel8          = new TextView(con);
            adjLabel9          = new TextView(con);
            adjLabel9.Text     = "";
            adjLabel.Typeface  = Typeface.Create("Roboto", TypefaceStyle.Normal);
            adjLabel9.TextSize = 20;
            adjLabel9.Gravity  = GravityFlags.Center;
            adjLabel9.SetTextColor(Color.Argb(255, 182, 182, 182));
            adjLabel10 = new TextView(con);

            //hertzLabel
            hertzLabel          = new TextView(con);
            hertzLabel.Text     = "60HZ";
            hertzLabel.TextSize = 20;
            hertzLabel.SetTextColor(Color.Black);
            hertzLabel.Gravity  = GravityFlags.Center;
            hertzLabel.Typeface = Typeface.Create("Helvetica", TypefaceStyle.Normal);

            //decibelLabel
            decibelLabel          = new TextView(con);
            decibelLabel.TextSize = 14;
            decibelLabel.SetTextColor(Color.Argb(255, 50, 180, 228));
            decibelLabel.Text     = "6.0db";
            decibelLabel.Typeface = Typeface.Create("Helvetica", TypefaceStyle.Normal);
            decibelLabel.Gravity  = GravityFlags.Center;

            //hertzLabel1
            hertzLabel1          = new TextView(con);
            hertzLabel1.Text     = "170HZ";
            hertzLabel1.TextSize = 20;
            hertzLabel1.SetTextColor(Color.Black);
            hertzLabel1.Gravity  = GravityFlags.Center;
            hertzLabel1.Typeface = Typeface.Create("Helvetica", TypefaceStyle.Normal);

            //decibelLabel1
            decibelLabel1          = new TextView(con);
            decibelLabel1.TextSize = 14;
            decibelLabel1.SetTextColor(Color.Argb(255, 50, 180, 228));
            decibelLabel1.Text     = "-3.0db";
            decibelLabel1.Typeface = Typeface.Create("Helvetica", TypefaceStyle.Normal);
            decibelLabel1.Gravity  = GravityFlags.Center;

            //hertzLabel2
            hertzLabel2          = new TextView(con);
            hertzLabel2.Text     = "310HZ";
            hertzLabel2.TextSize = 20;
            hertzLabel2.SetTextColor(Color.Black);
            hertzLabel2.Gravity  = GravityFlags.Center;
            hertzLabel2.Typeface = Typeface.Create("Helvetica", TypefaceStyle.Normal);

            //decibelLabel2
            decibelLabel2          = new TextView(con);
            decibelLabel2.TextSize = 14;
            decibelLabel2.SetTextColor(Color.Argb(255, 50, 180, 228));
            decibelLabel2.Text     = "12.0db";
            decibelLabel2.Typeface = Typeface.Create("Helvetica", TypefaceStyle.Normal);
            decibelLabel2.Gravity  = GravityFlags.Center;
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            try
            {
                if (convertView == null)
                {
                    if (_activity != null)
                    {
                        convertView = _activity.LayoutInflater.Inflate(Resource.Layout.MoodsAdjustListItem, parent, false);
                    }
                    else if (parent != null)
                    {
                        LayoutInflater inflater = (LayoutInflater)parent.Context.GetSystemService(Context.LayoutInflaterService);
                        convertView = inflater.Inflate(Resource.Layout.MoodsAdjustListItem, parent, false);
                    }
                    else
                    {
                        return(convertView);
                    }
                }

                if (convertView != null)
                {
                    GetFieldComponents(convertView);

                    if (_moodText != null)
                    {
                        _moodText.Text = _moods[position].MoodName.Trim();
                    }
                    if (_moodDefault != null)
                    {
                        _moodDefault.Text = (_moods[position].IsDefault == "true") ? _activity.GetString(Resource.String.wordDefault) : "";
                    }
                    if (position == ((MoodsAdjustActivity)_activity).GetSelectedItemIndex())
                    {
                        convertView.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                        if (_moodText != null)
                        {
                            _moodText.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                        }
                        if (_moodDefault != null)
                        {
                            _moodDefault.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                        }
                    }
                    else
                    {
                        convertView.SetBackgroundDrawable(null);
                        if (_moodText != null)
                        {
                            _moodText.SetBackgroundDrawable(null);
                        }
                        if (_moodDefault != null)
                        {
                            _moodDefault.SetBackgroundDrawable(null);
                        }
                    }
                }
                else
                {
                    Log.Error(TAG, "GetView: view is NULL!");
                }
                return(convertView);
            }
            catch (System.Exception e)
            {
                Log.Error(TAG, "GetView: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(_activity, e, _activity.GetString(Resource.String.ErrorMoodsAdjustListGetView), "MoodsAdjustListAdapter.GetView");
                }
                return(null);
            }
        }
Example #23
0
 public AlphaPatternDrawable(int rectangleSize)
 {
     _rectangleSize    = rectangleSize;
     _paintWhite.Color = Color.Argb(255, 255, 255, 255);
     _paintGray.Color  = Color.Argb(255, 203, 203, 203);
 }
Example #24
0
        //set the view
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(Context).Inflate(Resource.Layout.ACFITable, null, false);
            }

            //retrieve the shared preferences to edit the row attributes such as text size, colour or if the the data has to be sorted by date
            ISharedPreferences getidpreferences = Application.Context.GetSharedPreferences("UserInformation", FileCreationMode.Private);
            string             UserID           = getidpreferences.GetString("LatestUserID", String.Empty);
            ISharedPreferences preferences      = Application.Context.GetSharedPreferences("UserInformation" + UserID, FileCreationMode.Private);
            int  textSize        = preferences.GetInt("TextSize", 1);
            bool NightSwitchMode = preferences.GetBoolean("NightSwitchMode", false);
            bool DateSwitchMode  = preferences.GetBoolean("DateSwitchMode", false);

            TextView txtResidentACFI       = row.FindViewById <TextView>(Resource.Id.txtResidentIDACFI);
            TextView txtScoreACFI          = row.FindViewById <TextView>(Resource.Id.txtScoreACFI);
            TextView txtIncomeACFI         = row.FindViewById <TextView>(Resource.Id.txtIncomeACFI);
            TextView txtExpirationDateACFI = row.FindViewById <TextView>(Resource.Id.txtExpirationDateACFI);

            switch (textSize)
            {
            case 0:
                txtResidentACFI.TextSize       = 10;
                txtScoreACFI.TextSize          = 10;
                txtIncomeACFI.TextSize         = 10;
                txtExpirationDateACFI.TextSize = 10;
                break;

            case 1:
                txtResidentACFI.TextSize       = 15;
                txtScoreACFI.TextSize          = 15;
                txtIncomeACFI.TextSize         = 15;
                txtExpirationDateACFI.TextSize = 15;
                break;

            case 2:
                txtResidentACFI.TextSize       = 20;
                txtScoreACFI.TextSize          = 20;
                txtIncomeACFI.TextSize         = 20;
                txtExpirationDateACFI.TextSize = 20;
                break;
            }

            if (NightSwitchMode)
            {
                txtResidentACFI.SetTextColor(Color.White);
                txtScoreACFI.SetTextColor(Color.White);
                txtIncomeACFI.SetTextColor(Color.White);
                txtExpirationDateACFI.SetTextColor(Color.White);
            }
            else
            {
                txtResidentACFI.SetTextColor(Color.Black);
                txtScoreACFI.SetTextColor(Color.Black);
                txtIncomeACFI.SetTextColor(Color.Black);
                txtExpirationDateACFI.SetTextColor(Color.Black);
            }
            //for every item
            txtResidentACFI.Text       = Items[position].GetResidentID().ToString();
            txtScoreACFI.Text          = Items[position].GetACFIScore().ToString();
            txtIncomeACFI.Text         = "$ " + Items[position].GetIncome().ToString("#,#", CultureInfo.InvariantCulture);
            txtExpirationDateACFI.Text = Items[position].GetExpirationDate().ToShortDateString();
            //set indicator colours
            if (Items[position].IsGreen())
            {
                if (NightSwitchMode)
                {
                    row.SetBackgroundColor(Color.DarkGreen);
                }
                else
                {
                    row.SetBackgroundColor(Color.LightGreen);
                }
            }
            else if (Items[position].IsRed())
            {
                if (NightSwitchMode)
                {
                    row.SetBackgroundColor(Color.DarkRed);
                }
                else
                {
                    row.SetBackgroundColor(Color.Argb(80, 255, 128, 128));
                }
            }
            else
            {
                if (NightSwitchMode)
                {
                    row.SetBackgroundColor(Color.DarkOrange);
                }
                else
                {
                    row.SetBackgroundColor(Color.LightYellow);
                }
            }

            return(row);
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            if (convertView == null)
            {
                if (_parent != null)
                {
                    convertView = ((Activity)_parent.GetContext()).LayoutInflater.Inflate(Resource.Layout.MedicationTimeListItem, parent, false);
                }
                else if (parent != null)
                {
                    LayoutInflater inflater = (LayoutInflater)parent.Context.GetSystemService(Context.LayoutInflaterService);
                    convertView = inflater.Inflate(Resource.Layout.MedicationTimeListItem, parent, false);
                }
                else
                {
                    return(convertView);
                }
            }

            if (convertView != null)
            {
                try
                {
                    GetFieldComponents(convertView);

                    if (_medicationTimeItems[position].MedicationTakeTime != null)
                    {
                        if (_timeDose != null)
                        {
                            _timeDose.Text = _medicationTimeItems[position].Dosage.ToString() + "mg";
                            Log.Info(TAG, "GetView: Time dose - " + _timeDose.Text);
                        }
                        else
                        {
                            Log.Error(TAG, "GetView: _timeDose is NULL!");
                        }
                        if (_timeOfDay != null)
                        {
                            _timeOfDay.Text = StringHelper.MedicationTimeForConstant(_medicationTimeItems[position].MedicationTakeTime.MedicationTime);
                            Log.Info(TAG, "GetView: Time of day - " + _timeOfDay.Text);
                        }
                        else
                        {
                            Log.Error(TAG, "GetView: _timeOfDay is NULL!");
                        }
                        if (_timeTakenText != null)
                        {
                            _timeTakenText.Text = _medicationTimeItems[position].MedicationTakeTime.TakenTime.ToShortTimeString();
                            Log.Info(TAG, "GetView: Time Taken - " + _timeTakenText.Text);
                        }
                        else
                        {
                            Log.Error(TAG, "GetView: _timeTakenText is NULL!");
                        }
                        if (_alarmNotify != null)
                        {
                            if (_medicationTimeItems[position].MedicationTakeReminder != null)
                            {
                                _alarmNotify.Visibility = ViewStates.Visible;
                            }
                            else
                            {
                                _alarmNotify.Visibility = ViewStates.Invisible;
                            }
                        }
                        if (position == _parent.GetSelectedTimeItemIndex())
                        {
                            convertView.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                            _timeDose.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                            _timeOfDay.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                            _timeTakenText.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                            _itemAt1.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                            _itemAt2.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                            _medicationSpread.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                            _doseAndFood.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                            _alarmNotify.SetBackgroundColor(Color.Argb(255, 19, 75, 127));
                        }
                        else
                        {
                            convertView.SetBackgroundDrawable(null);
                            _timeDose.SetBackgroundDrawable(null);
                            _timeOfDay.SetBackgroundDrawable(null);
                            _timeTakenText.SetBackgroundDrawable(null);
                            _itemAt1.SetBackgroundDrawable(null);
                            _itemAt2.SetBackgroundDrawable(null);
                            _medicationSpread.SetBackgroundDrawable(null);
                            _doseAndFood.SetBackgroundDrawable(null);
                            _alarmNotify.SetBackgroundDrawable(null);
                        }
                    }
                }
                catch (Exception e)
                {
                    Log.Error(TAG, "GetView: Exception - " + e.Message);
                    if (GlobalData.ShowErrorDialog)
                    {
                        ErrorDisplay.ShowErrorAlert((Activity)_parent.GetContext(), e, ((Activity)_parent.GetContext()).GetString(Resource.String.ErrorMedListAdapterGetView), "MedicationTimeListAdapter.GetView");
                    }
                }
            }
            else
            {
                Log.Error(TAG, "GetView: View is NULL!");
            }
            return(convertView);
        }
Example #26
0
        private void Init(Context context, IAttributeSet attrs)
        {
            var   thumbNormal   = Resource.Drawable.seek_thumb_normal;
            var   thumbPressed  = Resource.Drawable.seek_thumb_pressed;
            var   thumbDisabled = Resource.Drawable.seek_thumb_disabled;
            Color thumbShadowColor;
            var   defaultShadowColor   = Color.Argb(75, 0, 0, 0);
            var   defaultShadowYOffset = PixelUtil.DpToPx(context, 2);
            var   defaultShadowXOffset = PixelUtil.DpToPx(context, 0);
            var   defaultShadowBlur    = PixelUtil.DpToPx(context, 2);

            _distanceToTop = PixelUtil.DpToPx(context, DefaultTextDistanceToTopInDp);

            if (attrs == null)
            {
                SetRangeToDefaultValues();
                _internalPad            = PixelUtil.DpToPx(context, InitialPaddingInDp);
                _barHeight              = PixelUtil.DpToPx(context, LineHeightInDp);
                ActiveColor             = DefaultActiveColor;
                DefaultColor            = Color.Gray;
                AlwaysActive            = false;
                ShowTextAboveThumbs     = true;
                TextAboveThumbsColor    = Color.White;
                thumbShadowColor        = defaultShadowColor;
                ThumbShadowXOffset      = defaultShadowXOffset;
                ThumbShadowYOffset      = defaultShadowYOffset;
                _thumbShadowBlur        = defaultShadowBlur;
                ActivateOnDefaultValues = false;
                TextSizeInSp            = DefaultTextSizeInSp;
            }
            else
            {
                var a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.RangeSliderControl, 0, 0);
                try
                {
                    SetRangeValues(ExtractNumericValueFromAttributes(a, Resource.Styleable.RangeSliderControl_absoluteMinValue, DefaultMinimum),
                                   ExtractNumericValueFromAttributes(a, Resource.Styleable.RangeSliderControl_absoluteMaxValue, DefaultMaximum));
                    ShowTextAboveThumbs  = a.GetBoolean(Resource.Styleable.RangeSliderControl_valuesAboveThumbs, true);
                    TextAboveThumbsColor = a.GetColor(Resource.Styleable.RangeSliderControl_textAboveThumbsColor, Color.White);
                    MinThumbHidden       = a.GetBoolean(Resource.Styleable.RangeSliderControl_minThumbHidden, false);
                    MaxThumbHidden       = a.GetBoolean(Resource.Styleable.RangeSliderControl_maxThumbHidden, false);
                    ShowLabels           = a.GetBoolean(Resource.Styleable.RangeSliderControl_showRangeLabels, true);
                    _internalPad         = a.GetDimensionPixelSize(Resource.Styleable.RangeSliderControl_internalPadding, InitialPaddingInDp);
                    _barHeight           = a.GetDimensionPixelSize(Resource.Styleable.RangeSliderControl_barHeight, LineHeightInDp);
                    ActiveColor          = a.GetColor(Resource.Styleable.RangeSliderControl_activeColor, DefaultActiveColor);
                    DefaultColor         = a.GetColor(Resource.Styleable.RangeSliderControl_defaultColor, Color.Gray);
                    AlwaysActive         = a.GetBoolean(Resource.Styleable.RangeSliderControl_alwaysActive, false);
                    StepValue            = ExtractNumericValueFromAttributes(a,
                                                                             Resource.Styleable.RangeSliderControl_stepValue, DefaultStepValue);
                    StepValueContinuously = a.GetBoolean(Resource.Styleable.RangeSliderControl_stepValueContinuously,
                                                         false);

                    var normalDrawable = a.GetDrawable(Resource.Styleable.RangeSliderControl_thumbNormal);
                    if (normalDrawable != null)
                    {
                        ThumbImage = BitmapUtil.DrawableToBitmap(normalDrawable);
                    }
                    var disabledDrawable = a.GetDrawable(Resource.Styleable.RangeSliderControl_thumbDisabled);
                    if (disabledDrawable != null)
                    {
                        ThumbDisabledImage = BitmapUtil.DrawableToBitmap(disabledDrawable);
                    }
                    var pressedDrawable = a.GetDrawable(Resource.Styleable.RangeSliderControl_thumbPressed);
                    if (pressedDrawable != null)
                    {
                        ThumbPressedImage = BitmapUtil.DrawableToBitmap(pressedDrawable);
                    }
                    ThumbShadow        = a.GetBoolean(Resource.Styleable.RangeSliderControl_thumbShadow, false);
                    thumbShadowColor   = a.GetColor(Resource.Styleable.RangeSliderControl_thumbShadowColor, defaultShadowColor);
                    ThumbShadowXOffset = a.GetDimensionPixelSize(Resource.Styleable.RangeSliderControl_thumbShadowXOffset, defaultShadowXOffset);
                    ThumbShadowYOffset = a.GetDimensionPixelSize(Resource.Styleable.RangeSliderControl_thumbShadowYOffset, defaultShadowYOffset);
                    _thumbShadowBlur   = a.GetDimensionPixelSize(Resource.Styleable.RangeSliderControl_thumbShadowBlur, defaultShadowBlur);

                    ActivateOnDefaultValues = a.GetBoolean(Resource.Styleable.RangeSliderControl_activateOnDefaultValues, false);
                    TextSizeInSp            = a.GetInt(Resource.Styleable.RangeSliderControl_textSize, DefaultTextSizeInSp);
                }
                finally
                {
                    a.Recycle();
                }
            }

            if (ThumbImage == null)
            {
                ThumbImage = BitmapFactory.DecodeResource(Resources, thumbNormal);
            }
            if (ThumbPressedImage == null)
            {
                ThumbPressedImage = BitmapFactory.DecodeResource(Resources, thumbPressed);
            }
            if (ThumbDisabledImage == null)
            {
                ThumbDisabledImage = BitmapFactory.DecodeResource(Resources, thumbDisabled);
            }

            _thumbHalfWidth  = 0.5f * ThumbImage.Width;
            _thumbHalfHeight = 0.5f * ThumbImage.Height;

            SetBarHeight(_barHeight);

            // make RangeSliderControl focusable. This solves focus handling issues in case EditText widgets are being used along with the RangeSliderControl within ScrollViews.
            Focusable            = true;
            FocusableInTouchMode = true;
            _scaledTouchSlop     = ViewConfiguration.Get(Context).ScaledTouchSlop;

            if (ThumbShadow)
            {
                // We need to remove hardware acceleration in order to blur the shadow
                SetLayerType(LayerType.Software, null);
                _shadowPaint.Color = thumbShadowColor;
                _shadowPaint.SetMaskFilter(new BlurMaskFilter(_thumbShadowBlur, BlurMaskFilter.Blur.Normal));
                _thumbShadowPath = new Path();
                _thumbShadowPath.AddCircle(0, 0, _thumbHalfHeight, Path.Direction.Cw);
            }
        }
Example #27
0
        public void OnGenerated(Palette palette)
        {
            if (MainActivity.instance == null || IsDetached)
            {
                return;
            }

            List <Palette.Swatch> swatches = palette.Swatches.OrderBy(x => x.Population).ToList();
            int i = swatches.Count - 1;

            Palette.Swatch swatch = palette.MutedSwatch;

            if (swatch == null && swatches.Count == 0)
            {
                return;
            }

            while (swatch == null)
            {
                swatch = swatches[i];
                i--;

                if (i == -1 && swatch == null)
                {
                    return;
                }
            }

            Palette.Swatch accent = null;
            if (IsColorDark(swatch.Rgb))
            {
                accent = palette.LightVibrantSwatch;

                if (accent == null)
                {
                    accent = palette.LightMutedSwatch;
                }

                if (accent == null)
                {
                    accent = swatch;
                }
            }
            else
            {
                accent = palette.DarkVibrantSwatch;

                if (accent == null)
                {
                    accent = palette.DarkMutedSwatch;
                }

                if (accent == null)
                {
                    accent = swatch;
                }
            }

            Color text        = Color.Argb(Color.GetAlphaComponent(swatch.BodyTextColor), Color.GetRedComponent(swatch.BodyTextColor), Color.GetGreenComponent(swatch.BodyTextColor), Color.GetBlueComponent(swatch.BodyTextColor));
            Color background  = Color.Argb(Color.GetAlphaComponent(swatch.Rgb), Color.GetRedComponent(swatch.Rgb), Color.GetGreenComponent(swatch.Rgb), Color.GetBlueComponent(swatch.Rgb));
            Color accentColor = Color.Argb(Color.GetAlphaComponent(accent.Rgb), Color.GetRedComponent(accent.Rgb), Color.GetGreenComponent(accent.Rgb), Color.GetBlueComponent(accent.Rgb));

            MainActivity.instance.FindViewById <TextView>(Resource.Id.spTitle).SetTextColor(text);
            MainActivity.instance.FindViewById <TextView>(Resource.Id.spArtist).SetTextColor(text);

            //Reveal for the smallPlayer
            if (prepared)
            {
                View spReveal = MainActivity.instance.FindViewById <View>(Resource.Id.spReveal);
                if (spReveal != null && spReveal.IsAttachedToWindow)
                {
                    Animator spAnim = ViewAnimationUtils.CreateCircularReveal(spReveal, playNext == false ? spReveal.Width : 0, spReveal.Height / 2, 0, spReveal.Width);
                    spAnim.AnimationStart += (sender, e) => { spReveal.SetBackgroundColor(background); };
                    spAnim.AnimationEnd   += (sender, e) => { MainActivity.instance.FindViewById(Resource.Id.playersHolder).SetBackgroundColor(background); };
                    spAnim.SetDuration(500);
                    spAnim.StartDelay = 10;
                    spAnim.Start();
                }
            }
            else
            {
                prepared = true;
                MainActivity.instance.FindViewById(Resource.Id.playersHolder).SetBackgroundColor(background);
            }
            playNext = null;

            if (bar == null)
            {
                bar = MainActivity.instance.FindViewById <SeekBar>(Resource.Id.songTimer);
            }

            if (spBar == null)
            {
                spBar = MainActivity.instance.FindViewById <ProgressBar>(Resource.Id.spProgress);
            }

            bar.ProgressTintList             = ColorStateList.ValueOf(accentColor);
            bar.ThumbTintList                = ColorStateList.ValueOf(accentColor);
            bar.ProgressBackgroundTintList   = ColorStateList.ValueOf(Color.Argb(87, accentColor.R, accentColor.G, accentColor.B));
            spBar.ProgressTintList           = ColorStateList.ValueOf(accentColor);
            spBar.ProgressBackgroundTintList = ColorStateList.ValueOf(Color.Argb(87, accentColor.R, accentColor.G, accentColor.B));

            if (IsColorDark(accent.Rgb))
            {
                MainActivity.instance.FindViewById <ImageButton>(Resource.Id.spNext).ImageTintList           = ColorStateList.ValueOf(Color.White);
                MainActivity.instance.FindViewById <ImageButton>(Resource.Id.spPlay).ImageTintList           = ColorStateList.ValueOf(Color.White);
                MainActivity.instance.FindViewById <ImageButton>(Resource.Id.spLast).ImageTintList           = ColorStateList.ValueOf(Color.White);
                MainActivity.instance.FindViewById <ProgressBar>(Resource.Id.spBuffer).IndeterminateTintList = ColorStateList.ValueOf(Color.White);
            }
            else
            {
                MainActivity.instance.FindViewById <ImageButton>(Resource.Id.spNext).ImageTintList           = ColorStateList.ValueOf(Color.Black);
                MainActivity.instance.FindViewById <ImageButton>(Resource.Id.spPlay).ImageTintList           = ColorStateList.ValueOf(Color.Black);
                MainActivity.instance.FindViewById <ImageButton>(Resource.Id.spLast).ImageTintList           = ColorStateList.ValueOf(Color.Black);
                MainActivity.instance.FindViewById <ProgressBar>(Resource.Id.spBuffer).IndeterminateTintList = ColorStateList.ValueOf(Color.Black);
            }
        }
Example #28
0
 public void Repeat(bool repeat)
 {
     if (repeat)
     {
         MainActivity.instance.FindViewById <ImageButton>(Resource.Id.repeat)?.SetColorFilter(Color.Argb(255, 21, 183, 237), PorterDuff.Mode.Multiply);
     }
     else
     {
         MainActivity.instance?.FindViewById <ImageButton>(Resource.Id.repeat)?.ClearColorFilter();
     }
 }
 private void DateView_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < ((sender as LinearLayout).Parent as LinearLayout).ChildCount; i++)
     {
         // Remove selection color to other date views
         (((sender as LinearLayout).Parent as LinearLayout).GetChildAt(i) as LinearLayout).SetBackgroundColor(Color.White);
         ((((sender as LinearLayout).Parent as LinearLayout).GetChildAt(i) as LinearLayout).GetChildAt(0) as TextView).SetTextColor(Color.Argb(54, 00, 00, 00));
         ((((sender as LinearLayout).Parent as LinearLayout).GetChildAt(i) as LinearLayout).GetChildAt(1) as TextView).SetTextColor(Color.Black);
     }
     ((sender as LinearLayout).GetChildAt(0) as TextView).SetTextColor(Color.White);
     ((sender as LinearLayout).GetChildAt(1) as TextView).SetTextColor(Color.White);
     (sender as LinearLayout).SetBackgroundColor(Color.ParseColor("#007CEE"));
 }
Example #30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Parts_Search);

            //カメラの許可確認
            if (ContextCompat.CheckSelfPermission(this, Android.Manifest.Permission.Camera) == Permission.Granted)
            {
                // 許可されている時の処理
            }
            else
            {
                // 拒否されている時の処理
                ActivityCompat.RequestPermissions(this, new String[] { Android.Manifest.Permission.Camera }, 0);
            }


            dbConString                = new SqlConnectionStringBuilder();
            dbConString.UserID         = "SS_ODBC";
            dbConString.Password       = "******";
            dbConString.DataSource     = "192.168.1.9,1433";
            dbConString.InitialCatalog = "SS_METAL";

            var lnl01 = FindViewById <LinearLayout>(Resource.Id.linearLayout1);

            lnl01.SetBackgroundColor(Color.Argb(255, 31, 73, 125));

            ImageButton btn_qr = FindViewById <ImageButton>(Resource.Id.btn_QR);
            var         bmp    = BitmapFactory.DecodeResource(Resources, Resource.Drawable.QR);

            btn_qr.SetImageBitmap(bmp);

            ImageView img_ss = FindViewById <ImageView>(Resource.Id.img_SS);

            bmp = BitmapFactory.DecodeResource(Resources, Resource.Drawable.SSLogo);
            img_ss.SetImageBitmap(bmp);

            var txt_hc = FindViewById <TextView>(Resource.Id.txt_HC);

            var btn_view = FindViewById <Button>(Resource.Id.btn_View);

            btn_qr.Click += async(sender, e) =>
            {
                try
                {
                    MobileBarcodeScanner.Initialize(Application);
                    var scanner = new MobileBarcodeScanner();
                    var result  = await scanner.Scan();

                    if (result != null)
                    {
                        txt_hc.Text = result.ToString();
                        //部品情報ダイアログ
                        txt_hc.Text = Fun_HC_Data_Dlg(txt_hc.Text);
                    }
                }
                catch
                {
                    Toast.MakeText(this, "Reader起動に失敗。", ToastLength.Long).Show();
                }
            };

            btn_view.Click += delegate
            {
                if (txt_hc.Text.Replace(" ", "").Length > 0)
                {
                    //部品情報ダイアログ
                    txt_hc.Text = Fun_HC_Data_Dlg(txt_hc.Text);
                }
                ;
            };
        }