summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/Cells
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-04-12 08:53:36 -0700
committerJason Smith <jason.smith@xamarin.com>2016-04-12 08:53:36 -0700
commitba2a434ec13370cc4814b54f6ce51d4d16594f97 (patch)
treece0d082e4e114fa689e7c5eee3da9d892b11f49c /Xamarin.Forms.Platform.Android/Cells
parent0a20bdaa3c373ec303c9a94ae45ecaa144996ba5 (diff)
downloadxamarin-forms-ba2a434ec13370cc4814b54f6ce51d4d16594f97.tar.gz
xamarin-forms-ba2a434ec13370cc4814b54f6ce51d4d16594f97.tar.bz2
xamarin-forms-ba2a434ec13370cc4814b54f6ce51d4d16594f97.zip
Add compatibility shims to fix warnings; annotate warnings which require (#75)
more thought to fix; Fix a few more warnings VS didn't see fit to raise as errors Adding comments to `pragma warning disable` statements pragma comments Fix typo Set TabletMasterDetailRenderer back to previous version Fix incorrect config access in legacy activity
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Cells')
-rw-r--r--Xamarin.Forms.Platform.Android/Cells/BaseCellView.cs28
-rw-r--r--Xamarin.Forms.Platform.Android/Cells/EntryCellView.cs4
2 files changed, 10 insertions, 22 deletions
diff --git a/Xamarin.Forms.Platform.Android/Cells/BaseCellView.cs b/Xamarin.Forms.Platform.Android/Cells/BaseCellView.cs
index 60267c3e..1457075b 100644
--- a/Xamarin.Forms.Platform.Android/Cells/BaseCellView.cs
+++ b/Xamarin.Forms.Platform.Android/Cells/BaseCellView.cs
@@ -2,6 +2,7 @@ using System.IO;
using System.Threading.Tasks;
using Android.Content;
using Android.Graphics;
+using Android.Support.V4.Content;
using Android.Text;
using Android.Views;
using Android.Widget;
@@ -39,9 +40,7 @@ namespace Xamarin.Forms.Platform.Android
SetPadding(padding, padding, padding, padding);
_imageView = new ImageView(context);
-#pragma warning disable 618
- var imageParams = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.FillParent)
-#pragma warning restore 618
+ var imageParams = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent)
{
Width = (int)context.ToPixels(60),
Height = (int)context.ToPixels(60),
@@ -57,13 +56,9 @@ namespace Xamarin.Forms.Platform.Android
_mainText.SetSingleLine(true);
_mainText.Ellipsize = TextUtils.TruncateAt.End;
_mainText.SetPadding((int)context.ToPixels(15), padding, padding, padding);
-#pragma warning disable 618
- _mainText.SetTextAppearance(context, global::Android.Resource.Attribute.TextAppearanceListItem);
-#pragma warning restore 618
+ _mainText.SetTextAppearanceCompat(context, global::Android.Resource.Attribute.TextAppearanceListItem);
-#pragma warning disable 618
- using (var lp = new LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent))
-#pragma warning restore 618
+ using (var lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent))
textLayout.AddView(_mainText, lp);
_detailText = new TextView(context);
@@ -71,13 +66,9 @@ namespace Xamarin.Forms.Platform.Android
_detailText.Ellipsize = TextUtils.TruncateAt.End;
_detailText.SetPadding((int)context.ToPixels(15), padding, padding, padding);
_detailText.Visibility = ViewStates.Gone;
-#pragma warning disable 618
- _detailText.SetTextAppearance(context, global::Android.Resource.Attribute.TextAppearanceListItemSmall);
-#pragma warning restore 618
+ _detailText.SetTextAppearanceCompat(context, global::Android.Resource.Attribute.TextAppearanceListItemSmall);
-#pragma warning disable 618
- using (var lp = new LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent))
-#pragma warning restore 618
+ using (var lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent))
textLayout.AddView(_detailText, lp);
var layoutParams = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent) { Width = 0, Weight = 1, Gravity = GravityFlags.Center };
@@ -130,9 +121,7 @@ namespace Xamarin.Forms.Platform.Android
if (view != null)
{
-#pragma warning disable 618
- using (var layout = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.FillParent))
-#pragma warning restore 618
+ using (var layout = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent))
AddView(view, layout);
AccessoryView = view;
@@ -209,8 +198,9 @@ namespace Xamarin.Forms.Platform.Android
catch (TaskCanceledException)
{
}
- catch (IOException e)
+ catch (IOException ex)
{
+ Log.Warning("Xamarin.Forms.Platform.Android.BaseCellView", "Error updating bitmap: {0}", ex);
}
}
diff --git a/Xamarin.Forms.Platform.Android/Cells/EntryCellView.cs b/Xamarin.Forms.Platform.Android/Cells/EntryCellView.cs
index c1ae1911..0380a31a 100644
--- a/Xamarin.Forms.Platform.Android/Cells/EntryCellView.cs
+++ b/Xamarin.Forms.Platform.Android/Cells/EntryCellView.cs
@@ -29,9 +29,7 @@ namespace Xamarin.Forms.Platform.Android
SetPadding((int)context.ToPixels(15), padding, padding, padding);
_label = new TextView(context);
-#pragma warning disable 618
- _label.SetTextAppearance(context, global::Android.Resource.Attribute.TextAppearanceListItem);
-#pragma warning restore 618
+ _label.SetTextAppearanceCompat(context, global::Android.Resource.Attribute.TextAppearanceListItem);
var layoutParams = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) { Gravity = GravityFlags.CenterVertical };
using (layoutParams)