diff --git a/src/Toolkit/Toolkit.Android/Esri.ArcGISRuntime.Toolkit.Android.Build.targets b/src/Toolkit/Toolkit.Android/Esri.ArcGISRuntime.Toolkit.Android.Build.targets
deleted file mode 100644
index 1dd60c859..000000000
--- a/src/Toolkit/Toolkit.Android/Esri.ArcGISRuntime.Toolkit.Android.Build.targets
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
-
-
-
- try
- {
- var publicResourceClassDecl = "public";
- var internalResourceClassDecl = "[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\npublic";
-
- // Check whether the auto-generated Resource.Designer.cs file exists
- if (File.Exists(ResourceFilePath))
- {
- Log.LogMessage("Found auto-generated resource file: " + ResourceFilePath, MessageImportance.Low);
-
- // Read the file
- var resourceClassDef = File.ReadAllText(ResourceFilePath);
- if (resourceClassDef.Contains(internalResourceClassDecl))
- {
- Log.LogMessage("Auto-generated Resource class is already updated", MessageImportance.Low);
- }
- else if (resourceClassDef.Contains(publicResourceClassDecl))
- {
- // Make the Resource class internal
- resourceClassDef = resourceClassDef.Replace(publicResourceClassDecl, internalResourceClassDecl);
- File.WriteAllText(ResourceFilePath, resourceClassDef);
- Log.LogMessage("Updated auto-generated resource file to make Resource class internal", MessageImportance.Low);
- }
- else
- {
- Log.LogError("Resource class declaration not found in auto-generated file " + ResourceFilePath);
- return false;
- }
- }
- else
- {
- Log.LogWarning("Auto-generated file not found at path " + ResourceFilePath);
- return true;
- }
- }
- catch (Exception ex)
- {
- Log.LogError("Error occured: " + ex.Message + "\n" + ex.StackTrace);
- return false;
- }
-
-
-
-
-
-
-
-
diff --git a/src/Toolkit/Toolkit.Android/Esri.ArcGISRuntime.Toolkit.Android.projitems b/src/Toolkit/Toolkit.Android/Esri.ArcGISRuntime.Toolkit.Android.projitems
deleted file mode 100644
index e4b438cc2..000000000
--- a/src/Toolkit/Toolkit.Android/Esri.ArcGISRuntime.Toolkit.Android.projitems
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
- true
- c8657c80-a1ab-4d77-9f75-d923ab430cfb
-
-
- Esri.ArcGISRuntime.Toolkit.UI
-
-
-
-
- Designer
-
-
-
-
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/Esri.ArcGISRuntime.Toolkit.Android.shproj b/src/Toolkit/Toolkit.Android/Esri.ArcGISRuntime.Toolkit.Android.shproj
deleted file mode 100644
index 477e16186..000000000
--- a/src/Toolkit/Toolkit.Android/Esri.ArcGISRuntime.Toolkit.Android.shproj
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- c8657c80-a1ab-4d77-9f75-d923ab430cfb
- 14.0
-
-
-
-
-
-
-
-
diff --git a/src/Toolkit/Toolkit.Android/Internal/GraphicsExtensions.cs b/src/Toolkit/Toolkit.Android/Internal/GraphicsExtensions.cs
deleted file mode 100644
index 3414b7093..000000000
--- a/src/Toolkit/Toolkit.Android/Internal/GraphicsExtensions.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using Android.Graphics;
-using Android.Util;
-
-namespace Esri.ArcGISRuntime.Toolkit.Internal
-{
- ///
- /// Helper class for providing common cross-platform names for members having to do with graphics or drawing-related objects.
- ///
- internal static class GraphicsExtensions
- {
- public static bool IsEmpty(this SizeF size) => size == default(SizeF);
-
- public static void SetX(this RectF rect, double x)
- {
- var width = rect.Right - rect.Left;
- rect.Left = (float)x;
- rect.Right = rect.Left + width;
- }
-
- public static void SetWidth(this RectF rect, double width) => rect.Right = rect.Left + (float)width;
- }
-}
diff --git a/src/Toolkit/Toolkit.Android/Internal/ListViewExtensions.cs b/src/Toolkit/Toolkit.Android/Internal/ListViewExtensions.cs
deleted file mode 100644
index 5587beb34..000000000
--- a/src/Toolkit/Toolkit.Android/Internal/ListViewExtensions.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using Android.Views;
-using Android.Widget;
-
-namespace Esri.ArcGISRuntime.Toolkit.Internal
-{
- internal static class ListViewExtensions
- {
- internal static void SetHeightBasedOnChildren(this ListView listView)
- {
- if (listView.Adapter == null)
- {
- return;
- }
-
- int totalHeight = 0;
- int totalItems = listView.Adapter.Count;
- for (int i = 0; i < totalItems; i++)
- {
- var item = listView.Adapter.GetView(i, null, listView);
- if (item is null || item.Visibility == ViewStates.Gone)
- {
- continue;
- }
-
- item.Measure(View.MeasureSpec.MakeMeasureSpec(0, MeasureSpecMode.Unspecified), View.MeasureSpec.MakeMeasureSpec(0, MeasureSpecMode.Unspecified));
- totalHeight += item.MeasuredHeight;
- }
-
- if (listView.LayoutParameters != null)
- {
- listView.LayoutParameters.Height = totalHeight + ((listView.DividerHeight * totalItems) - 1);
- }
-
- listView.RequestLayout();
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarkItemView.cs b/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarkItemView.cs
deleted file mode 100644
index 56d661e61..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarkItemView.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using Android.Content;
-using Android.Util;
-using Android.Views;
-using Android.Widget;
-using Esri.ArcGISRuntime.Mapping;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- ///
- /// View class used to render the individual entry for a shown by .
- ///
- internal class BookmarkItemView : LinearLayout
- {
- // View that renders the bookmark's title.
- public TextView BookmarkLabel { get; }
-
- internal BookmarkItemView(Context? context)
- : base(context)
- {
- Orientation = Orientation.Horizontal;
- LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
- SetGravity(GravityFlags.CenterVertical | GravityFlags.FillHorizontal);
-
- Clickable = true;
-
- BookmarkLabel = new TextView(context)
- {
- LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent),
- };
-
- // Height
- var listItemHeightValue = new TypedValue();
- context?.Theme?.ResolveAttribute(Android.Resource.Attribute.ListPreferredItemHeight, listItemHeightValue, true);
- SetMinimumHeight((int)listItemHeightValue.GetDimension(Resources?.DisplayMetrics));
-
- // Left and right margin
- var listItemLeftMarginValue = new TypedValue();
- context?.Theme?.ResolveAttribute(Android.Resource.Attribute.ListPreferredItemPaddingStart, listItemLeftMarginValue, true);
-
- var listItemRightMarginValue = new TypedValue();
- context?.Theme?.ResolveAttribute(Android.Resource.Attribute.ListPreferredItemPaddingEnd, listItemRightMarginValue, true);
- SetPadding((int)listItemLeftMarginValue.GetDimension(Resources?.DisplayMetrics), 0, (int)listItemRightMarginValue.GetDimension(Resources?.DisplayMetrics), 0);
-
- BookmarkLabel.Gravity = GravityFlags.CenterVertical | GravityFlags.FillHorizontal;
-
- // Selection animation on hover
- var selectableBackground = new TypedValue();
- context?.Theme?.ResolveAttribute(Android.Resource.Attribute.SelectableItemBackground, selectableBackground, true);
- SetBackgroundResource(selectableBackground.ResourceId);
-
- AddView(BookmarkLabel);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarkItemViewHolder.cs b/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarkItemViewHolder.cs
deleted file mode 100644
index 5a5cf282d..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarkItemViewHolder.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System;
-using Android.Views;
-using Android.Widget;
-#if NET6_0_OR_GREATER
-using AndroidX.RecyclerView.Widget;
-#else
-using Android.Support.V7.Widget;
-#endif
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- ///
- /// Used to enable ViewHolder pattern used by RecyclerView.
- ///
- internal class BookmarkItemViewHolder : RecyclerView.ViewHolder
- {
- public TextView BookmarkLabel { get; }
-
- public BookmarkItemViewHolder(BookmarkItemView bmView, Action listener)
- : base(bmView)
- {
- BookmarkLabel = bmView.BookmarkLabel;
-
- var weakEventHandler = new Internal.WeakEventListener(bmView)
- {
- OnEventAction = (instance, source, eventArgs) => listener(LayoutPosition),
- OnDetachAction = (instance, weakEventListener) => instance.Click -= weakEventListener.OnEvent,
- };
-
- bmView.Click += weakEventHandler.OnEvent;
- }
- }
-}
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarksAdapter.cs b/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarksAdapter.cs
deleted file mode 100644
index 4bcca8b2b..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarksAdapter.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Linq;
-using Android.Content;
-#if NET6_0_OR_GREATER
-using AndroidX.RecyclerView.Widget;
-#else
-using Android.Support.V7.Widget;
-#endif
-using Android.Views;
-using Esri.ArcGISRuntime.Mapping;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- ///
- /// Creates the UI for the list items in the associated list of bookmarks.
- ///
- internal class BookmarksAdapter : RecyclerView.Adapter
- {
- private BookmarksViewDataSource _dataSource;
- private readonly Context? _context;
- private List _shadowList = new List();
-
- internal BookmarksAdapter(Context? context, BookmarksViewDataSource dataSource)
- {
- _context = context;
- _dataSource = dataSource;
- _shadowList = dataSource.ToList();
-
- var listener = new Internal.WeakEventListener(dataSource)
- {
- OnEventAction = (instance, source, eventArgs) =>
- {
- switch (eventArgs.Action)
- {
- case NotifyCollectionChangedAction.Add:
- _shadowList.InsertRange(eventArgs.NewStartingIndex, eventArgs.NewItems.OfType());
- NotifyItemInserted(eventArgs.NewStartingIndex);
- break;
- case NotifyCollectionChangedAction.Remove:
- _shadowList.RemoveRange(eventArgs.OldStartingIndex, eventArgs.OldItems.Count);
- NotifyItemRemoved(eventArgs.OldStartingIndex);
- break;
- case NotifyCollectionChangedAction.Reset:
- _shadowList = _dataSource.ToList();
- NotifyDataSetChanged();
- break;
- case NotifyCollectionChangedAction.Move:
- _shadowList = _dataSource.ToList();
- NotifyDataSetChanged();
- break;
- case NotifyCollectionChangedAction.Replace:
- _shadowList[eventArgs.OldStartingIndex] = (Bookmark)eventArgs.NewItems[0];
- NotifyItemChanged(eventArgs.OldStartingIndex);
- break;
- }
- },
- OnDetachAction = (instance, weakEventListener) => instance.CollectionChanged -= weakEventListener.OnEvent,
- };
-
- dataSource.CollectionChanged += listener.OnEvent;
- }
-
- public override int ItemCount => _shadowList?.Count() ?? 0;
-
- ///
- public override long GetItemId(int position) => position;
-
- public event EventHandler? BookmarkSelected;
-
- public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
- {
- BookmarkItemViewHolder? bookmarkHolder = holder as BookmarkItemViewHolder;
- if (bookmarkHolder?.BookmarkLabel != null && _shadowList != null && _shadowList.Count() > position)
- {
- bookmarkHolder.BookmarkLabel.Text = _shadowList.ElementAt(position).Name;
- }
- }
-
- public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
- {
- BookmarkItemView itemView = new BookmarkItemView(_context);
- return new BookmarkItemViewHolder(itemView, OnBookmarkClicked);
- }
-
- private void OnBookmarkClicked(int position)
- {
- BookmarkSelected?.Invoke(this, _shadowList.ElementAt(position));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarksView.Android.cs b/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarksView.Android.cs
deleted file mode 100644
index 0aa987167..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/BookmarksView/BookmarksView.Android.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System;
-using System.Diagnostics.CodeAnalysis;
-using Android.Content;
-#if NET6_0_OR_GREATER
-using AndroidX.RecyclerView.Widget;
-#else
-using Android.Support.V7.Widget;
-#endif
-using Android.Util;
-using Esri.ArcGISRuntime.Mapping;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- public partial class BookmarksView
- {
- private RecyclerView _internalListView;
- private BookmarksAdapter _adapter;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- public BookmarksView(Context context)
- : base(context ?? throw new ArgumentNullException(nameof(context)))
- {
- Initialize();
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- /// The attributes of the AXML element declaring the view.
- public BookmarksView(Context context, IAttributeSet? attr)
- : base(context ?? throw new ArgumentNullException(nameof(context)), attr)
- {
- Initialize();
- }
-
- [MemberNotNull(nameof(_internalListView))]
- [MemberNotNull(nameof(_adapter))]
- internal void Initialize()
- {
- _internalListView = new RecyclerView(Context);
- _internalListView.SetLayoutManager(new LinearLayoutManager(Context));
- _adapter = new BookmarksAdapter(Context, _dataSource);
- _internalListView.SetAdapter(_adapter);
- AddView(_internalListView);
- }
-
- ///
- ///
- ///
- protected override void OnAttachedToWindow()
- {
- base.OnAttachedToWindow();
-
- if (_adapter != null)
- {
- _adapter.BookmarkSelected += ListView_ItemClick;
- }
- }
-
- ///
- ///
- ///
- protected override void OnDetachedFromWindow()
- {
- base.OnDetachedFromWindow();
-
- if (_adapter != null)
- {
- _adapter.BookmarkSelected -= ListView_ItemClick;
- }
- }
-
- private void ListView_ItemClick(object sender, Bookmark bookmark)
- {
- SelectAndNavigateToBookmark(bookmark);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/LayerLegend/LayerLegend.Android.cs b/src/Toolkit/Toolkit.Android/UI/Controls/LayerLegend/LayerLegend.Android.cs
deleted file mode 100644
index cf5ba5e40..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/LayerLegend/LayerLegend.Android.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System;
-using System.Collections.ObjectModel;
-using System.Diagnostics.CodeAnalysis;
-using System.Threading;
-using Android.Content;
-using Android.Runtime;
-using Android.Util;
-using Android.Views;
-using Android.Widget;
-using Esri.ArcGISRuntime.Mapping;
-using Esri.ArcGISRuntime.Toolkit.Internal;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- [Register("Esri.ArcGISRuntime.Toolkit.UI.Controls.LayerLegend")]
- public partial class LayerLegend
- {
- private ListView _listView;
- private Android.OS.Handler _uithread;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- public LayerLegend(Context context)
- : base(context ?? throw new ArgumentNullException(nameof(context)))
- {
- Initialize();
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- /// The attributes of the AXML element declaring the view.
- public LayerLegend(Context context, IAttributeSet? attr)
- : base(context ?? throw new ArgumentNullException(nameof(context)), attr)
- {
- Initialize();
- }
-
- [MemberNotNull(nameof(_listView), nameof(_uithread))]
- private void Initialize()
- {
- _uithread = new Android.OS.Handler(Context!.MainLooper!);
-
- _listView = new ListView(Context)
- {
- ClipToOutline = true,
- Clickable = false,
- ChoiceMode = ChoiceMode.None,
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- ScrollingCacheEnabled = false,
- PersistentDrawingCache = PersistentDrawingCaches.NoCache,
- };
-
- AddView(_listView);
- }
-
- private void Refresh()
- {
- if (_listView == null)
- {
- return;
- }
-
- if (LayerContent == null)
- {
- _listView.Adapter = null;
- return;
- }
-
- if (LayerContent is ILoadable loadable)
- {
- if (loadable.LoadStatus != LoadStatus.Loaded)
- {
- loadable.Loaded += Layer_Loaded;
- loadable.LoadAsync();
- return;
- }
- }
-
- var items = new ObservableCollection();
- LoadRecursive(items, LayerContent, IncludeSublayers);
- _listView.Adapter = new LayerLegendAdapter(Context, items);
- _listView.SetHeightBasedOnChildren();
- }
-
- private void Layer_Loaded(object sender, System.EventArgs e)
- {
- if (sender is ILoadable loadable)
- {
- loadable.Loaded -= Layer_Loaded;
- }
-
- _uithread.Post(Refresh);
- }
-
- ///
- protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
- {
- base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
-
- // Initialize dimensions of root layout
- MeasureChild(_listView, widthMeasureSpec, MeasureSpec.MakeMeasureSpec(MeasureSpec.GetSize(heightMeasureSpec), MeasureSpecMode.AtMost));
-
- // Calculate the ideal width and height for the view
- var desiredWidth = PaddingLeft + PaddingRight + _listView.MeasuredWidth;
- var desiredHeight = PaddingTop + PaddingBottom + _listView.MeasuredHeight;
-
- // Get the width and height of the view given any width and height constraints indicated by the width and height spec values
- var width = ResolveSize(desiredWidth, widthMeasureSpec);
- var height = ResolveSize(desiredHeight, heightMeasureSpec);
- SetMeasuredDimension(width, height);
- }
-
- ///
- protected override void OnLayout(bool changed, int l, int t, int r, int b)
- {
- // Forward layout call to the root layout
- _listView.Layout(PaddingLeft, PaddingTop, _listView.MeasuredWidth + PaddingLeft, _listView.MeasuredHeight + PaddingBottom);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/LayerLegend/LayerLegendAdapter.cs b/src/Toolkit/Toolkit.Android/UI/Controls/LayerLegend/LayerLegendAdapter.cs
deleted file mode 100644
index 2b2703b8a..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/LayerLegend/LayerLegendAdapter.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using Android.Content;
-using Android.Views;
-using Android.Widget;
-using Esri.ArcGISRuntime.Mapping;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- internal class LayerLegendAdapter : BaseAdapter
- {
- private readonly IReadOnlyList _layerLegends;
- private readonly Context? _context;
-
- internal LayerLegendAdapter(Context? context, IReadOnlyList layerLegends)
- {
- _context = context;
- _layerLegends = layerLegends;
- if (_layerLegends is INotifyCollectionChanged incc)
- {
- var listener = new Internal.WeakEventListener(incc)
- {
- OnEventAction = (instance, source, eventArgs) =>
- {
- NotifyDataSetChanged();
- },
- OnDetachAction = (instance, weakEventListener) => instance.CollectionChanged -= weakEventListener.OnEvent,
- };
- incc.CollectionChanged += listener.OnEvent;
- }
- }
-
- public override LegendInfo this[int position] => _layerLegends[position];
-
- public override int Count => _layerLegends.Count;
-
- public override long GetItemId(int position)
- {
- return position;
- }
-
- public override View? GetView(int position, View? convertView, ViewGroup? parent)
- {
- var layerLegend = _layerLegends[position];
- if (convertView == null)
- {
- convertView = new LayerLegendItemView(_context);
- }
-
- (convertView as LayerLegendItemView)?.Update(layerLegend);
- return convertView;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/LayerLegend/LayerLegendItemView.cs b/src/Toolkit/Toolkit.Android/UI/Controls/LayerLegend/LayerLegendItemView.cs
deleted file mode 100644
index b5d2e8423..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/LayerLegend/LayerLegendItemView.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using Android.Content;
-using Android.Views;
-using Android.Widget;
-using Esri.ArcGISRuntime.Mapping;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- internal class LayerLegendItemView : LinearLayout
- {
- private readonly SymbolDisplay _symbolDisplay;
- private readonly TextView _textView;
-
- internal LayerLegendItemView(Context? context)
- : base(context)
- {
- Orientation = Orientation.Horizontal;
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
- SetGravity(GravityFlags.Top);
-
- _symbolDisplay = new SymbolDisplay(context)
- {
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent),
- };
- _symbolDisplay.SetMaxHeight(40);
- _symbolDisplay.SetMaxWidth(40);
- AddView(_symbolDisplay);
-
- _textView = new TextView(context)
- {
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent),
- };
- _textView.Gravity = GravityFlags.CenterVertical;
- AddView(_textView);
- RequestLayout();
- }
-
- internal void Update(LegendInfo info)
- {
- _symbolDisplay.Symbol = info?.Symbol;
- _textView.Text = info?.Name;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/PopupViewer/DetailsItemView.cs b/src/Toolkit/Toolkit.Android/UI/Controls/PopupViewer/DetailsItemView.cs
deleted file mode 100644
index 5ef881a3f..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/PopupViewer/DetailsItemView.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using Android.Content;
-using Android.Graphics;
-using Android.Views;
-using Android.Widget;
-using Esri.ArcGISRuntime.Mapping.Popups;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- internal class DetailsItemView : LinearLayout
- {
- private readonly TextView _label;
- private readonly TextView _formattedValue;
-
- internal DetailsItemView(Context? context, Color foregroundColor)
- : base(context)
- {
- Orientation = Orientation.Vertical;
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
- SetGravity(GravityFlags.Top);
-
- _label = new TextView(context)
- {
- LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent),
- };
- _label.SetTextColor(Color.Argb(foregroundColor.A / 2, foregroundColor.R, foregroundColor.G, foregroundColor.B));
- AddView(_label);
-
- _formattedValue = new TextView(context)
- {
- LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent),
- };
- _formattedValue.SetTextColor(foregroundColor);
- AddView(_formattedValue);
- RequestLayout();
- }
-
- internal void Update(PopupFieldValue? field)
- {
- _label.Text = field?.Field?.Label;
- _formattedValue.Text = field?.FormattedValue;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/PopupViewer/PopupFieldAdapter.cs b/src/Toolkit/Toolkit.Android/UI/Controls/PopupViewer/PopupFieldAdapter.cs
deleted file mode 100644
index b2f489201..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/PopupViewer/PopupFieldAdapter.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using Android.Content;
-using Android.Graphics;
-using Android.Views;
-using Android.Widget;
-using Esri.ArcGISRuntime.Mapping.Popups;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- internal class PopupFieldAdapter : BaseAdapter
- {
- private readonly IReadOnlyList _displayFields;
- private readonly Context? _context;
- private Color _foregroundColor = Color.Black;
-
- internal PopupFieldAdapter(Context? context, IEnumerable displayFields, Color foregroundColor)
- {
- _context = context;
- _displayFields = displayFields?.Any() ?? false ?
- new ReadOnlyCollection(displayFields?.ToList()) :
- new ReadOnlyCollection(Enumerable.Empty().ToList());
- _foregroundColor = foregroundColor;
- }
-
- internal void SetForegroundColor(Color foregroundColor)
- {
- _foregroundColor = foregroundColor;
- }
-
- public override PopupFieldValue this[int position] => _displayFields[position];
-
- public override int Count => _displayFields.Count;
-
- public override long GetItemId(int position)
- {
- return position;
- }
-
- public override View GetView(int position, View? convertView, ViewGroup? parent)
- {
- var popupFieldValue = _displayFields[position];
- if (convertView == null)
- {
- convertView = new DetailsItemView(_context, _foregroundColor);
- }
-
- (convertView as DetailsItemView)?.Update(popupFieldValue);
- return convertView;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/PopupViewer/PopupViewer.Android.cs b/src/Toolkit/Toolkit.Android/UI/Controls/PopupViewer/PopupViewer.Android.cs
deleted file mode 100644
index 4a19965cc..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/PopupViewer/PopupViewer.Android.cs
+++ /dev/null
@@ -1,169 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System.Diagnostics.CodeAnalysis;
-using Android.Content;
-using Android.Graphics;
-using Android.Runtime;
-using Android.Util;
-using Android.Views;
-using Android.Widget;
-using Esri.ArcGISRuntime.Toolkit.Internal;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- [Register("Esri.ArcGISRuntime.Toolkit.UI.Controls.PopupViewer")]
- public partial class PopupViewer
- {
- // These properties are not null, as they are initialized in Initialize() called by all constructors
- private LinearLayout _rootLayout;
- private TextView _editSummary;
- private TextView _customHtmlDescription;
- private ListView _detailsList;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- public PopupViewer(Context? context)
- : base(context)
- {
- Initialize();
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- /// The attributes of the AXML element declaring the view.
- public PopupViewer(Context? context, IAttributeSet? attr)
- : base(context, attr)
- {
- Initialize();
- }
-
- [MemberNotNull(nameof(_detailsList), nameof(_customHtmlDescription), nameof(_editSummary), nameof(_rootLayout), nameof(_detailsList))]
- internal void Initialize()
- {
- _rootLayout = new LinearLayout(Context)
- {
- Orientation = Orientation.Vertical,
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- };
- _rootLayout.SetGravity(GravityFlags.Top);
-
- _editSummary = new TextView(Context)
- {
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- };
- _editSummary.SetTextColor(_foregroundColor);
- _rootLayout.AddView(_editSummary);
-
- _customHtmlDescription = new TextView(Context)
- {
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- };
- _customHtmlDescription.SetTextColor(_foregroundColor);
- _rootLayout.AddView(_customHtmlDescription);
-
- _detailsList = new ListView(Context)
- {
- ClipToOutline = true,
- Clickable = false,
- ChoiceMode = ChoiceMode.None,
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- ScrollingCacheEnabled = false,
- };
-
- _rootLayout.AddView(_detailsList);
-
- AddView(_rootLayout);
-
- _rootLayout.RequestLayout();
- }
-
- private void Refresh()
- {
- if (PopupManager == null)
- {
- _detailsList.Adapter = null;
- return;
- }
-
- _editSummary.Visibility = !string.IsNullOrWhiteSpace(PopupManager.EditSummary) ? ViewStates.Visible : ViewStates.Gone;
- _editSummary.Text = PopupManager.EditSummary;
-
- if (!string.IsNullOrWhiteSpace(PopupManager.CustomDescriptionHtml))
- {
- _customHtmlDescription.Visibility = ViewStates.Visible;
- _customHtmlDescription.Text = PopupManager.CustomDescriptionHtml?.ToPlainText();
- _detailsList.Visibility = ViewStates.Gone;
- _detailsList.Adapter = null;
- return;
- }
- else
- {
- _customHtmlDescription.Visibility = ViewStates.Gone;
- _customHtmlDescription.Text = null;
- _detailsList.Visibility = ViewStates.Visible;
- _detailsList.Adapter = new PopupFieldAdapter(Context, PopupManager.DisplayedFields, _foregroundColor);
- _detailsList.SetHeightBasedOnChildren();
- }
- }
-
- private Color _foregroundColor = Color.Black;
-
- ///
- /// Gets or sets the color of the foreground elements of the .
- ///
- public Color ForegroundColor
- {
- get => _foregroundColor;
- set
- {
- _foregroundColor = value;
- _editSummary.SetTextColor(value);
- _customHtmlDescription.SetTextColor(value);
- (_detailsList.Adapter as PopupFieldAdapter)?.SetForegroundColor(value);
- }
- }
-
- ///
- protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
- {
- base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
-
- // Initialize dimensions of root layout
- MeasureChild(_rootLayout, widthMeasureSpec, MeasureSpec.MakeMeasureSpec(MeasureSpec.GetSize(heightMeasureSpec), MeasureSpecMode.AtMost));
-
- // Calculate the ideal width and height for the view
- var desiredWidth = PaddingLeft + PaddingRight + _rootLayout.MeasuredWidth;
- var desiredHeight = PaddingTop + PaddingBottom + _rootLayout.MeasuredHeight;
-
- // Get the width and height of the view given any width and height constraints indicated by the width and height spec values
- var width = ResolveSize(desiredWidth, widthMeasureSpec);
- var height = ResolveSize(desiredHeight, heightMeasureSpec);
- SetMeasuredDimension(width, height);
- }
-
- ///
- protected override void OnLayout(bool changed, int l, int t, int r, int b)
- {
- // Forward layout call to the root layout
- _rootLayout.Layout(PaddingLeft, PaddingTop, _rootLayout.MeasuredWidth + PaddingLeft, _rootLayout.MeasuredHeight + PaddingBottom);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/ScaleLine/RectangleView.cs b/src/Toolkit/Toolkit.Android/UI/Controls/ScaleLine/RectangleView.cs
deleted file mode 100644
index ca72d21ae..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/ScaleLine/RectangleView.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System;
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-using Android.Content;
-using Android.Graphics;
-using Android.Views;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI
-{
- ///
- /// Draws a rectangle on the screen.
- ///
- /// Provides a convenient mechanism for rendering rectangle elements of a certain size. The
- /// specified width and height will be applied to the width and height of the view's layout parameters.
- internal class RectangleView : View, INotifyPropertyChanged
- {
- public RectangleView(Context? context)
- : base(context)
- {
- }
-
- public RectangleView(Context? context, double width, double height)
- : this(context)
- {
- Width = width;
- Height = height;
- }
-
- private double _width;
-
- ///
- /// Gets or sets the rectangle's width.
- ///
- public new double Width
- {
- get => _width;
- set
- {
- _width = value;
- var layoutParams = GetLayoutParams();
- layoutParams.Width = (int)Math.Round(value);
- LayoutParameters = layoutParams;
- OnPropertyChanged();
- }
- }
-
- private ViewGroup.LayoutParams GetLayoutParams()
- {
- if (LayoutParameters == null)
- {
- LayoutParameters = new ViewGroup.LayoutParams(
- ViewGroup.LayoutParams.WrapContent,
- ViewGroup.LayoutParams.WrapContent);
- }
-
- return LayoutParameters;
- }
-
- private double _height;
-
- ///
- /// Gets or sets the rectangle's height.
- ///
- public new double Height
- {
- get => _height;
- set
- {
- _height = value;
- var layoutParams = GetLayoutParams();
- layoutParams.Height = (int)Math.Round(value);
- LayoutParameters = layoutParams;
- OnPropertyChanged();
- }
- }
-
- private Color _backgroundColor;
-
- ///
- /// Gets or sets the rectangle's background color.
- ///
- public Color BackgroundColor
- {
- get => _backgroundColor;
- set
- {
- SetBackgroundColor(value);
- _backgroundColor = value;
- OnPropertyChanged();
- }
- }
-
- ///
- public event PropertyChangedEventHandler? PropertyChanged;
-
- private void OnPropertyChanged([CallerMemberName] string? propertyName = null)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-}
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/ScaleLine/ScaleLine.Android.cs b/src/Toolkit/Toolkit.Android/UI/Controls/ScaleLine/ScaleLine.Android.cs
deleted file mode 100644
index 88b1b24aa..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/ScaleLine/ScaleLine.Android.cs
+++ /dev/null
@@ -1,270 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System;
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-using Android.App;
-using Android.Content;
-using Android.Graphics;
-using Android.Runtime;
-using Android.Util;
-using Android.Views;
-using Android.Widget;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- [Register("Esri.ArcGISRuntime.Toolkit.UI.Controls.ScaleLine")]
- public partial class ScaleLine
- {
- private RectangleView _firstMetricTickLine;
- private RectangleView _secondMetricTickLine;
- private RectangleView _scaleLineStartSegment;
- private RectangleView _firstUsTickLine;
- private RectangleView _secondUsTickLine;
- private RectangleView _combinedScaleLine;
- private RectangleView _metricWidthPlaceholder;
- private RectangleView _usWidthPlaceholder;
- private LinearLayout _rootLayout;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- public ScaleLine(Context? context)
- : base(context)
- {
- Initialize();
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- /// The attributes of the AXML element declaring the view.
- public ScaleLine(Context? context, IAttributeSet? attr)
- : base(context, attr)
- {
- Initialize();
- }
-
- [MemberNotNull(nameof(_rootLayout), nameof(_combinedScaleLine), nameof(_metricScaleLine), nameof(_metricValue), nameof(_metricUnit),
- nameof(_usScaleLine), nameof(_usValue), nameof(_usUnit), nameof(_firstMetricTickLine), nameof(_secondMetricTickLine), nameof(_scaleLineStartSegment),
- nameof(_firstUsTickLine), nameof(_secondUsTickLine), nameof(_metricWidthPlaceholder), nameof(_usWidthPlaceholder))]
- private void Initialize()
- {
- if (!DesignTime.IsDesignMode)
- {
- TargetWidth = CalculateScreenDimension(200);
- }
-
- // Vertically-oriented layout for containing all scalebar components
- _rootLayout = new LinearLayout(Context)
- {
- Orientation = Orientation.Vertical,
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- };
- _rootLayout.SetGravity(GravityFlags.Top);
-
- // Initialize scalebar components with placeholder sizes and values
- var scalelineHeight = CalculateScreenDimension(2);
- _combinedScaleLine = new RectangleView(Context, TargetWidth, scalelineHeight) { BackgroundColor = ForegroundColor };
- _metricScaleLine = new RectangleView(Context, TargetWidth, 1);
- _metricValue = new TextView(Context) { Text = "100" };
- _metricUnit = new TextView(Context) { Text = "m" };
- _usScaleLine = new RectangleView(Context, _metricScaleLine.Width * .9144, 1);
- _usValue = new TextView(Context) { Text = "300" };
- _usUnit = new TextView(Context) { Text = "ft" };
-
- var fontSize = 12;
- _metricValue.SetTextSize(ComplexUnitType.Dip, fontSize);
- _metricValue.SetTextColor(ForegroundColor);
- _metricUnit.SetTextSize(ComplexUnitType.Dip, fontSize);
- _metricUnit.SetTextColor(ForegroundColor);
- _usValue.SetTextSize(ComplexUnitType.Dip, fontSize);
- _usValue.SetTextColor(ForegroundColor);
- _usUnit.SetTextSize(ComplexUnitType.Dip, fontSize);
- _usUnit.SetTextColor(ForegroundColor);
-
- // Listen for width updates on metric and imperial scale lines to update the combined scale line
- _metricScaleLine.PropertyChanged += ScaleLine_PropertyChanged;
- _usScaleLine.PropertyChanged += ScaleLine_PropertyChanged;
-
- // ===============================================================
- // First row - placeholder, numeric text, and units text
- // ===============================================================
- var firstRowLayout = new LinearLayout(Context)
- {
- Orientation = Orientation.Horizontal,
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- };
-
- firstRowLayout.AddView(_metricScaleLine);
- firstRowLayout.AddView(_metricValue);
- firstRowLayout.AddView(_metricUnit);
-
- // ================================================================================
- // Second row - first metric tick line, placeholder, and second metric tick line
- // ================================================================================
- var secondRowLayout = new LinearLayout(Context)
- {
- Orientation = Orientation.Horizontal,
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- };
-
- var tickWidth = CalculateScreenDimension(2);
- var tickHeight = CalculateScreenDimension(5);
-
- _firstMetricTickLine = new RectangleView(Context, tickWidth, tickHeight) { BackgroundColor = ForegroundColor };
-
- _metricWidthPlaceholder = new RectangleView(Context, _metricScaleLine.Width, 1);
- _secondMetricTickLine = new RectangleView(Context, tickWidth, tickHeight) { BackgroundColor = ForegroundColor };
-
- secondRowLayout.AddView(_firstMetricTickLine);
- secondRowLayout.AddView(_metricWidthPlaceholder);
- secondRowLayout.AddView(_secondMetricTickLine);
-
- // ==============================================================================================
- // Third row - filler segment at start of scale line, combined metric/imperial scale line
- // ==============================================================================================
- var thirdRowLayout = new LinearLayout(Context)
- {
- Orientation = Orientation.Horizontal,
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- };
-
- _scaleLineStartSegment = new RectangleView(Context, Math.Round(tickWidth) * 2, scalelineHeight) { BackgroundColor = ForegroundColor };
-
- thirdRowLayout.AddView(_scaleLineStartSegment);
- thirdRowLayout.AddView(_combinedScaleLine);
-
- // ==============================================================================================
- // Fourth row - first imperial tick line, placeholder, second imperial tick line
- // ==============================================================================================
- var fourthRowLayout = new LinearLayout(Context)
- {
- Orientation = Orientation.Horizontal,
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- };
-
- _firstUsTickLine = new RectangleView(Context, tickWidth, tickHeight) { BackgroundColor = ForegroundColor };
- _secondUsTickLine = new RectangleView(Context, tickWidth, tickHeight) { BackgroundColor = ForegroundColor };
-
- fourthRowLayout.AddView(_firstUsTickLine);
- fourthRowLayout.AddView(_usScaleLine);
- fourthRowLayout.AddView(_secondUsTickLine);
-
- // ==========================================================================
- // Fifth row - placeholder, imperial numeric text, imperial unit text
- // ==========================================================================
- var fifthRowLayout = new LinearLayout(Context)
- {
- Orientation = Orientation.Horizontal,
- LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- };
-
- _usWidthPlaceholder = new RectangleView(Context, _usScaleLine.Width, 1);
-
- fifthRowLayout.AddView(_usWidthPlaceholder);
- fifthRowLayout.AddView(_usValue);
- fifthRowLayout.AddView(_usUnit);
-
- // Add all scalebar rows to the root layout
- _rootLayout.AddView(firstRowLayout);
- _rootLayout.AddView(secondRowLayout);
- _rootLayout.AddView(thirdRowLayout);
- _rootLayout.AddView(fourthRowLayout);
- _rootLayout.AddView(fifthRowLayout);
-
- // Add root layout to view
- AddView(_rootLayout);
- _rootLayout.RequestLayout();
- }
-
- private Color _foregroundColor = Color.Black;
-
- ///
- /// Gets or sets the color of the foreground elements of the .
- ///
- public Color ForegroundColor
- {
- get => _foregroundColor;
- set
- {
- _foregroundColor = value;
-
- // Apply specified color to scalebar elements
- _combinedScaleLine.BackgroundColor = value;
- _metricUnit.SetTextColor(value);
- _metricValue.SetTextColor(value);
- _usUnit.SetTextColor(value);
- _usValue.SetTextColor(value);
- _firstMetricTickLine.BackgroundColor = value;
- _secondMetricTickLine.BackgroundColor = value;
- _firstUsTickLine.BackgroundColor = value;
- _secondUsTickLine.BackgroundColor = value;
- _scaleLineStartSegment.BackgroundColor = value;
- }
- }
-
- private void ScaleLine_PropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- // Synchronize place holder widths with calculated imperial and metric line widths
- _metricWidthPlaceholder.Width = _metricScaleLine.Width;
- _usWidthPlaceholder.Width = _usScaleLine.Width;
-
- // Update the scale line to be the longer of the metric or imperial lines
- _combinedScaleLine.Width = _metricScaleLine.Width > _usScaleLine.Width ? _metricScaleLine.Width : _usScaleLine.Width;
- }
-
- private void SetVisibility(bool isVisible)
- {
- Visibility = isVisible ? Android.Views.ViewStates.Visible : Android.Views.ViewStates.Gone;
- }
-
- ///
- protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
- {
- base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
-
- // Initialize dimensions of root layout
- MeasureChild(_rootLayout, widthMeasureSpec, MeasureSpec.MakeMeasureSpec(MeasureSpec.GetSize(heightMeasureSpec), MeasureSpecMode.AtMost));
-
- // Calculate the ideal width and height for the view
- var desiredWidth = PaddingLeft + PaddingRight + _rootLayout.MeasuredWidth;
- var desiredHeight = PaddingTop + PaddingBottom + _rootLayout.MeasuredHeight;
-
- // Get the width and height of the view given any width and height constraints indicated by the width and height spec values
- var width = ResolveSize(desiredWidth, widthMeasureSpec);
- var height = ResolveSize(desiredHeight, heightMeasureSpec);
- SetMeasuredDimension(width, height);
- }
-
- ///
- protected override void OnLayout(bool changed, int l, int t, int r, int b)
- {
- // Forward layout call to the root layout
- _rootLayout.Layout(PaddingLeft, PaddingTop, _rootLayout.MeasuredWidth + PaddingLeft, _rootLayout.MeasuredHeight + PaddingBottom);
- }
-
- // Calculates a screen dimension given a specified dimension in raw pixels
- private float CalculateScreenDimension(float pixels, ComplexUnitType screenUnitType = ComplexUnitType.Dip)
- {
- return !DesignTime.IsDesignMode ?
- TypedValue.ApplyDimension(screenUnitType, pixels, Internal.ViewExtensions.GetDisplayMetrics(Context)) : pixels;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/SymbolDisplay/SymbolDisplay.Android.cs b/src/Toolkit/Toolkit.Android/UI/Controls/SymbolDisplay/SymbolDisplay.Android.cs
deleted file mode 100644
index 67285312b..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/SymbolDisplay/SymbolDisplay.Android.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System.Threading.Tasks;
-using Android.App;
-using Android.Content;
-using Android.Runtime;
-using Android.Util;
-using Android.Views;
-using Android.Widget;
-using Esri.ArcGISRuntime.UI;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- [Register("Esri.ArcGISRuntime.Toolkit.UI.Controls.SymbolDisplay")]
- public partial class SymbolDisplay
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- public SymbolDisplay(Context? context)
- : base(context)
- {
- Initialize();
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- /// The attributes of the AXML element declaring the view.
- public SymbolDisplay(Context context, IAttributeSet attr)
- : base(context, attr)
- {
- Initialize();
- }
-
- private void Initialize()
- {
- SetScaleType(ImageView.ScaleType.Center);
- }
-
- private async Task UpdateSwatchAsync()
- {
- if (Symbol == null)
- {
- SetImageResource(0);
- return;
- }
-
-#pragma warning disable ESRI1800 // Add ConfigureAwait(false) - This is UI Dependent code and must return to UI Thread
- try
- {
- var scale = GetScaleFactor(Context);
- var imageData = await Symbol.CreateSwatchAsync(scale * 96);
- SetImageBitmap(await imageData.ToImageSourceAsync());
- SourceUpdated?.Invoke(this, System.EventArgs.Empty);
- }
- catch
- {
- SetImageResource(0);
- }
-#pragma warning restore ESRI1800
- }
-
- private static double GetScaleFactor(Context? context)
- {
- return Internal.ViewExtensions.GetDisplayMetrics(context)?.Density ?? 1;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/TimeSlider/Tickbar.Android.cs b/src/Toolkit/Toolkit.Android/UI/Controls/TimeSlider/Tickbar.Android.cs
deleted file mode 100644
index 94e25f44b..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/TimeSlider/Tickbar.Android.cs
+++ /dev/null
@@ -1,361 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System;
-using System.Collections.Generic;
-using Android.Content;
-using Android.Graphics;
-using Android.Runtime;
-using Android.Util;
-using Android.Views;
-using Android.Widget;
-using Esri.ArcGISRuntime.Toolkit.Internal;
-using Esri.ArcGISRuntime.Toolkit.UI;
-
-namespace Esri.ArcGISRuntime.Toolkit.Primitives
-{
- [Register("Esri.ArcGISRuntime.Toolkit.Primitives.Tickbar")]
- public partial class Tickbar : FrameLayout
- {
- private int _lastMeasuredWidth = 0;
- private int _lastMeasuredHeight = 0;
- private int _lastLayoutWidth = 0;
- private int _lastLayoutHeight = 0;
- private bool _lastLabelsVisible = false;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- /// The attributes of the AXML element declaring the view.
- public Tickbar(Context context, IAttributeSet? attr)
- : base(context, attr)
- {
- Initialize();
- }
-
- private void Initialize()
- {
- }
-
- private Size _majorTickSize = new Size(1, 10);
-
- ///
- /// Gets or sets the size of major tickmarks.
- ///
- public Size MajorTickSize
- {
- get => _majorTickSize;
- set
- {
- if (value.Width == _majorTickSize.Width && value.Height == _majorTickSize.Height)
- {
- return;
- }
-
- _majorTickSize = value;
- foreach (RectangleView tick in _majorTickmarks)
- {
- tick.Width = _majorTickSize.Width;
- tick.Height = _majorTickSize.Height;
- }
-
- InvalidateMeasureAndArrange();
- }
- }
-
- private Size _minorTickSize = new Size(1, 5);
-
- ///
- /// Gets or sets the size of minor tickmarks.
- ///
- public Size MinorTickSize
- {
- get => _minorTickSize;
- set
- {
- if (value.Width == _minorTickSize.Width && value.Height == _minorTickSize.Height)
- {
- return;
- }
-
- _minorTickSize = value;
- foreach (RectangleView tick in _minorTickmarks)
- {
- tick.Width = _minorTickSize.Width;
- tick.Height = _minorTickSize.Height;
- }
-
- InvalidateMeasureAndArrange();
- }
- }
-
- private double _labelOffset = 4;
-
- ///
- /// Gets or sets the spacing between ticks and tick labels.
- ///
- public double LabelOffset
- {
- get => _labelOffset;
- set
- {
- if (_labelOffset == value)
- {
- return;
- }
-
- _labelOffset = value;
- InvalidateMeasureAndArrange();
- }
- }
-
- private float _tickInset;
-
- ///
- /// Gets or sets the amount by which the tick rendering area is offset from the left and right edge of the tickbar.
- ///
- internal float TickInset
- {
- get => _tickInset;
- set
- {
- _tickInset = value;
- InvalidateMeasureAndArrange();
- }
- }
-
- ///
- /// Adds a tick to the bar's visual tree.
- ///
- /// The position to place the tick at along the tick bar.
- /// The data to pass to the tick's template.
- private void AddTickmark(double position, object? dataSource)
- {
- // Create both a minor and major tick mark at the specified position. Layout logic will determine which
- // one to actually show at the position.
-
- // Get dimension of ticks in DIPs
- var minorTickWidthDp = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, MinorTickSize.Width, ViewExtensions.GetDisplayMetrics(Context));
- var minorTickHeightDp = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, MinorTickSize.Height, ViewExtensions.GetDisplayMetrics(Context));
- var majorTickWidthDp = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, MajorTickSize.Width, ViewExtensions.GetDisplayMetrics(Context));
- var majorTickHeightDp = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, MajorTickSize.Height, ViewExtensions.GetDisplayMetrics(Context));
-
- // Create a minor tickmark
- var tick = new View(Context)
- {
- LayoutParameters = new FrameLayout.LayoutParams(minorTickWidthDp, minorTickHeightDp)
- {
- Gravity = GravityFlags.Bottom,
- },
- };
- tick.SetBackgroundFill(TickFill);
- SetIsMajorTickmark(tick, false);
- SetPosition(tick, position);
-
- AddView(tick);
- _minorTickmarks.Add(tick);
-
- // Create a major tickmark
- tick = new View(Context);
- tick.SetBackgroundFill(TickFill);
-
- if (dataSource is DateTimeOffset dateTime)
- {
- var majorTickContainer = new LinearLayout(Context)
- {
- Orientation = Orientation.Vertical,
- LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent)
- {
- Gravity = GravityFlags.Bottom,
- },
- };
-
- // Create label for major tickmark
- var timeStepIntervalDateFormat = string.IsNullOrEmpty(TickLabelFormat)
- ? _defaultTickLabelFormat : TickLabelFormat;
- var label = new TextView(Context)
- {
- Text = dateTime.ToString(timeStepIntervalDateFormat),
- Tag = dateTime.ToUnixTimeMilliseconds(),
- LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent),
- };
- label.SetTextColor(TickLabelColor);
-
- var text = label.Text;
- var color = label.CurrentTextColor;
-
- tick.LayoutParameters = new LinearLayout.LayoutParams(majorTickWidthDp, majorTickHeightDp)
- {
- Gravity = GravityFlags.CenterHorizontal,
- };
-
- majorTickContainer.AddView(label);
- majorTickContainer.AddView(tick);
-
- // Flag the tick as a major tickmark and set it's proportional position along the tick bar
- SetIsMajorTickmark(majorTickContainer, true);
- SetPosition(majorTickContainer, position);
-
- AddView(majorTickContainer);
- _majorTickmarks.Add(majorTickContainer);
- }
- else
- {
- tick.LayoutParameters = new FrameLayout.LayoutParams(majorTickWidthDp, majorTickHeightDp)
- {
- Gravity = GravityFlags.Bottom,
- };
- SetIsMajorTickmark(tick, true);
- SetPosition(tick, position);
-
- AddView(tick);
- _majorTickmarks.Add(tick);
- }
- }
-
- private void ApplyTickLabelFormat(View tickContainer, string? tickLabelFormat)
- {
- // Retrieve the label from the container holding the major tick rectangle and label
- if (tickContainer is ViewGroup group && group.ChildCount > 1 && group.GetChildAt(0) is TextView label)
- {
- // Apply the specified format to the tick's date and update the label
- var labelFormat = string.IsNullOrEmpty(tickLabelFormat) ? _defaultTickLabelFormat : tickLabelFormat;
- var labelDate = DateTimeOffset.FromUnixTimeMilliseconds((long)(label.Tag ?? 0L));
- label.Text = labelDate.ToString(labelFormat);
- }
- }
-
- private void ApplyTickLabelColor(View tick, Color color)
- {
- if (tick is ViewGroup group && group.ChildCount > 1 && group.GetChildAt(0) is TextView label)
- {
- label.SetTextColor(color);
- }
- }
-
- private List _children = new List();
-
- private IEnumerable Children
- {
- get
- {
- _children.Clear();
- for (var i = 0; i < ChildCount; i++)
- {
- var child = GetChildAt(i);
- if (child != null)
- {
- _children.Add(child);
- }
- }
-
- return _children;
- }
- }
-
- private void SetIsMajorTickmark(View view, bool isMajorTickmark)
- {
- UpdatePositionAndIsMajorTickmark(view, GetPosition(view), isMajorTickmark);
- }
-
- private bool GetIsMajorTickmark(View view)
- {
- return (double)(view.Tag ?? 1d) % 10 == 0 ? false : true;
- }
-
- private double GetPosition(View view)
- {
- // Remove last digit as that stores whether the tickmark is major or minor
- var positionDigits = Math.Truncate((double)(view.Tag ?? 1d) / 10);
-
- // Convert remaining digits to decimal value between 0 and 1
- return positionDigits / 10000000;
- }
-
- private void SetPosition(View view, double position)
- {
- UpdatePositionAndIsMajorTickmark(view, position, GetIsMajorTickmark(view));
- }
-
- private void UpdatePositionAndIsMajorTickmark(View view, double position, bool isMajorTickmark)
- {
- // Use the view's tag property to store both the tick's proportional position along the tick bar and whether
- // or not the tick is a major tickmark. Use the first 9 digits to store the position and the last digit to
- // store the flag.
- var storedPosition = Math.Truncate(position * 100000000);
- storedPosition -= storedPosition % 10;
- var tickmarkFlagInt = isMajorTickmark ? 1 : 0;
- var positionAndTickmarkFlag = storedPosition + tickmarkFlagInt;
- view.Tag = positionAndTickmarkFlag;
- }
-
- private Size GetDesiredSize(View view)
- {
- if (view is RectangleView rectangleView)
- {
- return new Size((int)rectangleView.Width, (int)rectangleView.Height);
- }
- else if (view.LayoutParameters != null && view.LayoutParameters.Width > 0 && view.LayoutParameters.Height > 0)
- {
- return new Size(view.LayoutParameters.Width, view.LayoutParameters.Height);
- }
- else if (view is LinearLayout linearLayout && GetIsMajorTickmark(linearLayout) && linearLayout.GetChildAt(0) is TextView label)
- {
- label.Measure((int)MeasureSpecMode.Unspecified, (int)MeasureSpecMode.Unspecified);
- return new Size(label.MeasuredWidth, label.MeasuredHeight);
- }
- else
- {
- view.Measure((int)MeasureSpecMode.Unspecified, (int)MeasureSpecMode.Unspecified);
- return new Size(view.MeasuredWidth, view.MeasuredHeight);
- }
- }
-
- ///
- protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
- {
- base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
-
- InvalidateMeasureAndArrange();
- }
-
- private void InvalidateMeasureAndArrange()
- {
- var layoutWidth = Right - Left;
- var layoutHeight = Bottom - Top;
-
- if (MeasuredWidth == _lastMeasuredWidth
- && MeasuredHeight == _lastMeasuredHeight
- && layoutWidth == _lastLayoutWidth
- && layoutHeight == _lastLayoutHeight
- && ShowTickLabels == _lastLabelsVisible)
- {
- // No change in size or label visibility
- return;
- }
-
- _lastMeasuredWidth = MeasuredWidth;
- _lastMeasuredHeight = MeasuredHeight;
- _lastLayoutWidth = layoutWidth;
- _lastLayoutHeight = layoutHeight;
- _lastLabelsVisible = ShowTickLabels;
-
- var availableWidth = MeasuredWidth - (TickInset * 2);
- OnArrange(new SizeF(availableWidth, MeasuredHeight));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Toolkit/Toolkit.Android/UI/Controls/TimeSlider/TimeSlider.Android.cs b/src/Toolkit/Toolkit.Android/UI/Controls/TimeSlider/TimeSlider.Android.cs
deleted file mode 100644
index 46b0ae3e7..000000000
--- a/src/Toolkit/Toolkit.Android/UI/Controls/TimeSlider/TimeSlider.Android.cs
+++ /dev/null
@@ -1,325 +0,0 @@
-// /*******************************************************************************
-// * Copyright 2012-2018 Esri
-// *
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// ******************************************************************************/
-
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-using Android.Content;
-using Android.Graphics;
-using Android.Runtime;
-
-#if NET6_0_OR_GREATER
-using AndroidX.ConstraintLayout.Widget;
-#else
-using Android.Support.Constraints;
-#endif
-using Android.Util;
-using Android.Views;
-using Android.Widget;
-using Esri.ArcGISRuntime.Toolkit.Internal;
-using Esri.ArcGISRuntime.Toolkit.Primitives;
-
-namespace Esri.ArcGISRuntime.Toolkit.UI.Controls
-{
- [Register("Esri.ArcGISRuntime.Toolkit.UI.Controls.TimeSlider")]
- [DisplayName("Time Slider")]
- [Category("ArcGIS Maps SDK for .NET Controls")]
- public partial class TimeSlider : ConstraintLayout, View.IOnTouchListener
- {
-#pragma warning disable SX1309 // Names match elements in template
-#pragma warning disable SA1306 // Names match elements in template
- private View? SliderTrack;
- private View? SliderTrackOutline;
- private View? MinimumThumb;
- private View? MaximumThumb;
- private View? PinnedMinimumThumb;
- private View? PinnedMaximumThumb;
- private View? HorizontalTrackThumb;
- private Button? NextButton;
- private Button? PreviousButton;
- private View? NextButtonOutline;
- private View? PreviousButtonOutline;
- private ToggleButton? PlayPauseButton;
- private View? PlayButtonOutline;
- private View? PauseButtonOutline;
- private RectangleView? SliderTrackStepBackRepeater = null;
- private RectangleView? SliderTrackStepForwardRepeater = null;
-#pragma warning restore SX1309
-#pragma warning restore SA1306
- private View? _startTimeTickmark;
- private View? _endTimeTickmark;
- private bool _isMinThumbFocused = false;
- private bool _isMaxThumbFocused = false;
- private float _lastX = 0;
- private ThrottleAwaiter _measureThrottler = new ThrottleAwaiter(1);
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- public TimeSlider(Context? context)
- : base(context)
- {
- InitializeImpl();
- Initialize();
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Context the view is running in, through which it can access resources, themes, etc.
- /// The attributes of the AXML element declaring the view.
- public TimeSlider(Context? context, IAttributeSet? attr)
- : base(context, attr)
- {
- InitializeImpl();
- Initialize();
- }
-
- private void InitializeImpl()
- {
- if (DesignTime.IsDesignMode)
- {
- // Add placeholder text
- SetBackgroundColor(Color.LightGray);
- var designTimePlaceholderText = new TextView(Context)
- {
- Text = "Time Slider",
- TextSize = 16,
- Id = 123456789,
- };
- designTimePlaceholderText.SetTextColor(Color.Black);
- AddView(designTimePlaceholderText);
-
- // Center text by constraining it to the edges of the parent view
- var constraintSet = new ConstraintSet();
- constraintSet.Clone(this);
- constraintSet.Connect(designTimePlaceholderText.Id, ConstraintSet.Start, ConstraintSet.ParentId, ConstraintSet.Start);
- constraintSet.Connect(designTimePlaceholderText.Id, ConstraintSet.End, ConstraintSet.ParentId, ConstraintSet.End);
- constraintSet.Connect(designTimePlaceholderText.Id, ConstraintSet.Top, ConstraintSet.ParentId, ConstraintSet.Top, 15);
- constraintSet.Connect(designTimePlaceholderText.Id, ConstraintSet.Bottom, ConstraintSet.ParentId, ConstraintSet.Bottom, 15);
- constraintSet.ApplyTo(this);
-
-#pragma warning disable CS8774 // Member must have a non-null value when exiting.
- return;
-#pragma warning restore CS8774 // Member must have a non-null value when exiting.
- }
-
- var inflater = LayoutInflater.FromContext(Context!);
- inflater?.Inflate(Resource.Layout.TimeSlider, this, true);
-
- SliderTrack = FindViewById(Resource.Id.SliderTrack);
- SliderTrackOutline = FindViewById(Resource.Id.SliderTrackOutline);
- FullExtentStartTimeLabel = FindViewById(Resource.Id.FullExtentStartTimeLabel);
- FullExtentEndTimeLabel = FindViewById(Resource.Id.FullExtentEndTimeLabel);
- MinimumThumb = FindViewById(Resource.Id.MinThumb);
- MaximumThumb = FindViewById(Resource.Id.MaxThumb);
- MinimumThumbLabel = FindViewById(Resource.Id.CurrentExtentStartTimeLabel);
- MaximumThumbLabel = FindViewById(Resource.Id.CurrentExtentEndTimeLabel);
- PinnedMinimumThumb = FindViewById(Resource.Id.PinnedMinThumb);
- PinnedMaximumThumb = FindViewById(Resource.Id.PinnedMaxThumb);
- HorizontalTrackThumb = FindViewById(Resource.Id.CurrentExtentFill);
- Tickmarks = FindViewById(Resource.Id.Tickmarks);
- PlayPauseButton = FindViewById(Resource.Id.PlayPauseButton);
- PlayButtonOutline = FindViewById(Resource.Id.PlayButtonOutline);
- PauseButtonOutline = FindViewById(Resource.Id.PauseButtonOutline);
- NextButton = FindViewById