No nested classes and no default access modifiers

This commit is contained in:
Matthew Leibowitz 2018-04-11 19:45:59 +02:00
Родитель f946220ffa
Коммит 8f2a1b8abd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 3650EBE4AA155AF9
12 изменённых файлов: 83 добавлений и 82 удалений

Просмотреть файл

@ -44,6 +44,7 @@ dotnet_style_qualification_for_event = false:suggestion
# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_require_accessibility_modifiers = omit_if_default:warning
# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion

Просмотреть файл

@ -7,7 +7,7 @@ namespace DeviceTests
{
public class FileSystem_Tests
{
private const string bundleFileContents = "This file was in the app bundle.";
const string bundleFileContents = "This file was in the app bundle.";
[Fact]
public void CacheDirectory_Is_Valid()

Просмотреть файл

@ -6,7 +6,7 @@ using XUnitFilter = UnitTests.HeadlessRunner.Xunit.XUnitFilter;
namespace DeviceTests
{
internal static class Traits
static class Traits
{
public const string DeviceType = "DeviceType";
public const string InteractionType = "InteractionType";

Просмотреть файл

@ -8,14 +8,14 @@ using SystemConfiguration;
namespace Xamarin.Essentials
{
internal enum NetworkStatus
enum NetworkStatus
{
NotReachable,
ReachableViaCarrierDataNetwork,
ReachableViaWiFiNetwork
}
internal static class Reachability
static class Reachability
{
static string hostName = "www.microsoft.com";

Просмотреть файл

@ -31,23 +31,23 @@ namespace Xamarin.Essentials
return vc.PresentViewControllerAsync(activityController, true);
}
class ShareActivityItemSource : UIActivityItemSource
{
NSObject item;
string subject;
public ShareActivityItemSource(NSObject item, string subject)
{
this.item = item;
this.subject = subject;
}
public override NSObject GetItemForActivity(UIActivityViewController activityViewController, NSString activityType) => item;
public override NSObject GetPlaceholderData(UIActivityViewController activityViewController) => item;
public override string GetSubjectForActivity(UIActivityViewController activityViewController, NSString activityType) => subject;
}
}
class ShareActivityItemSource : UIActivityItemSource
{
NSObject item;
string subject;
public ShareActivityItemSource(NSObject item, string subject)
{
this.item = item;
this.subject = subject;
}
public override NSObject GetItemForActivity(UIActivityViewController activityViewController, NSString activityType) => item;
public override NSObject GetPlaceholderData(UIActivityViewController activityViewController) => item;
public override string GetSubjectForActivity(UIActivityViewController activityViewController, NSString activityType) => subject;
}s
}

Просмотреть файл

@ -184,18 +184,18 @@ namespace Xamarin.Essentials
static string GetSystemSetting(string name)
=> Settings.System.GetString(Essentials.Platform.CurrentContext.ContentResolver, name);
}
class Listener : OrientationEventListener
class Listener : OrientationEventListener
{
Action onChanged;
public Listener(Context context, Action handler)
: base(context)
{
Action onChanged;
public Listener(Context context, Action handler)
: base(context)
{
onChanged = handler;
}
public override void OnOrientationChanged(int orientation) => onChanged();
onChanged = handler;
}
public override void OnOrientationChanged(int orientation) => onChanged();
}
}

Просмотреть файл

@ -87,35 +87,6 @@ namespace Xamarin.Essentials
}
}
class SingleLocationListener : Java.Lang.Object, ILocationListener
{
bool wasRaised = false;
public Action<AndroidLocation> LocationHandler { get; set; }
public void OnLocationChanged(AndroidLocation location)
{
if (wasRaised)
return;
wasRaised = true;
LocationHandler?.Invoke(location);
}
public void OnProviderDisabled(string provider)
{
}
public void OnProviderEnabled(string provider)
{
}
public void OnStatusChanged(string provider, [GeneratedEnum] Availability status, Bundle extras)
{
}
}
static string GetBestProvider(LocationManager locationManager, GeolocationAccuracy accuracy)
{
var criteria = new Criteria();
@ -191,4 +162,33 @@ namespace Xamarin.Essentials
return false;
}
}
class SingleLocationListener : Java.Lang.Object, ILocationListener
{
bool wasRaised = false;
public Action<AndroidLocation> LocationHandler { get; set; }
public void OnLocationChanged(AndroidLocation location)
{
if (wasRaised)
return;
wasRaised = true;
LocationHandler?.Invoke(location);
}
public void OnProviderDisabled(string provider)
{
}
public void OnProviderEnabled(string provider)
{
}
public void OnStatusChanged(string provider, [GeneratedEnum] Availability status, Bundle extras)
{
}
}
}

Просмотреть файл

@ -66,27 +66,27 @@ namespace Xamarin.Essentials
tcs.TrySetResult(null);
}
}
}
class SingleLocationListener : CLLocationManagerDelegate
class SingleLocationListener : CLLocationManagerDelegate
{
bool wasRaised = false;
public Action<CLLocation> LocationHandler { get; set; }
public override void LocationsUpdated(CLLocationManager manager, CLLocation[] locations)
{
bool wasRaised = false;
if (wasRaised)
return;
public Action<CLLocation> LocationHandler { get; set; }
wasRaised = true;
public override void LocationsUpdated(CLLocationManager manager, CLLocation[] locations)
{
if (wasRaised)
return;
var location = locations.LastOrDefault();
wasRaised = true;
if (location == null)
return;
var location = locations.LastOrDefault();
if (location == null)
return;
LocationHandler?.Invoke(location);
}
LocationHandler?.Invoke(location);
}
}
}

Просмотреть файл

@ -10,7 +10,7 @@ using Android.Support.V4.Content;
namespace Xamarin.Essentials
{
internal static partial class Permissions
static partial class Permissions
{
static readonly object locker = new object();
static int requestCode = 0;
@ -133,7 +133,7 @@ namespace Xamarin.Essentials
}
}
internal static class PermissionTypeExtensions
static class PermissionTypeExtensions
{
internal static IEnumerable<string> ToAndroidPermissions(this PermissionType permissionType, bool onlyRuntimePermissions)
{

Просмотреть файл

@ -1,6 +1,6 @@
namespace Xamarin.Essentials
{
internal enum PermissionStatus
enum PermissionStatus
{
// Denied by user
Denied,
@ -18,7 +18,7 @@
Unknown
}
internal enum PermissionType
enum PermissionType
{
Unknown,
Battery,

Просмотреть файл

@ -65,7 +65,7 @@ namespace Xamarin.Essentials
}
}
internal static class PermissionTypeExtensions
static class PermissionTypeExtensions
{
internal static string[] ToUWPCapabilities(this PermissionType permissionType)
{

Просмотреть файл

@ -5,7 +5,7 @@ namespace Xamarin.Essentials
{
[AttributeUsage(AttributeTargets.All)]
[EditorBrowsable(EditorBrowsableState.Never)]
internal sealed class PreserveAttribute : Attribute
sealed class PreserveAttribute : Attribute
{
#pragma warning disable SA1401 // Fields should be private
public bool AllMembers;