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
/* | |
* Copyright (C) 2014 Square, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
/* | |
* Copyright (C) 2014 Square, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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.cyrilmottier.android.citybikes.provider; | |
import android.net.Uri; | |
import com.cyrilmottier.android.avelov.BuildConfig; | |
/** | |
* @author Cyril Mottier | |
*/ | |
public class CityBikesContract { |
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 tw.plate; | |
import com.google.gson.Gson; | |
import com.google.gson.GsonBuilder; | |
import com.google.gson.JsonDeserializationContext; | |
import com.google.gson.JsonDeserializer; | |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonParseException; | |
import java.lang.reflect.Type; |
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
SSLSocketFactory goodSslSocketFactory(Context context) { | |
KeyStore trusted = KeyStore.getInstance("BKS"); | |
InputStream in = context.getResources().openRawResource(R.raw.truststore); | |
trusted.load(in, TRUST_STORE_PASSWORD); | |
SSLContext sslContext = SSLContext.getInstance("TLS"); | |
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( | |
TrustManagerFactory.getDefaultAlgorithm()); | |
trustManagerFactory.init(trusted); | |
sslContext.init(null, trustManagerFactory.getTrustManagers(), null); | |
return sslContext.getSocketFactory(); |
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
android { | |
def gitTag = { | |
def tagMatchOptions | |
try { | |
tagMatchOptions = "--match ${tagToBuildFrom}" | |
} catch (MissingPropertyException) { | |
tagMatchOptions = "" | |
} | |
"git describe --exact HEAD ${tagMatchOptions}".execute().text.trim() | |
}() |
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
dependencies { | |
compile files('libs/xxxx.jar') | |
} | |
android.applicationVariants.all { variant -> | |
if (variant.buildType.name.equals("release")) { | |
variant.dex.libraries = variant.dex.libraries - files('libs/xxxx.jar') | |
} | |
} |
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
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.5.6' | |
} | |
} | |
task wrapper(type: Wrapper) { |
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
android.applicationVariants.all { variant -> | |
// replace output apk name to <product>-<version>-<buildtype>-<githash>.apk | |
def versionSuffix = variant.buildType.versionNameSuffix ? variant.buildType.versionNameSuffix : "" | |
def versionName = variant.mergedFlavor.versionName + versionSuffix + "-${gitHash}"; | |
if (variant.zipAlign) { | |
def apkFinal = variant.outputFile; | |
variant.outputFile = new File(apkFinal.parentFile, apkFinal.name.replace(variant.buildType.name, versionName)); | |
} |
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
import android.graphics.Bitmap; | |
import android.graphics.Bitmap.Config; | |
import android.graphics.BitmapShader; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.RectF; | |
import android.graphics.Shader; | |
// enables hardware accelerated rounded corners | |
// original idea here : http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/ |
NewerOlder