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
case class RingBuffer[A: ClassManifest](capacity: Int) extends IndexedSeq[A] { | |
private val buffer = Array.fill[A](capacity)(null.asInstanceOf[A]) | |
private var _length = 0 | |
private var pos = 0 | |
def length = _length | |
private def zero = (capacity + (pos - _length)) % capacity | |
def clear() { | |
_length = 0 |
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
#!/usr/bin/python | |
from optparse import OptionParser | |
import sys | |
import os | |
from subprocess import Popen | |
from subprocess import PIPE | |
import urllib | |
from xml.parsers import expat |
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.Keys._ | |
TaskKey[Unit]("check-for-properties") <<= (apkFile) map { a => | |
val found = findInArchive(a) (_.getName == "com/example/lib/file.properties") | |
if (!found) error("Properties not found in APK") | |
} | |
def findInArchive(archive: File)(predicate: String => Boolean): Boolean = { | |
import java.io._ | |
import java.util.zip._ |
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.Keys._ | |
android.Plugin.androidBuild | |
name := "project-with-lib-projects" | |
unmanagedClasspath in Compile <<= ( baseDirectory | |
, unmanagedClasspath in Compile) map { | |
(base,cp) => | |
val ignores = Set("android-support-v4.jar", "guava-14.0.1.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
commands <+= thisProject { p => | |
Command.command("proguard")(st => { | |
val extracted = Project.extract(st) | |
Project.runTask(packageT in (p, Android), | |
extracted.append(Seq( | |
useProguard in Android := true, | |
useProguardInDebug in Android := true | |
), st) | |
) | |
st |
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
private static Future<String> requestJson(final String uri) { | |
return Future.create(new Callable<String>() { | |
public String call() throws IOException { | |
OkHttpClient client = new OkHttpClient(); | |
HttpURLConnection conn = client.open(new URL(uri)); | |
InputStreamReader in = | |
new InputStreamReader(conn.getInputStream(), "utf-8"); | |
try { | |
return CharStreams.toString(in); | |
} finally { |
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
Future<Config> config = Feeds.getInstance().getConfig(); | |
Future<Home> homeData = config.flatMap(new Function<Config, Future<Home>>() { | |
@Override | |
public Future<Home> apply(Config input) { | |
return Feeds.getInstance().getHome(input); | |
} | |
}); | |
homeData.onSuccess(new Callback<Home>() { |
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
val testTaskDef = ( projectLayout | |
, debugIncludesTests | |
, builder | |
, packageName | |
, libraryProjects | |
, classDirectory in Test | |
, externalDependencyClasspath in Compile | |
, externalDependencyClasspath in Test | |
, targetSdkVersion | |
, minSdkVersion |
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
SettingKey[Attributed[File] => Boolean]("filter-fn") := { e: Attributed[File] => | |
val name = e.data.getName | |
name.startsWith("android-support") || | |
name.startsWith("support-v4-r18") || | |
name.startsWith("xmlParserAPIs") || | |
name.startsWith("android-4") || | |
name.startsWith("accessenabler-1.6") || | |
name.startsWith("adobe-adms-measurement") || | |
name.startsWith("xpp3") | |
} |
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
diff --git a/Android.mk b/Android.mk | |
index 8bbbd98..59a6398 100644 | |
--- a/Android.mk | |
+++ b/Android.mk | |
@@ -41,6 +41,7 @@ LOCAL_ASSET_DIR := $(LOCAL_PATH)/$(unified_email_dir)/assets | |
LOCAL_AAPT_FLAGS := --auto-add-overlay | |
LOCAL_AAPT_FLAGS += --extra-packages com.android.ex.chips:com.android.mail:com.android.email:com.android.emailcommon:com.android.ex.photo:android.support.v7.gridlayout | |
+LOCAL_AAPT_FLAGS += --rename-manifest-package com.android.emailhack |