Skip to content

Instantly share code, notes, and snippets.

@cjlotz
cjlotz / GenerateParameter.cs
Created Oct 25, 2018
Issue with content types
View GenerateParameter.cs
private async Task<SwaggerParameter> AddBodyParameterAsync(ResourceActionProcessorContext context, ResourceActionParameterDescriptor apiParameter)
{
var operation = context.OperationDescription.Operation;
JsonSchema4 schema = await GenerateSchema(context, apiParameter);
string contentType = context.ResourceAction.Action.Request.ContentType;
// NOTE CL: Workaround for bug in NSwag that overrides the custom content type - https://github.com/RSuter/NSwag/issues/1681
// By adding a Body parameter upfront instead of it being added implicitly when setting the operation.RequestBody, we
// prevent NSwag of overwriting our custom content type into application/json
View ITTextInputLayout_Ctor_Themed.cs
public class ITTextInputLayout : TextInputLayout, IITComposite
{
public ITTextInputLayout(Context context) : this(context, null)
{
}
public ITTextInputLayout(Context context, IAttributeSet attrs) : this(context, attrs, Resource.Styleable.ITControls_ItcTextInputLayoutStyle)
{
}
View ITTextLayout_Full.cs
using Android.Content;
using Android.Util;
using Android.Support.Design.Widget;
using Android.Runtime;
using System;
using Android.Views;
using Android.Content.Res;
using Android.Text;
using Android.Views.InputMethods;
View ITTextInputLayout_TextChanged.cs
private bool _subscribed;
public EventHandler TextChanged;
protected override void OnAttachedToWindow()
{
base.OnAttachedToWindow();
Control.AfterTextChanged += HandleAfterTextChanged;
_subscribed = true;
View ITTextInputLayout_Properties.cs
public string Text
{
get { return Control.Text; }
set { Control.Text = value; }
}
public int MaxLines
{
get { return Control.MaxLines; }
set { Control.SetMaxLines(value); }
View IITComposite.cs
public interface IITComposite
{
string Error { get; set; }
string Header { get; set; }
string Text { get; set; }
}
View ITTextInputLayout_NewLayoutAlt.xml
<intouch.controls.ITTextInputLayout
android:id="@+id/layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
app:ItcHeader="Password"/>
View ITTextInputLayout_ControlLayout.xml
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</merge>
View ITTextInputLayout_NewLayout.xml
<intouch.controls.ITTextInputLayout
android:id="@+id/layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
app:MvxLang="Header LabelPassword"
app:MvxBind="Text Password; Error Errors[Password] Converter=ErrorsToString"/>
View ITTextInputLayout_OldLayout.xml
<android.support.design.widget.TextInputLayout
android:id="@+id/layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:MvxLang="Hint LabelPassword">
<android.support.design.widget.TextInputEditText
android:id="@+id/control_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"