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
select { ary: s, sz: s.length, ref: forEachReferrer( | |
function refs(r) { | |
function cid(o) { | |
var cn = classof(o).name; | |
cn = cn.substring(cn.lastIndexOf(".") + 1); | |
return cn + "@" + objectid(o); | |
} | |
println(cid(s) + "=" + s.length + " <= " + cid(r) + " <= " + | |
toArray(map(sort( | |
referrers(r), "classof(rhs).name.length() - classof(lhs).name.length()"), |
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
Add LOCAL_DEX_PREOPT := false to Android.mk for App being built | |
make -j4 AppName | |
push resulting App.apk to device /sdcard/somewhere-temp | |
adb shell; cd to /sdcard/somewhere-temp | |
dexopt --zip 3 5 App.apk "v=a o=f" 5<>App.odex 3<App.apk |
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 androidBuild(projects: Project*): Project.SettingsDefinition = { | |
androidBuild ++ | |
(projects map { p => | |
Seq( | |
collectResources in Android <<= | |
collectResources in Android dependsOn (compile in Compile in p), | |
compile in Compile <<= compile in Compile dependsOn( | |
packageT in Compile in p) | |
) | |
}).flatten |
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 sbt._ | |
import sbt.Keys._ | |
import android.Keys._ | |
object ExampleMultiBuild extends Build { | |
// define a new task | |
val release = TaskKey[Unit]("release", "build & release all release builds") | |
// setup an aggregate for 'install' and 'release' | |
// calling either will perform the install or release operation against |
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 sbt._ | |
import sbt.Keys._ | |
import android.Keys._ | |
import android.Dependencies.apklib | |
object ExampleMultiBuild extends Build { | |
// add 'run' alias to the root project | |
lazy val root = Project(id = "root-prj", base = file(".")) settings( | |
android.Plugin.androidCommands ++ Seq( | |
run <<= (run in (mainprj, Android)) map { _ => Unit }): _* |
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
// so we can use keywords from Android, such as 'Android' and 'proguardOptions' | |
import android.Keys._ | |
// load the android plugin into the build | |
android.Plugin.androidBuild | |
// project name, completely optional | |
name := "time-widgets" | |
// pick the version of scala you want to use |
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 sbt._ | |
import sbt.Keys._ | |
import android.Keys._ | |
object QicrBuild extends Build { | |
lazy val root = Project(id = "qicr", base = file(".")) settings(Seq( | |
packageT in Compile <<= packageT in Android in lite, | |
packageRelease <<= packageRelease in Android in lite, | |
packageDebug <<= packageDebug in Android in lite, |
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
object SpannedGenerator { | |
private def span(style: Object, text: CharSequence) = { | |
val s = new SpannableString(text) | |
s.setSpan(style, 0, text.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE) | |
s | |
} | |
def textColor(color: Int, text: CharSequence) = | |
span(new ForegroundColorSpan(color) , text) | |
def bold(text: CharSequence) = span(new StyleSpan(Typeface.BOLD) , 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
import sbt._ | |
import android.ArbitraryProject | |
object SampleBuild extends Build { | |
import android.Keys._ | |
import android.Dependencies.LibraryProject | |
// we're gonna pull tag android-sdk-support_r11 from the support repo | |
val supportGit = uri("https://android.googlesource.com/" + |
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.irc | |
import AndroidConversions._ | |
import android.appwidget.{AppWidgetManager, AppWidgetProvider} | |
import android.widget.{Toast, RemoteViews, RemoteViewsService} | |
import android.content.{DialogInterface, Context, BroadcastReceiver, Intent} | |
import android.app.{AlertDialog, Activity, PendingIntent} | |
import android.view.View | |
import com.hanhuy.android.irc.model._ |