Skip to content

Instantly share code, notes, and snippets.

Alex Lau alexlau811

Block or report user

Report or block alexlau811

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alexlau811
alexlau811 / gamedev1.js
Created Apr 21, 2015
Code Avengers Sample Code
View gamedev1.js
// Help message
new Game.Text('Warrior! Grab all', 50, 0);
new Game.Text('Hong Kong 1 Dollar to save the world!!', 50, 25);
// Setup player & guns
function createPlayer1() {
var player = new Game.Player(0, 0, '/image/game/player1.png');
player.onKilled = createPlayer1;
@alexlau811
alexlau811 / OverrideFormattedStringExtension.cs
Created Mar 8, 2015
Override default FormattedString behaviour to allow custom font to be used in Label of Xamarin.Forms.Android
View OverrideFormattedStringExtension.cs
public static class OverrideFormattedStringExtension
{
//
// Static Methods
//
public static SpannableString ToAttributed(this FormattedString formattedString, Font defaultFont, Color defaultForegroundColor, TextView view)
{
if (formattedString == null)
{
return null;
@alexlau811
alexlau811 / AnimationNavigationRenderer.cs
Created Feb 25, 2015
A custom renderer to set custom animation for NavigationPage.PushAsync and NavigationPage.PopAsync on iOS with Xamarin Forms.
View AnimationNavigationRenderer.cs
[assembly: ExportRenderer(typeof(NavigationPage), typeof(AnimationNavigationRenderer))]
class AnimationNavigationRenderer : NavigationRenderer
{
public override void PushViewController(UIViewController viewController, bool animated)
{
if (animated)
{
// Alternative way with different set of trannsition
/*
@alexlau811
alexlau811 / ExtendedPageRenderer.cs
Created Feb 22, 2015
Move toolbar items with priority = 0 to LeftBarButtonItems on iOS with Xamarin Forms. Originally written by Murally at http://forums.xamarin.com/discussion/21004/navigation-bar-left-toolbar-button
View ExtendedPageRenderer.cs
[assembly: ExportRenderer(typeof(ContentPage), typeof(ExtendedPageRenderer))]
public class ExtendedPageRenderer : PageRenderer
{
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
var contentPage = this.Element as ContentPage;
if (contentPage == null || NavigationController == null)
You can’t perform that action at this time.