This file contains hidden or 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 Android.Content; | |
using Cirrious.MvvmCross.Binding.BindingContext; | |
using Cirrious.MvvmCross.Binding.Droid.BindingContext; | |
using Cirrious.MvvmCross.ViewModels; | |
using MeetupManager.Droid.Helpers; | |
using Cirrious.MvvmCross.Droid.Views; | |
namespace MyProject | |
{ | |
public abstract class MvxActionBarActivity |
This file contains hidden or 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 Task<T> DeserializeObjectAsync<T>(string value) | |
{ | |
return Task.Factory.StartNew (() => JsonConvert.DeserializeObject<T> (value)) | |
} | |
public T DeserializeObject<T>(string value) | |
{ | |
return JsonConvert.DeserializeObject<T>(value); |
This file contains hidden or 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 Android.App; | |
using Android.Content; | |
using Android.Runtime; | |
using Android.Views; | |
using Android.Widget; | |
using Android.OS; | |
using Android.Support.V4.View; | |
namespace XamarinCast |
This file contains hidden or 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 Android.App; | |
using Android.OS; | |
namespace Notepad | |
{ | |
[Activity (Label = "Notepad", MainLauncher = true, Theme="@android:style/Theme.Holo.Light")] | |
public class MainActivity : MvxActivity | |
{ | |
int count = 1; |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<runtime> | |
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | |
<dependentAssembly> | |
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="2.0.5.0" /> | |
</dependentAssembly> | |
</assemblyBinding> | |
</runtime> |
This file contains hidden or 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 HttpClientHelper : IHttpClientHelper | |
{ | |
private HttpMessageHandler handler; | |
public HttpMessageHandler MessageHandler | |
{ | |
get { return handler ?? (handler = new OkHttpNetworkHandler()); } | |
} | |
} |
This file contains hidden or 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
private IHttpClientHelper httpClientHelper; | |
public MyService() | |
{ | |
this.httpClientHelper = ServiceContainer.Resolve<IHttpClientHelper>(); //does not exist on WP | |
} | |
private HttpClient CreateClient() | |
{ | |
if(httpClientHelper == null) | |
return new HttpClient(); |
This file contains hidden or 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 MvxSwipeRefreshLayout : SwipeRefreshLayout | |
{ | |
/// <summary> | |
/// Gets or sets the refresh command. | |
/// </summary> | |
/// <value>The refresh command.</value> | |
public ICommand RefreshCommand { get; set;} | |
public MvxSwipeRefreshLayout(Context context, IAttributeSet attrs) | |
: base(context, attrs) |
This file contains hidden or 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
private int stepCounter = 0; | |
private int counterSteps = 0; | |
private int stepDetector = 0; | |
public void OnSensorChanged (SensorEvent e) | |
{ | |
switch (e.Sensor.Type) { | |
case SensorType.StepDetector: | |
stepDetector++; | |
break; |
This file contains hidden or 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 override void OnStart (Intent intent, int startId) | |
{ | |
base.OnStart (intent, startId); | |
if (isRunning || !Utils.IsKitKatWithStepCounter(PackageManager)) | |
return; | |
RegisterListeners (SensorType.StepCounter); | |
} | |