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
def withSocketAsync[A](s: => Socket) | |
(f: (Socket,java.io.Reader,java.io.Writer) => A) | |
: Future[A] = { | |
val promise = Promise[A]() | |
val sock = s | |
async { | |
try { | |
val in = new InputStreamReader(sock.getInputStream, "utf-8") | |
val out = new OutputStreamWriter(sock.getOutputStream, "utf-8") | |
try { |
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
// workaround for https://code.google.com/p/android/issues/detail?id=63777 | |
class KitKatDrawerLayout(c: Context) extends DrawerLayout(c) { | |
var baseline = Integer.MAX_VALUE | |
var change = 0 | |
override def fitSystemWindows(insets: Rect) = { | |
val adj = insets.top + insets.bottom | |
baseline = math.min(adj, baseline) | |
if (baseline != Integer.MAX_VALUE && adj > baseline) { |
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 a7dbba5..209e8b8 100644 | |
--- a/Android.mk | |
+++ b/Android.mk | |
@@ -44,6 +44,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.appcompat:android.support.v7.gridlayout:com.android.bitmap:com.android.datetimepicker | |
+LOCAL_AAPT_FLAGS += --rename-manifest-package com.android.emailhack | |
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
def loadFromPom(pom: File): Seq[ModuleID] = { | |
import scala.xml._ | |
val root = XML.loadFile(pom) | |
val parent = root \\ "parent" // TODO look up variables in parents | |
(root \\ "dependency") map { n => | |
for { | |
o <- n.child.find(_.label == "groupId") | |
a <- n.child.find(_.label == "artifactId") | |
v <- n.child.find(_.label == "version") | |
} yield ModuleID(o.text, a.text, v.text, |
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.hanhuy.android | |
import language.implicitConversions | |
package object conversions { | |
implicit def `fn1 to android.nfc.NfcAdapter$CreateNdefMessageCallback`(fn: (android.nfc.NfcEvent) => android.nfc.NdefMessage): android.nfc.NfcAdapter.CreateNdefMessageCallback = new android.nfc.NfcAdapter.CreateNdefMessageCallback { | |
override def createNdefMessage(a: android.nfc.NfcEvent) = fn(a) | |
} | |
implicit def `fn0 to android.nfc.NfcAdapter$CreateNdefMessageCallback`(fn: () => android.nfc.NdefMessage): android.nfc.NfcAdapter.CreateNdefMessageCallback = new android.nfc.NfcAdapter.CreateNdefMessageCallback { |
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
textfield.asScala.onEditorAction((_,id,event) => true) |
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 viewserver = Project(id = raw"""viewserver""", base = file(raw"""C:\Users\pfnguyen\src\vs2\viewserver""")).settings( | |
android.Plugin.androidBuildAar:_*).settings( | |
SettingKey[android.Keys.PackagingOptions]("packagingOptions") in config("android") := android.Keys.PackagingOptions(Nil, Nil, Nil), | |
SettingKey[scala.collection.Seq[sbt.Resolver]]("resolvers") ++= List(raw"""https://jcenter.bintray.com/""" at raw"""https://jcenter.bintray.com/""", | |
raw"""https://jcenter.bintray.com/""" at raw"""https://jcenter.bintray.com/""", | |
raw"""file:/C:/Users/pfnguyen/android-sdk-windows/extras/android/m2repository/""" at raw"""file:/C:/Users/pfnguyen/android-sdk-windows/extras/android/m2repository/""", | |
raw"""file:/C:/Users/pfnguyen/android-sdk-windows/extras/google/m2repository/""" at raw"""file:/C:/Users/pfnguyen/android-sdk-windows/extras/google/m2repository/"""), | |
SettingKey[java.lang.String]("platformTarget") in config("android") := raw"""android-21""", | |
SettingKey[java.lang.String]("nam |
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
pfnguyen@galactica1:~/src/sbt-key-path-test$ sbt "keypath package test:compile" [info] Loading global plugins from /home/pfnguyen/.sbt/0.13/plugins | |
[info] Loading project definition from /cifs/pfnguyen/src/sbt-key-path-test/project | |
[info] Set current project to sbt-key-path-test (in build file:/cifs/pfnguyen/src/sbt-key-path-test/) | |
[info] Path: compile:package | |
[info] Looking for: compile:package <- test:compile | |
[error] No paths found | |
pfnguyen@galactica1:~/src/sbt-key-path-test$ sbt "keypath package update" | |
[info] Loading global plugins from /home/pfnguyen/.sbt/0.13/plugins | |
[info] Loading project definition from /cifs/pfnguyen/src/sbt-key-path-test/project | |
[info] Set current project to sbt-key-path-test (in build file:/cifs/pfnguyen/src/sbt-key-path-test/) |
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.hanhuy.android.airshow | |
import java.net.{DatagramPacket, InetAddress, InetSocketAddress, DatagramSocket} | |
import java.nio.ByteBuffer | |
import java.nio.channels.DatagramChannel | |
import java.util.concurrent.TimeUnit | |
import android.content.res.Configuration | |
import android.graphics.Point | |
import android.hardware.display.VirtualDisplay |
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
pfnguyen@galactica1:~/src/ts$ sbt "gen-android android-22 m.m m" | |
[info] Loading global plugins from /home/pfnguyen/.sbt/0.13/plugins | |
[info] Set current project to ts (in build file:/cifs/pfnguyen/src/ts/) | |
[info] Creating project: m | |
Created directory /cifs/pfnguyen/src/ts/src/main/java | |
Created directory /cifs/pfnguyen/src/ts/src/main/java/m/m | |
Added file ./src/main/java/m/m/MainActivity.java | |
Created directory /cifs/pfnguyen/src/ts/src/androidTest/java | |
Created directory /cifs/pfnguyen/src/ts/src/androidTest/java/m/m | |
Added file ./src/androidTest/java/m/m/MainActivityTest.java |