Commit 81a27c1b authored by Max Lv's avatar Max Lv

fix gen-idea

parent c3cd705f
......@@ -15,14 +15,14 @@ before_install:
- sudo apt-get install ccache
- export NDK_CCACHE=ccache
- export ARCH=`uname -m`
- wget http://dl.google.com/android/android-sdk_r22.6.2-linux.tgz
- tar xf android-sdk_r22.6.2-linux.tgz
- wget http://dl.google.com/android/android-sdk_r22.6.4-linux.tgz
- tar xf android-sdk_r22.6.4-linux.tgz
- wget http://dl.google.com/android/ndk/android-ndk-r9d-linux-${ARCH}.tar.bz2
- tar xf android-ndk-r9d-linux-${ARCH}.tar.bz2
- export ANDROID_NDK_HOME=`pwd`/android-ndk-r9d
- export ANDROID_HOME=`pwd`/android-sdk-linux
- export PATH=${PATH}:${ANDROID_NDK_HOME}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
- echo "y" | android update sdk --filter tools,platform-tools,build-tools-19.0.3,android-16 --no-ui --no-https -a
- echo "y" | android update sdk --filter tools,platform-tools,build-tools-19.0.3,android-19,extra-google-m2repository,extra-android-m2repository --no-ui --no-https -a
install:
- gem install --version 0.8.9 faraday
- gem install travis-artifacts
......
......@@ -10,6 +10,8 @@ name := "shadowsocks"
compileOrder in Compile := CompileOrder.JavaThenScala
resolvers += "JRAF" at "http://JRAF.org/static/maven/2"
libraryDependencies ++= Seq(
"com.google.android" % "analytics" % "3.01",
"dnsjava" % "dnsjava" % "2.1.5",
......@@ -19,9 +21,9 @@ libraryDependencies ++= Seq(
)
libraryDependencies ++= Seq(
apklib("org.jraf" % "android-switch-backport" % "1.0"),
apklib("net.simonvt.menudrawer" % "menudrawer" % "3.0.4"),
apklib("com.actionbarsherlock" % "actionbarsherlock" % "4.4.0"),
aar("com.actionbarsherlock" % "actionbarsherlock" % "4.4.0") exclude("com.google.android", "support-v4"),
"net.simonvt.menudrawer" % "menudrawer" % "3.0.6",
"org.jraf" % "android-switch-backport" % "1.3.1",
"com.google.android.gms" % "play-services" % "4.4.52",
"com.android.support" % "support-v4" % "19.1.0"
)
......@@ -40,4 +42,6 @@ proguardOptions in Android ++= Seq("-keep class android.support.v4.app.** { *; }
"-keep class org.jraf.android.backport.** { *; }",
"-keep class com.github.shadowsocks.** { *; }",
"-keep class * extends com.j256.ormlite.** { *; }",
"-keepattributes *Annotation*")
"-keepattributes *Annotation*",
"-dontwarn org.xbill.**",
"-dontwarn com.actionbarsherlock.**")
import sbtandroid.AndroidPlugin._
keyalias := "travis"
containerId := "GTM-XXXX"
sbt.version=0.12.4
sbt.version=0.12.3
// resolvers += Resolver.url("scalasbt releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
resolvers += Resolver.url("scalasbt releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns)
resolvers += Resolver.url("madeye private releases", new URL("http://madeye-maven-repository.googlecode.com/git/ivy"))(Resolver.ivyStylePatterns)
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.2.16")
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.1")
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
<?xml version="1.0" encoding="utf-8"?>
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
<header
......
......@@ -44,7 +44,7 @@ import android.content.res.AssetManager
import android.graphics.{Color, Bitmap, Typeface}
import android.os._
import android.preference._
import android.util.Log
import android.util.{Log, DisplayMetrics}
import android.view._
import android.widget._
import com.google.analytics.tracking.android.{MapBuilder, EasyTracker}
......@@ -297,6 +297,7 @@ class Shadowsocks
val MSG_CRASH_RECOVER: Int = 1
val STATE_MENUDRAWER = "com.github.shadowsocks.menuDrawer"
val STATE_ACTIVE_VIEW_ID = "com.github.shadowsocks.activeViewId"
var singlePane: Int = -1
// Variables
var switchButton: Switch = null
......@@ -357,6 +358,20 @@ class Shadowsocks
val handler = new Handler()
def isSinglePane: Boolean = {
if (singlePane == -1) {
val metrics = new DisplayMetrics()
getWindowManager().getDefaultDisplay().getMetrics(metrics)
val widthPixels = metrics.widthPixels
val scaleFactor = metrics.density
val widthDp = widthPixels / scaleFactor
singlePane = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB ||
widthPixels <= 720) 1 else 0
}
singlePane == 1
}
private def changeSwitch (checked: Boolean) {
switchButton.setOnCheckedChangeListener(null)
switchButton.setChecked(checked)
......@@ -530,15 +545,15 @@ class Shadowsocks
}
}
if (layoutView != null) {
val adView = {
if (isSinglePane) {
new AdView(this, AdSize.SMART_BANNER, "a151becb8068b09")
} else {
new AdView(this, AdSize.BANNER, "a151becb8068b09")
}
val adView = new AdView(this)
adView.setAdUnitId("ca-app-pub-9097031975646651/7760346322")
if (isSinglePane) {
adView.setAdSize(AdSize.SMART_BANNER)
} else {
adView.setAdSize(AdSize.BANNER)
}
layoutView.asInstanceOf[ViewGroup].addView(adView, 0)
adView.loadAd(new AdRequest)
adView.loadAd(new AdRequest.Builder().build())
}
}
}
......@@ -553,10 +568,6 @@ class Shadowsocks
loadHeadersFromResource(R.xml.shadowsocks_headers, target);
}
def isSinglePane: Boolean = {
Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
}
override def onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
......
......@@ -54,7 +54,7 @@ class ShadowsocksApplication extends Application {
override def onCreate() {
val tm = TagManager.getInstance(this)
ContainerOpener.openContainer(tm, BuildConfig.CONTAINER_ID, OpenType.PREFER_NON_DEFAULT, null, new Notifier {
ContainerOpener.openContainer(tm, "GTM-NT8WS8", OpenType.PREFER_NON_DEFAULT, null, new Notifier {
override def containerAvailable(container: Container) {
tagContainer = container
container.registerFunctionCallMacroHandler(SIG_FUNC, new FunctionCallMacroHandler {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment