Skip to content

Instantly share code, notes, and snippets.

View Cheesebaron's full-sized avatar
🧀
Send cheese please

Tomasz Cielecki Cheesebaron

🧀
Send cheese please
View GitHub Profile
@Cheesebaron
Cheesebaron / gist:1385260
Created November 22, 2011 09:11
Method to center around overlay items
private void CenterAroundOverlayItems()
{
if (itemizedOverlay.OverlayItems.Count == 0) return;
double hpadding = 0.1;
double vpadding = 0.15;
//start wide
int minLatitude = (int)(90 * 1E6);
int maxLatitude = (int)(-90 * 1E6);
@Cheesebaron
Cheesebaron / SannesBrain.cs
Created June 30, 2012 09:49
Sannes Brain is sleepy in Daylight
using System;
using System.Threading;
namespace SannesBrain
{
public class Brain
{
public static void Main(string[] args)
{
EnvironmentVariables.DaylightChanged += (sender, eventArgs) =>
@Cheesebaron
Cheesebaron / PickerElement.cs
Created August 31, 2012 13:19
PickerElement
//
// PickerElement.cs: Defines UIPickerView element
// Based on DateTimeElement by Miguel de Icaza
//
// Author:
// Tomasz Cielecki ([email protected])
//
// Code licensed under the MIT X11 license
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
namespace Giraffatitan
{
class Program
{
static void Main(string[] args)
@Cheesebaron
Cheesebaron / gist:4656031
Created January 28, 2013 14:41
Y locking ScrollView
using System;
using Android.Content;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;
namespace Cheesebaron.HorizontalListView
{
public class YScrollView : ScrollView
using Android.App;
using Cirrious.MvvmCross.Droid.Views;
namespace BK.EMS.Stakeholder.UI.Droid.vNext
{
[Activity(Label = "NS Stakeholder", Theme = "@android:style/Theme.Black.NoTitleBar", NoHistory = true, Icon = "@drawable/Icon")]
public class MainActivity : MvxBaseSplashScreenActivity
{
public MainActivity()
: base(Resource.Layout.Page_SplashScreen)
@Cheesebaron
Cheesebaron / Activity1.cs
Created February 25, 2013 12:52
Just a sample for Krish on the MonoDroid mailing list.
using System;
using System.IO;
using System.Text;
using System.Xml;
using Android.App;
using Android.Widget;
using Android.OS;
namespace MonoDroid.ReadWriteXML
{
@Cheesebaron
Cheesebaron / Activity1.cs
Last active September 15, 2020 14:21
Sample showing how to use Spannables to replace text with Images in Mono for Android.
using Android.App;
using Android.Text;
using Android.Text.Style;
using Android.Widget;
using Android.OS;
namespace MonoDroid.TextViewWithImages
{
[Activity(Label = "Text with Images", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : Activity
@Cheesebaron
Cheesebaron / gist:5684336
Created May 31, 2013 11:15
Quick and dirty menu item.
public override bool OnCreateOptionsMenu(IMenu menu)
{
var item = menu.Add(0,1,1,"Back");
//If you want an icon set it here
item.SetIcon(Resource.drawable.ic_menu_back);
return true;
}
public override bool OnOptionsItemSelected(IMenuItem item)
{
@Cheesebaron
Cheesebaron / BackShizzle.cs
Created May 31, 2013 13:36
Super hacky hack for forcing showing the Back button in the NavigationBar on iOS. Why does it work?
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
NavigationItem.SetHidesBackButton(true, false);
NavigationController.NavigationBar.SetNeedsDisplay();
}
public override void ViewDidAppear(bool animated)
{
NavigationItem.SetHidesBackButton(false, true);