Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexander Reyes alexrainman

View GitHub Profile
@alexrainman
alexrainman / ITextMeter
Last active Aug 1, 2022
Calculate Xamarin.Forms label height by amount of text
View ITextMeter
namespace YourNamespace
{
public interface ITextMeter
{
double MeasureTextSize(string text, double width, double fontSize, string fontName = null);
}
}
View ScrollListView.java
package se.marteinn.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.AbsListView;
import android.widget.ListView;
/**
* Triggers a event when scrolling reaches bottom.
@alexrainman
alexrainman / SlidingAppCompatActivity
Last active Aug 29, 2015
SlidingMenuSharp AppCompat Activity for Xamarin.Android.Support.v7.AppCompat 22.2.*
View SlidingAppCompatActivity
using System;
using Android.OS;
using Android.Views;
using SlidingMenuSharp.App;
using SlidingMenuSharp;
using Android.Support.V7.App;
namespace YourNameSpace
{
@alexrainman
alexrainman / UIViewWithBorders.cs
Last active Apr 25, 2019
Xamarin iOS UIView with borders
View UIViewWithBorders.cs
using System;
using UIKit;
using CoreGraphics;
// ported from https://github.com/natrosoft/NAUIViewWithBorders
namespace YourNamespace
{
/*
UIView subview that allows individual borders to be drawn.
@alexrainman
alexrainman / DPageViewController.cs
Last active Aug 29, 2015
Dynamic UIViewPageController for Xamarin iOS
View DPageViewController.cs
using System;
using UIKit;
using System.Collections.Generic;
using CoreGraphics;
// ported from https://github.com/nsobadzhiev/DynamicPageViewController/blob/master/DynamicPageViewController/DMDynamicViewController.swift
namespace YourNamespace
{
/*protocol DMDynamicPageViewControllerDelegate {
@alexrainman
alexrainman / LightMeter.cs
Last active Mar 16, 2022
Xamarin Android light sensor class (easy portable to Java)
View LightMeter.cs
using System;
using Android.Graphics;
using Android.Hardware;
using Android.Media;
using Java.IO;
using YourNamespace.Utils;
namespace YourNamespace
{
public class LightMeter: Java.Lang.Object, Android.Hardware.Camera.IPictureCallback, Android.Hardware.Camera.IPreviewCallback
@alexrainman
alexrainman / Connectivity.cs
Last active Jul 19, 2022 — forked from emil2k/Connectivity.java
Check device's network connectivity and speed for Xamarin.Android
View Connectivity.cs
using System.Threading;
using Android.Content;
using Android.Net;
using Android.Telephony;
using Java.IO;
using Java.Net;
namespace YourNamespace {
/**
View Responsive PieChart with custom tooltip
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<style>
#piechart {
top: 0;
left: 0;
width:100%;
height:100%;