Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/ReactiveUI.AndroidSupport/ControlFetcherMixin.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand All @@ -7,8 +7,6 @@
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using Android.App;
using Android.Views;
using Java.Interop;
using Android.Support.V7.App;
Expand Down
53 changes: 15 additions & 38 deletions src/ReactiveUI.AndroidSupport/ReactiveAppCompatActivity.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Reactive.Threading.Tasks;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Support.V7.App;
using Android.Views;
using Android.Widget;
using Splat;

namespace ReactiveUI.AndroidSupport
{
Expand All @@ -42,14 +28,14 @@ protected ReactiveAppCompatActivity() { }
TViewModel _ViewModel;
public TViewModel ViewModel
{
get { return _ViewModel; }
set { this.RaiseAndSetIfChanged(ref _ViewModel, value); }
get => _ViewModel;
set => this.RaiseAndSetIfChanged(ref _ViewModel, value);
}

object IViewFor.ViewModel
{
get { return _ViewModel; }
set { _ViewModel = (TViewModel)value; }
get => _ViewModel;
set => _ViewModel = (TViewModel)value;
}
}

Expand All @@ -61,8 +47,8 @@ public class ReactiveAppCompatActivity : AppCompatActivity, IReactiveObject, IRe
{
public event PropertyChangingEventHandler PropertyChanging
{
add { PropertyChangingEventManager.AddHandler(this, value); }
remove { PropertyChangingEventManager.RemoveHandler(this, value); }
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}

void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
Expand All @@ -72,8 +58,8 @@ void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)

public event PropertyChangedEventHandler PropertyChanged
{
add { PropertyChangedEventManager.AddHandler(this, value); }
remove { PropertyChangedEventManager.RemoveHandler(this, value); }
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}

void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
Expand All @@ -85,18 +71,12 @@ void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
/// Represents an Observable that fires *before* a property is about to
/// be changed.
/// </summary>
public IObservable<IReactivePropertyChangedEventArgs<ReactiveAppCompatActivity>> Changing
{
get { return this.getChangingObservable(); }
}
public IObservable<IReactivePropertyChangedEventArgs<ReactiveAppCompatActivity>> Changing => this.getChangingObservable();

/// <summary>
/// Represents an Observable that fires *after* a property has changed.
/// </summary>
public IObservable<IReactivePropertyChangedEventArgs<ReactiveAppCompatActivity>> Changed
{
get { return this.getChangedObservable(); }
}
public IObservable<IReactivePropertyChangedEventArgs<ReactiveAppCompatActivity>> Changed => this.getChangedObservable();

protected ReactiveAppCompatActivity() { }

Expand All @@ -116,13 +96,13 @@ public IDisposable SuppressChangeNotifications()
return this.suppressChangeNotifications();
}

public IObservable<Exception> ThrownExceptions { get { return this.getThrownExceptionsObservable(); } }
public IObservable<Exception> ThrownExceptions => this.getThrownExceptionsObservable();

readonly Subject<Unit> activated = new Subject<Unit>();
public IObservable<Unit> Activated { get { return activated.AsObservable(); } }
public IObservable<Unit> Activated => activated.AsObservable();

readonly Subject<Unit> deactivated = new Subject<Unit>();
public IObservable<Unit> Deactivated { get { return deactivated.AsObservable(); } }
public IObservable<Unit> Deactivated => deactivated.AsObservable();

protected override void OnPause()
{
Expand All @@ -137,10 +117,7 @@ protected override void OnResume()
}

readonly Subject<Tuple<int, Result, Intent>> activityResult = new Subject<Tuple<int, Result, Intent>>();
public IObservable<Tuple<int, Result, Intent>> ActivityResult
{
get { return activityResult.AsObservable(); }
}
public IObservable<Tuple<int, Result, Intent>> ActivityResult => activityResult.AsObservable();

protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
Expand Down
36 changes: 15 additions & 21 deletions src/ReactiveUI.AndroidSupport/ReactiveDialogFragment.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand All @@ -22,14 +22,14 @@ protected ReactiveDialogFragment() { }
TViewModel _ViewModel;
public TViewModel ViewModel
{
get { return _ViewModel; }
set { this.RaiseAndSetIfChanged(ref _ViewModel, value); }
get => _ViewModel;
set => this.RaiseAndSetIfChanged(ref _ViewModel, value);
}

object IViewFor.ViewModel
{
get { return _ViewModel; }
set { _ViewModel = (TViewModel)value; }
get => _ViewModel;
set => _ViewModel = (TViewModel)value;
}
}

Expand All @@ -43,8 +43,8 @@ protected ReactiveDialogFragment() { }

public event PropertyChangingEventHandler PropertyChanging
{
add { PropertyChangingEventManager.AddHandler(this, value); }
remove { PropertyChangingEventManager.RemoveHandler(this, value); }
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}

void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
Expand All @@ -54,8 +54,8 @@ void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)

public event PropertyChangedEventHandler PropertyChanged
{
add { PropertyChangedEventManager.AddHandler(this, value); }
remove { PropertyChangedEventManager.RemoveHandler(this, value); }
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}

void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
Expand All @@ -67,18 +67,12 @@ void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
/// Represents an Observable that fires *before* a property is about to
/// be changed.
/// </summary>
public IObservable<IReactivePropertyChangedEventArgs<ReactiveDialogFragment>> Changing
{
get { return this.getChangingObservable(); }
}
public IObservable<IReactivePropertyChangedEventArgs<ReactiveDialogFragment>> Changing => this.getChangingObservable();

/// <summary>
/// Represents an Observable that fires *after* a property has changed.
/// </summary>
public IObservable<IReactivePropertyChangedEventArgs<ReactiveDialogFragment>> Changed
{
get { return this.getChangedObservable(); }
}
public IObservable<IReactivePropertyChangedEventArgs<ReactiveDialogFragment>> Changed => this.getChangedObservable();

/// <summary>
/// When this method is called, an object will not fire change
Expand All @@ -92,13 +86,13 @@ public IDisposable SuppressChangeNotifications()
return this.suppressChangeNotifications();
}

public IObservable<Exception> ThrownExceptions { get { return this.getThrownExceptionsObservable(); } }
public IObservable<Exception> ThrownExceptions => this.getThrownExceptionsObservable();

readonly Subject<Unit> activated = new Subject<Unit>();
public IObservable<Unit> Activated { get { return activated.AsObservable(); } }
public IObservable<Unit> Activated => activated.AsObservable();

readonly Subject<Unit> deactivated = new Subject<Unit>();
public IObservable<Unit> Deactivated { get { return deactivated.AsObservable(); } }
public IObservable<Unit> Deactivated => deactivated.AsObservable();

public override void OnPause()
{
Expand All @@ -112,4 +106,4 @@ public override void OnResume()
activated.OnNext(Unit.Default);
}
}
}
}
52 changes: 15 additions & 37 deletions src/ReactiveUI.AndroidSupport/ReactiveFragment.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;
using System.Runtime.Serialization;
using System.ComponentModel;
using System.Reflection;
using System.Reactive.Subjects;
using System.Reactive.Concurrency;
using System.Threading;
using System.Reactive.Disposables;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using Splat;
using System.Reactive;
using System.Reactive.Linq;

Expand All @@ -39,13 +21,13 @@ protected ReactiveFragment() { }

TViewModel _ViewModel;
public TViewModel ViewModel {
get { return _ViewModel; }
set { this.RaiseAndSetIfChanged(ref _ViewModel, value); }
get => _ViewModel;
set => this.RaiseAndSetIfChanged(ref _ViewModel, value);
}

object IViewFor.ViewModel {
get { return _ViewModel; }
set { _ViewModel = (TViewModel)value; }
get => _ViewModel;
set => _ViewModel = (TViewModel)value;
}
}

Expand All @@ -58,8 +40,8 @@ public class ReactiveFragment : global::Android.Support.V4.App.Fragment, IReacti
protected ReactiveFragment() { }

public event PropertyChangingEventHandler PropertyChanging {
add { PropertyChangingEventManager.AddHandler(this, value); }
remove { PropertyChangingEventManager.RemoveHandler(this, value); }
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}

void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
Expand All @@ -68,8 +50,8 @@ void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
}

public event PropertyChangedEventHandler PropertyChanged {
add { PropertyChangedEventManager.AddHandler(this, value); }
remove { PropertyChangedEventManager.RemoveHandler(this, value); }
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}

void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
Expand All @@ -81,36 +63,32 @@ void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
/// Represents an Observable that fires *before* a property is about to
/// be changed.
/// </summary>
public IObservable<IReactivePropertyChangedEventArgs<ReactiveFragment>> Changing {
get { return this.getChangingObservable(); }
}
public IObservable<IReactivePropertyChangedEventArgs<ReactiveFragment>> Changing => this.getChangingObservable();

/// <summary>
/// Represents an Observable that fires *after* a property has changed.
/// </summary>
public IObservable<IReactivePropertyChangedEventArgs<ReactiveFragment>> Changed {
get { return this.getChangedObservable(); }
}
public IObservable<IReactivePropertyChangedEventArgs<ReactiveFragment>> Changed => this.getChangedObservable();

/// <summary>
/// When this method is called, an object will not fire change
/// notifications (neither traditional nor Observable notifications)
/// until the return value is disposed.
/// </summary>
/// <returns>An object that, when disposed, reenables change
/// <returns>An object that, when disposed, re-enables change
/// notifications.</returns>
public IDisposable SuppressChangeNotifications()
{
return this.suppressChangeNotifications();
}

public IObservable<Exception> ThrownExceptions { get { return this.getThrownExceptionsObservable(); } }
public IObservable<Exception> ThrownExceptions => this.getThrownExceptionsObservable();

readonly Subject<Unit> activated = new Subject<Unit>();
public IObservable<Unit> Activated { get { return activated.AsObservable(); } }
public IObservable<Unit> Activated => activated.AsObservable();

readonly Subject<Unit> deactivated = new Subject<Unit>();
public IObservable<Unit> Deactivated { get { return deactivated.AsObservable(); } }
public IObservable<Unit> Deactivated => deactivated.AsObservable();

public override void OnPause()
{
Expand Down
Loading