Skip to content

Instantly share code, notes, and snippets.

View jessejiang0214's full-sized avatar

Jesse Jiang jessejiang0214

View GitHub Profile
@joshualyon
joshualyon / Output Android Icons.jsx
Last active May 30, 2019 15:47 — forked from tlinkner/Output Android Icons.jsx
Photoshop script to output Android icons (with XXXHDPI, XXHDPI, XHDPI, HDPI, MDPI support)
// Output Android Icons.jsx
// 2012 Todd Linkner
// License: none (public domain)
// v1.0 - base file by Todd Linkner
// v1.1 - added support for XXHDPI, XXXHDPI and added PNG to the file selector
//
// This script is for Photoshop CS6. It outputs Android icons of the
// following sizes from a source PSD at least 512px x 512px
//
// store:
@alexrainman
alexrainman / ITextMeter
Last active August 1, 2022 07:45
Calculate Xamarin.Forms label height by amount of text
namespace YourNamespace
{
public interface ITextMeter
{
double MeasureTextSize(string text, double width, double fontSize, string fontName = null);
}
}
public class AndroidExternalStorageWriter : IAndroidExternalStorageWriter
{
public string CreateFile(string filename, byte[] bytes)
{
if (!Directory.Exists(Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "AccountMate")))
Directory.CreateDirectory(Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "AccountMate"));
var path = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "AccountMate", filename);
File.WriteAllBytes(path, bytes);