This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGFloat GetLineHeightForFont(CTFontRef iFont) | |
{ | |
CGFloat lineHeight = 0.0; | |
check(iFont != NULL); | |
// Get the ascent from the font, already scaled for the font's size | |
lineHeight += CTFontGetAscent(iFont); | |
// Get the descent from the font, already scaled for the font's size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Setup our fonts - One system font from Apple and a custom font */ | |
CTFontRef bodyCopyFont = CTFontCreateWithName((__bridge CFStringRef) [Theme fontForBodyOfSize:11].fontName, [Theme fontForBodyOfSize:11].lineHeight, NULL); | |
CTFontRef systemFont = CTFontCreateWithName((__bridge CFStringRef) [UIFont systemFontOfSize:11].fontName, [UIFont systemFontOfSize:11].lineHeight, NULL); | |
/* Lets inspect the properties */ | |
NSLog(@"*****************************************************************"); | |
NSLog(@"SYSTEM-FONT LINE HEIGHT PROPERTY %f", [UIFont systemFontOfSize:11].lineHeight); | |
NSLog(@"SYSTEM-FONT CALCULATED LINE HEIGHT %f", [self getLineHeightForFont:systemFont]); //Custom function | |
NSLog(@"*****************************************************************"); | |
NSLog(@"CUSTOM-FONT LINE HEIGHT PROPERTY %f", [Theme fontForBodyOfSize:11].lineHeight); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CAShapeLayer *layer = [CAShapeLayer layer]; | |
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerBottomLeft) cornerRadii:CGSizeMake(5.0, 5.0)]; | |
layer.path = path.CGPath; | |
self.layer.mask = layer; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CAShapeLayer *layer = [CAShapeLayer layer]; | |
NSUInteger cornersToRound = UIRectCornerTopLeft | UIRectCornerBottomLeft; | |
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds | |
byRoundingCorners:cornersToRound | |
cornerRadii:CGSizeMake(5.0, 5.0)]; | |
layer.path = path.CGPath; | |
self.layer.mask = layer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (doc, req) { | |
if(doc._deleted){ return true; } | |
//YOUR CUSTOM LOGIC HERE | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { | |
teamSelector.getViewTreeObserver().removeOnGlobalLayoutListener(this); | |
} else { | |
teamSelector.getViewTreeObserver().removeGlobalOnLayoutListener(this); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task('increaseVersionCode') << { | |
def manifestFile = file("src/main/AndroidManifest.xml") | |
def pattern = Pattern.compile("versionCode=\"(\\d+)\"") | |
def manifestText = manifestFile.getText() | |
def matcher = pattern.matcher(manifestText) | |
matcher.find() | |
def versionCode = Integer.parseInt(matcher.group(1)) | |
android.defaultConfig.versionCode = versionCode + 1 | |
println "Setting version code to ${android.defaultConfig.versionCode}" | |
def manifestContent = matcher.replaceAll("versionCode=\"" + android.defaultConfig.versionCode + "\"") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void setupStrictMode() { | |
StrictMode.enableDefaults(); | |
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() | |
.detectAll() | |
.penaltyLog() | |
.penaltyDeath() | |
.build()); | |
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.square.flow; | |
import android.util.SparseArray; | |
import com.google.common.reflect.TypeToken; | |
import com.google.gson.Gson; | |
import com.google.gson.JsonElement; | |
import com.google.gson.TypeAdapter; | |
import com.google.gson.stream.JsonReader; | |
import com.google.gson.stream.JsonToken; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyPresenter { | |
public MyPresenter(IView viewInterface){ | |
} | |
public void start() { | |
//this should be called from a onResume() lifecycle method or similar | |
//subscribe here | |
} |
OlderNewer