This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on http://stackoverflow.com/a/19221385/500976 | |
// In Setup.cs: | |
// protected override void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry) | |
// { | |
// base.FillTargetFactories(registry); | |
// registry.RegisterCustomBindingFactory("FocusText", (UITextField textField) => new FocusTextBinding(textField)); | |
// } | |
using System; | |
using Cirrious.MvvmCross.Binding; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Android.App; | |
using Android.Content; | |
using Cirrious.MvvmCross.Binding.BindingContext; | |
using Cirrious.MvvmCross.Binding.Droid.BindingContext; | |
using Cirrious.MvvmCross.Droid.Views; | |
using Cirrious.MvvmCross.ViewModels; | |
namespace ECC.Mobile.Droid.Views |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class MvxActionBarFragmentActivity : MvxActionBarEventSource, IMvxAndroidView, IMvxEventSourceFragmentActivity | |
{ | |
private readonly List<WeakReference<Fragment>> _fragments = new List<WeakReference<Fragment>>(); | |
public object DataContext | |
{ | |
get { return BindingContext.DataContext; } | |
set { BindingContext.DataContext = value; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MvxActionBarEventSource : ActionBarActivity, IMvxEventSourceActivity | |
{ | |
public event EventHandler DisposeCalled; | |
public event EventHandler<MvxValueEventArgs<Bundle>> CreateWillBeCalled; | |
public event EventHandler<MvxValueEventArgs<Bundle>> CreateCalled; | |
public event EventHandler DestroyCalled; | |
public event EventHandler<MvxValueEventArgs<Intent>> NewIntentCalled; | |
public event EventHandler ResumeCalled; | |
public event EventHandler PauseCalled; | |
public event EventHandler StartCalled; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IMvxEventSourceFragmentActivity : IMvxEventSourceActivity | |
{ | |
IList<Fragment> Fragments { get; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MvxCachingFragmentActivityBehavior | |
: MvxBaseActivityAdapter | |
{ | |
private const string SavedFragmentTypesKey = "__mvxSavedFragmentTypes"; | |
private const string SavedCurrentFragmentsKey = "__mvxSavedCurrentFragments"; | |
private readonly Dictionary<string, FragmentInfo> _lookup = new Dictionary<string, FragmentInfo>(); | |
private Dictionary<int, string> _currentFragments = new Dictionary<int, string>(); | |
IList<Fragment> Fragments { get { return ((IMvxEventSourceFragmentActivity)Activity).Fragments; } } | |
FragmentManager FragmentManager { get { return Activity.FragmentManager; } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StoryBoardContainer : MvxTouchViewsContainer | |
{ | |
protected override IMvxTouchView CreateViewOfType(Type viewType, MvxViewModelRequest request) | |
{ | |
var storyboardAttribute = viewType.GetCustomAttribute<FromStoryboardAttribute>(); | |
if (storyboardAttribute != null) { | |
var storyboard = UIStoryboard.FromName(storyboardAttribute.StoryboardName ?? viewType.Name, null); | |
var viewController = storyboard.InstantiateViewController(viewType.Name); | |
return (IMvxTouchView) viewController; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Shortcuts for JSend JSON API (http://labs.omniti.com/labs/jsend) | |
* @author Geir Sagberg | |
*/ | |
export function fail(data) { | |
return { | |
status: 'fail', | |
data | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// ObservableCollection that exposes an event ItemPropertyChanged that fires whenever an item in the collection changes | |
/// </summary> | |
public class BindingCollection<T> : ObservableCollection<T> | |
where T : INotifyPropertyChanged | |
{ | |
public BindingCollection() | |
{ | |
CollectionChanged += OnCollectionChanged; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SubscriptionManager | |
{ | |
private Dictionary<Type, MvxSubscriptionToken> subscriptions = new Dictionary<Type, MvxSubscriptionToken>(); | |
public IMvxMessenger Messenger { get; set; } | |
public SubscriptionManager(IMvxMessenger messenger) | |
{ | |
Messenger = messenger; | |
} |