Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a400ef5f9 | ||
|
|
cda3650c43 | ||
|
|
b1c19f8f03 | ||
|
|
f7d422da2b | ||
|
|
10725c39cb | ||
|
|
4b5c94022b | ||
|
|
6afc3f80be | ||
|
|
a02d19bba0 | ||
|
|
984e75ae99 | ||
|
|
3cc1a1602e | ||
|
|
72305c5f60 | ||
|
|
4303c1cd0c | ||
|
|
5dad89b71e | ||
|
|
109d4728f4 | ||
|
|
53b9c1f4af | ||
|
|
23fc7e9134 | ||
|
|
e73fc9f881 | ||
|
|
941393cab4 | ||
|
|
a6e87cf666 | ||
|
|
4817539ca2 | ||
|
|
03c857536d | ||
|
|
14038cd152 | ||
|
|
935314a1c5 | ||
|
|
7263bf11a4 | ||
|
|
e766ae2244 | ||
|
|
f3ed157145 | ||
|
|
eb0d5ceccc | ||
|
|
2ffbf4c56f | ||
|
|
9ee3bab7e0 | ||
|
|
70a7317a1e | ||
|
|
43caaa684f | ||
|
|
586c5e2ae4 | ||
|
|
416d93062f | ||
|
|
66ceed8607 | ||
|
|
81295e4a51 |
+1
-2
@@ -14,6 +14,7 @@ gen_*
|
|||||||
*.class
|
*.class
|
||||||
*.o
|
*.o
|
||||||
local.sbt
|
local.sbt
|
||||||
|
.deps
|
||||||
|
|
||||||
#Intellij IDEA
|
#Intellij IDEA
|
||||||
*.iml
|
*.iml
|
||||||
@@ -27,7 +28,5 @@ out/
|
|||||||
src/main/obj
|
src/main/obj
|
||||||
src/main/libs
|
src/main/libs
|
||||||
src/main/assets/armeabi-v7a/*
|
src/main/assets/armeabi-v7a/*
|
||||||
!src/main/assets/armeabi-v7a/kcptun
|
|
||||||
src/main/assets/x86/*
|
src/main/assets/x86/*
|
||||||
!src/main/assets/x86/kcptun
|
|
||||||
jni/Application.mk
|
jni/Application.mk
|
||||||
|
|||||||
@@ -24,3 +24,9 @@
|
|||||||
path = src/main/jni/pdnsd
|
path = src/main/jni/pdnsd
|
||||||
url = https://github.com/shadowsocks/pdnsd.git
|
url = https://github.com/shadowsocks/pdnsd.git
|
||||||
branch = shadowsocks-android
|
branch = shadowsocks-android
|
||||||
|
[submodule "kcptun/kcptun"]
|
||||||
|
path = kcptun/kcptun
|
||||||
|
url = https://github.com/shadowsocks/kcptun
|
||||||
|
[submodule "kcptun/go"]
|
||||||
|
path = kcptun/go
|
||||||
|
url = https://github.com/shadowsocks/go
|
||||||
|
|||||||
+34
-22
@@ -1,19 +1,16 @@
|
|||||||
language: scala
|
language: android
|
||||||
|
|
||||||
jdk:
|
jdk:
|
||||||
- oraclejdk8
|
- oraclejdk8
|
||||||
|
|
||||||
sudo: false
|
env:
|
||||||
|
global:
|
||||||
addons:
|
- NDK_VERSION=r12b
|
||||||
apt:
|
- NDK_CCACHE=ccache
|
||||||
packages:
|
- GOROOT_BOOTSTRAP=$GOROOT
|
||||||
- gcc-multilib
|
- ANDROID_NDK_HOME=$HOME/.android/android-ndk-${NDK_VERSION}
|
||||||
- g++-multilib
|
- SBTPATH=$HOME/.sbt
|
||||||
- libstdc++6:i386
|
- PATH=${ANDROID_NDK_HOME}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH}
|
||||||
- libgcc1:i386
|
|
||||||
- zlib1g:i386
|
|
||||||
- libncurses5:i386
|
|
||||||
|
|
||||||
scala:
|
scala:
|
||||||
- 2.11.8
|
- 2.11.8
|
||||||
@@ -24,17 +21,32 @@ before_cache:
|
|||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.ivy2/cache
|
- $HOME/.ivy2
|
||||||
- $HOME/.sbt/boot
|
- $HOME/.sbt
|
||||||
|
|
||||||
|
android:
|
||||||
|
components:
|
||||||
|
- tools
|
||||||
|
- build-tools-24.0.1
|
||||||
|
- extra-google-m2repository
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- ./travis-ci/setup.sh
|
- >
|
||||||
- export NDK_CCACHE=ccache
|
if [ ! -d "$ANDROID_NDK_HOME" ]; then
|
||||||
- export ARCH=`uname -m`
|
mkdir -p $ANDROID_NDK_HOME;
|
||||||
- export ANDROID_NDK_HOME=$HOME/.android/android-ndk-r12b
|
pushd $HOME/.android;
|
||||||
- export ANDROID_HOME=$HOME/.android/android-sdk-linux
|
export ARCH=`uname -m`;
|
||||||
- export PATH=${ANDROID_NDK_HOME}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH}
|
wget -q http://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-linux-${ARCH}.zip;
|
||||||
- cp local.properties.travis local.properties
|
unzip -q android-ndk-${NDK_VERSION}-linux-${ARCH}.zip;
|
||||||
|
popd;
|
||||||
|
fi
|
||||||
|
- >
|
||||||
|
if [ ! -f "$SBTPATH/sbt" ]; then
|
||||||
|
pushd $SBTPATH;
|
||||||
|
wget -q https://raw.githubusercontent.com/paulp/sbt-extras/master/sbt;
|
||||||
|
chmod a+x sbt;
|
||||||
|
popd;
|
||||||
|
fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- sbt native-build android:package-release
|
- $SBTPATH/sbt native-build android:package-debug
|
||||||
|
|||||||
@@ -12,13 +12,17 @@ A [shadowsocks](http://shadowsocks.org) client for Android, written in Scala.
|
|||||||
|
|
||||||
* JDK 1.8
|
* JDK 1.8
|
||||||
* SBT 0.13.0+
|
* SBT 0.13.0+
|
||||||
* Android SDK r25+
|
* Go 1.4+
|
||||||
|
* Android SDK
|
||||||
|
- Build Tools 24+ (as required by [`sbt-android`](https://github.com/scala-android/sbt-android))
|
||||||
|
- Google Repository (see `build.sbt` for version)
|
||||||
* Android NDK r12b+
|
* Android NDK r12b+
|
||||||
|
|
||||||
### BUILD
|
### BUILD
|
||||||
|
|
||||||
* Set environment variable `ANDROID_HOME` to `/path/to/android-sdk`
|
* Set environment variable `ANDROID_HOME` to `/path/to/android-sdk`
|
||||||
* Set environment variable `ANDROID_NDK_HOME` to `/path/to/android-ndk`
|
* Set environment variable `ANDROID_NDK_HOME` to `/path/to/android-ndk`
|
||||||
|
* Set environment variable `GOROOT_BOOTSTRAP` to `/path/to/go`
|
||||||
* Create your key following the instructions at https://developer.android.com/studio/publish/app-signing.html
|
* Create your key following the instructions at https://developer.android.com/studio/publish/app-signing.html
|
||||||
* Put your key in ~/.keystore
|
* Put your key in ~/.keystore
|
||||||
* Create `local.properties` from `local.properties.example` with your own key information
|
* Create `local.properties` from `local.properties.example` with your own key information
|
||||||
@@ -26,33 +30,11 @@ A [shadowsocks](http://shadowsocks.org) client for Android, written in Scala.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
git submodule update --init
|
git submodule update --init
|
||||||
|
|
||||||
# Build the App
|
# Build the App
|
||||||
sbt native-build clean android:package-release
|
sbt native-build clean android:package-release
|
||||||
```
|
```
|
||||||
|
|
||||||
#### BUILD on Mac OS X (with HomeBrew)
|
|
||||||
|
|
||||||
* Install Android SDK and NDK by run `brew install android-ndk android-sdk`
|
|
||||||
* Add `export ANDROID_HOME=/usr/local/Cellar/android-sdk/$version` to your .bashrc , then reopen the shell to load it.
|
|
||||||
* Add `export ANDROID_NDK_HOME=/usr/local/Cellar/android-ndk/$version` to your .bashrc , then reopen the shell to load it.
|
|
||||||
* echo "y" | android update sdk --filter tools,platform-tools,build-tools-23.0.2,android-23,extra-google-m2repository --no-ui -a
|
|
||||||
* echo "y" | android update sdk --filter extra-android-m2repository --no-ui --no-https -a
|
|
||||||
* Create your key following the instructions at http://developer.android.com/guide/publishing/app-signing.html#cert
|
|
||||||
* Put your key in ~/.keystore
|
|
||||||
* Create `local.properties` from `local.properties.example` with your own key information .
|
|
||||||
* Invoke the building like this
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git submodule update --init
|
|
||||||
|
|
||||||
# Build native binaries
|
|
||||||
./build.sh
|
|
||||||
|
|
||||||
# Build the apk
|
|
||||||
sbt clean android:package-release
|
|
||||||
```
|
|
||||||
|
|
||||||
## OPEN SOURCE LICENSES
|
## OPEN SOURCE LICENSES
|
||||||
|
|
||||||
* shadowsocks-libev: [GPLv3](https://github.com/shadowsocks/shadowsocks-libev/blob/master/LICENSE)
|
* shadowsocks-libev: [GPLv3](https://github.com/shadowsocks/shadowsocks-libev/blob/master/LICENSE)
|
||||||
@@ -62,10 +44,11 @@ A [shadowsocks](http://shadowsocks.org) client for Android, written in Scala.
|
|||||||
* pdnsd: [GPLv3](https://github.com/shadowsocks/shadowsocks-android/blob/master/src/main/jni/pdnsd/COPYING)
|
* pdnsd: [GPLv3](https://github.com/shadowsocks/shadowsocks-android/blob/master/src/main/jni/pdnsd/COPYING)
|
||||||
* libev: [GPLv2](https://github.com/shadowsocks/shadowsocks-android/blob/master/src/main/jni/libev/LICENSE)
|
* libev: [GPLv2](https://github.com/shadowsocks/shadowsocks-android/blob/master/src/main/jni/libev/LICENSE)
|
||||||
* libevent: [BSD](https://github.com/shadowsocks/libevent/blob/master/LICENSE)
|
* libevent: [BSD](https://github.com/shadowsocks/libevent/blob/master/LICENSE)
|
||||||
|
* kcptun: [MIT](https://github.com/xtaci/kcptun)
|
||||||
|
|
||||||
### LICENSE
|
### LICENSE
|
||||||
|
|
||||||
Copyright (C) 2016 by Max Lv <<max.c.lv@gmail.com>> <br/>
|
Copyright (C) 2016 by Max Lv <<max.c.lv@gmail.com>>
|
||||||
Copyright (C) 2016 by Mygod Studio <<mygodstudio@gmail.com>>
|
Copyright (C) 2016 by Mygod Studio <<mygodstudio@gmail.com>>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -37,16 +37,16 @@ libraryDependencies ++= Seq(
|
|||||||
"com.github.kevinsawicki" % "http-request" % "6.0",
|
"com.github.kevinsawicki" % "http-request" % "6.0",
|
||||||
"eu.chainfire" % "libsuperuser" % "1.0.0.201607041850",
|
"eu.chainfire" % "libsuperuser" % "1.0.0.201607041850",
|
||||||
"net.glxn.qrgen" % "android" % "2.0",
|
"net.glxn.qrgen" % "android" % "2.0",
|
||||||
"com.google.android.gms" % "play-services-ads" % "9.2.1",
|
"com.google.android.gms" % "play-services-ads" % "9.4.0",
|
||||||
"com.google.android.gms" % "play-services-analytics" % "9.2.1",
|
"com.google.android.gms" % "play-services-analytics" % "9.4.0",
|
||||||
"com.android.support" % "design" % "24.1.0",
|
"com.android.support" % "design" % "24.1.1",
|
||||||
"com.android.support" % "gridlayout-v7" % "24.1.0",
|
"com.android.support" % "gridlayout-v7" % "24.1.1",
|
||||||
"com.android.support" % "cardview-v7" % "24.1.0",
|
"com.android.support" % "cardview-v7" % "24.1.1",
|
||||||
"com.github.jorgecastilloprz" % "fabprogresscircle" % "1.01",
|
"com.github.jorgecastilloprz" % "fabprogresscircle" % "1.01",
|
||||||
"com.j256.ormlite" % "ormlite-android" % "4.48",
|
"com.j256.ormlite" % "ormlite-android" % "5.0",
|
||||||
"com.twofortyfouram" % "android-plugin-api-for-locale" % "1.0.2",
|
"com.twofortyfouram" % "android-plugin-api-for-locale" % "1.0.2",
|
||||||
"com.github.clans" % "fab" % "1.6.4",
|
"com.github.clans" % "fab" % "1.6.4",
|
||||||
"me.dm7.barcodescanner" % "zxing" % "1.8.4"
|
"me.dm7.barcodescanner" % "zxing" % "1.9"
|
||||||
)
|
)
|
||||||
|
|
||||||
proguardVersion in Android := "5.2.1"
|
proguardVersion in Android := "5.2.1"
|
||||||
@@ -55,12 +55,8 @@ proguardCache in Android := Seq()
|
|||||||
|
|
||||||
proguardOptions in Android ++= Seq(
|
proguardOptions in Android ++= Seq(
|
||||||
"-keep class com.github.shadowsocks.System { *; }",
|
"-keep class com.github.shadowsocks.System { *; }",
|
||||||
"-dontwarn com.google.android.gms.**",
|
"-dontwarn com.google.android.gms.internal.**",
|
||||||
"-keep class com.google.android.gms.**",
|
"-dontwarn com.j256.ormlite.**",
|
||||||
"-dontnote com.google.android.gms.internal.**",
|
|
||||||
"-dontnote com.j256.ormlite.**",
|
|
||||||
"-dontnote me.dm7.barcodescannerview.**",
|
|
||||||
"-dontnote org.xbill.**",
|
|
||||||
"-dontwarn org.xbill.**")
|
"-dontwarn org.xbill.**")
|
||||||
|
|
||||||
lazy val nativeBuild = TaskKey[Unit]("native-build", "Build native executables")
|
lazy val nativeBuild = TaskKey[Unit]("native-build", "Build native executables")
|
||||||
|
|||||||
@@ -4,19 +4,25 @@ function try () {
|
|||||||
"$@" || exit -1
|
"$@" || exit -1
|
||||||
}
|
}
|
||||||
|
|
||||||
try pushd src/main
|
# Build native binaries
|
||||||
|
pushd src/main
|
||||||
# Build
|
|
||||||
#try $ANDROID_NDK_HOME/ndk-build clean
|
|
||||||
try $ANDROID_NDK_HOME/ndk-build -j8
|
try $ANDROID_NDK_HOME/ndk-build -j8
|
||||||
|
|
||||||
# copy executables
|
rm -rf assets/armeabi-v7a
|
||||||
|
rm -rf assets/x86
|
||||||
|
mkdir -p assets/armeabi-v7a
|
||||||
|
mkdir -p assets/x86
|
||||||
|
|
||||||
|
#copy executables
|
||||||
for app in pdnsd redsocks ss-local ss-tunnel tun2socks
|
for app in pdnsd redsocks ss-local ss-tunnel tun2socks
|
||||||
do
|
do
|
||||||
rm -f assets/armeabi-v7a/$app
|
echo $app
|
||||||
rm -f assets/x86/$app
|
|
||||||
try mv libs/armeabi-v7a/$app assets/armeabi-v7a/
|
try mv libs/armeabi-v7a/$app assets/armeabi-v7a/
|
||||||
try mv libs/x86/$app assets/x86/
|
try mv libs/x86/$app assets/x86/
|
||||||
done
|
done
|
||||||
|
popd
|
||||||
|
|
||||||
try popd
|
# Build kcptun
|
||||||
|
pushd kcptun
|
||||||
|
try ./make.bash
|
||||||
|
popd
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
cd ${1}
|
|
||||||
travis-artifacts upload --path ${2} --target-path nightly
|
|
||||||
Submodule
+1
Submodule kcptun/go added at f3e7e7b69f
Submodule
+1
Submodule kcptun/kcptun added at eced3949b2
Executable
+67
@@ -0,0 +1,67 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function try () {
|
||||||
|
"$@" || exit -1
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -z "$ANDROID_NDK_HOME" ] && ANDROID_NDK_HOME=~/android-ndk-r12b
|
||||||
|
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
DEPS=$DIR/.deps
|
||||||
|
ANDROID_ARM_TOOLCHAIN=$DEPS/android-toolchain-16-arm
|
||||||
|
ANDROID_X86_TOOLCHAIN=$DEPS/android-toolchain-16-x86
|
||||||
|
|
||||||
|
ANDROID_ARM_CC=$ANDROID_ARM_TOOLCHAIN/bin/arm-linux-androideabi-gcc
|
||||||
|
ANDROID_ARM_STRIP=$ANDROID_ARM_TOOLCHAIN/bin/arm-linux-androideabi-strip
|
||||||
|
|
||||||
|
ANDROID_X86_CC=$ANDROID_X86_TOOLCHAIN/bin/i686-linux-android-gcc
|
||||||
|
ANDROID_X86_STRIP=$ANDROID_X86_TOOLCHAIN/bin/i686-linux-android-strip
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -d "$DEPS" ]; then
|
||||||
|
mkdir -p $DEPS
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$ANDROID_ARM_TOOLCHAIN" ]; then
|
||||||
|
echo "Make standalone toolchain for ARM arch"
|
||||||
|
$ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py --arch arm \
|
||||||
|
--api 16 --install-dir $ANDROID_ARM_TOOLCHAIN
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$ANDROID_X86_TOOLCHAIN" ]; then
|
||||||
|
echo "Make standalone toolchain for X86 arch"
|
||||||
|
$ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py --arch x86 \
|
||||||
|
--api 16 --install-dir $ANDROID_X86_TOOLCHAIN
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$DIR/go/bin" ]; then
|
||||||
|
echo "Build the custom go"
|
||||||
|
|
||||||
|
pushd $DIR/go/src
|
||||||
|
try ./make.bash
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
export GOROOT=$DIR/go
|
||||||
|
export GOPATH=$HOME
|
||||||
|
export GOBIN=$GOPATH/bin
|
||||||
|
mkdir $GOBIN
|
||||||
|
export PATH=$GOROOT/bin:$PATH
|
||||||
|
|
||||||
|
pushd kcptun/client
|
||||||
|
|
||||||
|
echo "Get dependences for kcptun"
|
||||||
|
go get
|
||||||
|
|
||||||
|
echo "Cross compile kcptun for arm"
|
||||||
|
try env CGO_ENABLED=1 CC=$ANDROID_ARM_CC GOOS=android GOARCH=arm GOARM=7 go build
|
||||||
|
try $ANDROID_ARM_STRIP client
|
||||||
|
try mv client $DIR/../src/main/assets/armeabi-v7a/kcptun
|
||||||
|
|
||||||
|
echo "Cross compile kcptun for x86"
|
||||||
|
try env CGO_ENABLED=1 CC=$ANDROID_X86_CC GOOS=android GOARCH=386 go build
|
||||||
|
try $ANDROID_X86_STRIP client
|
||||||
|
try mv client $DIR/../src/main/assets/x86/kcptun
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo "Successfully build kcptun"
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
key.alias: travis
|
|
||||||
key.store: travis.keystore
|
|
||||||
key.store.password: travis
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
addSbtPlugin("org.scala-android" % "sbt-android" % "1.6.10")
|
addSbtPlugin("org.scala-android" % "sbt-android" % "1.6.12")
|
||||||
|
|
||||||
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.10")
|
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.10")
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks"
|
xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks"
|
||||||
android:versionCode="142"
|
android:versionCode="145"
|
||||||
android:versionName="3.0.0">
|
android:versionName="3.0.3">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
|||||||
Binary file not shown.
@@ -296,6 +296,7 @@ along with this program. If not, see <a href="http://www.gnu.org/licenses/">http
|
|||||||
<li>pdnsd: <a href="https://github.com/shadowsocks/shadowsocks-android/blob/master/src/main/jni/pdnsd/COPYING">GPLv3</a></li>
|
<li>pdnsd: <a href="https://github.com/shadowsocks/shadowsocks-android/blob/master/src/main/jni/pdnsd/COPYING">GPLv3</a></li>
|
||||||
<li>libev: <a href="https://github.com/shadowsocks/libevent/blob/shadowsocks-android/LICENSE">GPLv2</a></li>
|
<li>libev: <a href="https://github.com/shadowsocks/libevent/blob/shadowsocks-android/LICENSE">GPLv2</a></li>
|
||||||
<li>libevent: <a href="https://github.com/shadowsocks/shadowsocks-android/blob/master/src/main/jni/libevent/LICENSE">BSD</a></li>
|
<li>libevent: <a href="https://github.com/shadowsocks/shadowsocks-android/blob/master/src/main/jni/libevent/LICENSE">BSD</a></li>
|
||||||
|
<li>kcptun: <a href="https://github.com/xtaci/kcptun/commits/master/LICENSE.md">MIT</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Binary file not shown.
Submodule src/main/jni/shadowsocks-libev updated: 915047e957...6f65fedbbd
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent" android:layout_height="wrap_content">
|
|
||||||
<TextView android:text="@string/stat" android:textSize="16sp"
|
|
||||||
android:textColor="?android:attr/textColorPrimary" android:ellipsize="marquee"
|
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content"/>
|
|
||||||
<TextView android:id="@+id/connection_test" android:gravity="end"
|
|
||||||
android:textSize="14sp" android:textColor="?android:attr/textColorSecondary"
|
|
||||||
android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1"/>
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -10,13 +10,31 @@
|
|||||||
<LinearLayout android:id="@+id/stat" android:elevation="4dp" android:visibility="gone"
|
<LinearLayout android:id="@+id/stat" android:elevation="4dp" android:visibility="gone"
|
||||||
android:layout_width="match_parent" android:layout_height="wrap_content"
|
android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight" android:gravity="center_vertical"
|
android:minHeight="?android:attr/listPreferredItemHeight" android:gravity="center_vertical"
|
||||||
android:paddingStart="16dip" android:paddingEnd="88dip" android:focusable="true"
|
android:paddingStart="16dip" android:paddingEnd="16dip" android:focusable="true"
|
||||||
android:paddingLeft="16dip" android:paddingRight="88dip"
|
android:paddingLeft="16dip" android:paddingRight="16dip"
|
||||||
android:paddingTop="16dip" android:paddingBottom="16dip"
|
android:paddingTop="16dip" android:paddingBottom="16dip"
|
||||||
android:background="@drawable/background_stat" android:orientation="vertical">
|
android:background="@drawable/background_stat" android:orientation="vertical">
|
||||||
<include layout="@layout/layout_main_stat_title"/>
|
<LinearLayout android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView android:text="@string/stat"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
<TextView android:id="@+id/connection_test"
|
||||||
|
android:gravity="end"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
</LinearLayout>
|
||||||
<android.support.v7.widget.GridLayout android:layout_width="match_parent"
|
<android.support.v7.widget.GridLayout android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" app:columnCount="4">
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingEnd="72dip"
|
||||||
|
android:paddingRight="72dip"
|
||||||
|
app:columnCount="4">
|
||||||
<TextView app:layout_column="0" style="@style/TextAppearance.AppCompat.Body2"
|
<TextView app:layout_column="0" style="@style/TextAppearance.AppCompat.Body2"
|
||||||
android:ellipsize="marquee" android:text="@string/sent"
|
android:ellipsize="marquee" android:text="@string/sent"
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent" android:layout_height="wrap_content">
|
|
||||||
<TextView android:text="@string/stat" android:textSize="16sp"
|
|
||||||
android:textColor="?android:attr/textColorPrimary" android:ellipsize="marquee"
|
|
||||||
android:layout_width="match_parent" android:layout_height="wrap_content"/>
|
|
||||||
<TextView android:id="@+id/connection_test"
|
|
||||||
android:textSize="14sp" android:textColor="?android:attr/textColorSecondary"
|
|
||||||
android:layout_width="match_parent" android:layout_height="wrap_content"/>
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -43,10 +43,12 @@ import java.util.{Timer, TimerTask}
|
|||||||
|
|
||||||
import android.app.Service
|
import android.app.Service
|
||||||
import android.content.{BroadcastReceiver, Context, Intent, IntentFilter}
|
import android.content.{BroadcastReceiver, Context, Intent, IntentFilter}
|
||||||
|
import android.net.ConnectivityManager
|
||||||
import android.os.{Handler, RemoteCallbackList}
|
import android.os.{Handler, RemoteCallbackList}
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
|
||||||
import com.github.kevinsawicki.http.HttpRequest
|
import com.github.kevinsawicki.http.HttpRequest
|
||||||
import com.github.shadowsocks.aidl.{IShadowsocksService, IShadowsocksServiceCallback}
|
import com.github.shadowsocks.aidl.{IShadowsocksService, IShadowsocksServiceCallback}
|
||||||
import com.github.shadowsocks.utils._
|
import com.github.shadowsocks.utils._
|
||||||
@@ -71,6 +73,16 @@ trait BaseService extends Service {
|
|||||||
}
|
}
|
||||||
var closeReceiverRegistered: Boolean = _
|
var closeReceiverRegistered: Boolean = _
|
||||||
|
|
||||||
|
var kcptunProcess: GuardedProcess = _
|
||||||
|
private val networkReceiver: BroadcastReceiver = (context: Context, intent: Intent) => {
|
||||||
|
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE).asInstanceOf[ConnectivityManager]
|
||||||
|
val activeNetwork = cm.getActiveNetworkInfo()
|
||||||
|
val isConnected = activeNetwork != null && activeNetwork.isConnected()
|
||||||
|
|
||||||
|
if (isConnected && profile.kcp && kcptunProcess != null) kcptunProcess.restart()
|
||||||
|
}
|
||||||
|
var networkReceiverRegistered: Boolean = _
|
||||||
|
|
||||||
val binder = new IShadowsocksService.Stub {
|
val binder = new IShadowsocksService.Stub {
|
||||||
override def getState: Int = {
|
override def getState: Int = {
|
||||||
state
|
state
|
||||||
@@ -162,6 +174,14 @@ trait BaseService extends Service {
|
|||||||
closeReceiverRegistered = true
|
closeReceiverRegistered = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (profile.kcp && !networkReceiverRegistered) {
|
||||||
|
// register network change receiver
|
||||||
|
val filter = new IntentFilter()
|
||||||
|
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION)
|
||||||
|
registerReceiver(networkReceiver, filter)
|
||||||
|
networkReceiverRegistered = true
|
||||||
|
}
|
||||||
|
|
||||||
app.track(getClass.getSimpleName, "start")
|
app.track(getClass.getSimpleName, "start")
|
||||||
|
|
||||||
changeState(State.CONNECTING)
|
changeState(State.CONNECTING)
|
||||||
@@ -177,6 +197,10 @@ trait BaseService extends Service {
|
|||||||
unregisterReceiver(closeReceiver)
|
unregisterReceiver(closeReceiver)
|
||||||
closeReceiverRegistered = false
|
closeReceiverRegistered = false
|
||||||
}
|
}
|
||||||
|
if (networkReceiverRegistered) {
|
||||||
|
unregisterReceiver(networkReceiver)
|
||||||
|
networkReceiverRegistered = false
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure update total traffic when stopping the runner
|
// Make sure update total traffic when stopping the runner
|
||||||
updateTrafficTotal(TrafficMonitor.txTotal, TrafficMonitor.rxTotal)
|
updateTrafficTotal(TrafficMonitor.txTotal, TrafficMonitor.rxTotal)
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class GuardedProcess(cmd: Seq[String]) extends Process {
|
|||||||
@volatile private var guardThread: Thread = _
|
@volatile private var guardThread: Thread = _
|
||||||
@volatile private var isDestroyed: Boolean = _
|
@volatile private var isDestroyed: Boolean = _
|
||||||
@volatile private var process: Process = _
|
@volatile private var process: Process = _
|
||||||
|
@volatile private var isRestart = false
|
||||||
|
|
||||||
def start(onRestartCallback: () => Unit = null): GuardedProcess = {
|
def start(onRestartCallback: () => Unit = null): GuardedProcess = {
|
||||||
val semaphore = new Semaphore(1)
|
val semaphore = new Semaphore(1)
|
||||||
@@ -76,9 +77,13 @@ class GuardedProcess(cmd: Seq[String]) extends Process {
|
|||||||
semaphore.release
|
semaphore.release
|
||||||
process.waitFor
|
process.waitFor
|
||||||
|
|
||||||
if (currentTimeMillis - startTime < 1000) {
|
if (isRestart) {
|
||||||
Log.w(TAG, "process exit too fast, stop guard: " + cmd)
|
isRestart = false
|
||||||
isDestroyed = true
|
} else {
|
||||||
|
if (currentTimeMillis - startTime < 1000) {
|
||||||
|
Log.w(TAG, "process exit too fast, stop guard: " + cmd)
|
||||||
|
isDestroyed = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -108,6 +113,11 @@ class GuardedProcess(cmd: Seq[String]) extends Process {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def restart() {
|
||||||
|
isRestart = true
|
||||||
|
process.destroy()
|
||||||
|
}
|
||||||
|
|
||||||
def exitValue: Int = throw new UnsupportedOperationException
|
def exitValue: Int = throw new UnsupportedOperationException
|
||||||
def getErrorStream: InputStream = throw new UnsupportedOperationException
|
def getErrorStream: InputStream = throw new UnsupportedOperationException
|
||||||
def getInputStream: InputStream = throw new UnsupportedOperationException
|
def getInputStream: InputStream = throw new UnsupportedOperationException
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ class Shadowsocks extends AppCompatActivity with ServiceBoundContext {
|
|||||||
private def updatePreferenceScreen(profile: Profile) {
|
private def updatePreferenceScreen(profile: Profile) {
|
||||||
if (profile.host == "198.199.101.152") if (adView == null) {
|
if (profile.host == "198.199.101.152") if (adView == null) {
|
||||||
adView = new AdView(this)
|
adView = new AdView(this)
|
||||||
adView.setAdUnitId("ca-app-pub-9097031975646651/7760346322")
|
adView.setAdUnitId("ca-app-pub-4984938374218635/1433320509")
|
||||||
adView.setAdSize(AdSize.SMART_BANNER)
|
adView.setAdSize(AdSize.SMART_BANNER)
|
||||||
preferences.getView.asInstanceOf[ViewGroup].addView(adView, 1)
|
preferences.getView.asInstanceOf[ViewGroup].addView(adView, 1)
|
||||||
adView.loadAd(new AdRequest.Builder().build())
|
adView.loadAd(new AdRequest.Builder().build())
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ class ShadowsocksNatService extends BaseService {
|
|||||||
private var notification: ShadowsocksNotification = _
|
private var notification: ShadowsocksNotification = _
|
||||||
val myUid = android.os.Process.myUid()
|
val myUid = android.os.Process.myUid()
|
||||||
|
|
||||||
var kcptunProcess: Process = _
|
|
||||||
var sslocalProcess: Process = _
|
var sslocalProcess: Process = _
|
||||||
var sstunnelProcess: Process = _
|
var sstunnelProcess: Process = _
|
||||||
var redsocksProcess: Process = _
|
var redsocksProcess: Process = _
|
||||||
@@ -117,12 +116,13 @@ class ShadowsocksNatService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def startKcptunDaemon() {
|
def startKcptunDaemon() {
|
||||||
|
if (profile.kcpcli == null) profile.kcpcli = ""
|
||||||
|
|
||||||
val cmd = new ArrayBuffer[String]
|
val cmd = new ArrayBuffer[String]
|
||||||
cmd += (getApplicationInfo.dataDir + "/kcptun"
|
cmd += (getApplicationInfo.dataDir + "/kcptun"
|
||||||
, "-r", profile.host + ":" + profile.kcpPort
|
, "-r", profile.host + ":" + profile.kcpPort
|
||||||
, "-l", "127.0.0.1:" + (profile.localPort + 90)
|
, "-l", "127.0.0.1:" + (profile.localPort + 90)
|
||||||
, profile.kcpcli)
|
, profile.kcpcli.trim)
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,8 @@ object ShadowsocksSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def updateSummaryEditTextPreference(pref: Preference, value: String) {
|
def updateSummaryEditTextPreference(pref: Preference, value: String) {
|
||||||
if (value != null) {
|
pref.setSummary(value)
|
||||||
pref.setSummary(value)
|
pref.asInstanceOf[SummaryEditTextPreference].setText(value)
|
||||||
pref.asInstanceOf[SummaryEditTextPreference].setText(value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def updateSwitchPreference(pref: Preference, value: Boolean) {
|
def updateSwitchPreference(pref: Preference, value: Boolean) {
|
||||||
|
|||||||
@@ -25,24 +25,26 @@ final class ShadowsocksTileService extends TileService with ServiceBoundContext
|
|||||||
def trafficUpdated(txRate: Long, rxRate: Long, txTotal: Long, rxTotal: Long) = ()
|
def trafficUpdated(txRate: Long, rxRate: Long, txTotal: Long, rxTotal: Long) = ()
|
||||||
def stateChanged(state: Int, msg: String) {
|
def stateChanged(state: Int, msg: String) {
|
||||||
val tile = getQsTile
|
val tile = getQsTile
|
||||||
state match {
|
if (tile != null) {
|
||||||
case State.STOPPED =>
|
state match {
|
||||||
tile.setIcon(iconIdle)
|
case State.STOPPED =>
|
||||||
tile.setLabel(getString(R.string.app_name))
|
tile.setIcon(iconIdle)
|
||||||
tile.setState(Tile.STATE_INACTIVE)
|
tile.setLabel(getString(R.string.app_name))
|
||||||
case State.CONNECTED =>
|
tile.setState(Tile.STATE_INACTIVE)
|
||||||
tile.setIcon(iconConnected)
|
case State.CONNECTED =>
|
||||||
tile.setLabel(app.currentProfile match {
|
tile.setIcon(iconConnected)
|
||||||
case Some(profile) => profile.name
|
tile.setLabel(app.currentProfile match {
|
||||||
case None => getString(R.string.app_name)
|
case Some(profile) => profile.name
|
||||||
})
|
case None => getString(R.string.app_name)
|
||||||
tile.setState(Tile.STATE_ACTIVE)
|
})
|
||||||
case _ =>
|
tile.setState(Tile.STATE_ACTIVE)
|
||||||
tile.setIcon(iconBusy)
|
case _ =>
|
||||||
tile.setLabel(getString(R.string.app_name))
|
tile.setIcon(iconBusy)
|
||||||
tile.setState(Tile.STATE_UNAVAILABLE)
|
tile.setLabel(getString(R.string.app_name))
|
||||||
|
tile.setState(Tile.STATE_UNAVAILABLE)
|
||||||
|
}
|
||||||
|
tile.updateTile
|
||||||
}
|
}
|
||||||
tile.updateTile
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
|||||||
var vpnThread: ShadowsocksVpnThread = _
|
var vpnThread: ShadowsocksVpnThread = _
|
||||||
private var notification: ShadowsocksNotification = _
|
private var notification: ShadowsocksNotification = _
|
||||||
|
|
||||||
var kcptunProcess: Process = _
|
|
||||||
var sslocalProcess: Process = _
|
var sslocalProcess: Process = _
|
||||||
var sstunnelProcess: Process = _
|
var sstunnelProcess: Process = _
|
||||||
var pdnsdProcess: Process = _
|
var pdnsdProcess: Process = _
|
||||||
@@ -183,34 +182,36 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
|||||||
/** Called when the activity is first created. */
|
/** Called when the activity is first created. */
|
||||||
def handleConnection: Boolean = {
|
def handleConnection: Boolean = {
|
||||||
|
|
||||||
|
val fd = startVpn()
|
||||||
|
if (!sendFd(fd)) return false
|
||||||
|
|
||||||
|
if (profile.kcp) {
|
||||||
|
startKcptunDaemon()
|
||||||
|
}
|
||||||
|
|
||||||
|
startShadowsocksDaemon()
|
||||||
|
|
||||||
|
if (profile.udpdns && profile.kcp) {
|
||||||
|
startShadowsocksUDPDaemon()
|
||||||
|
}
|
||||||
|
|
||||||
if (!profile.udpdns) {
|
if (!profile.udpdns) {
|
||||||
startDnsDaemon()
|
startDnsDaemon()
|
||||||
startDnsTunnel()
|
startDnsTunnel()
|
||||||
}
|
}
|
||||||
|
|
||||||
startShadowsocksDaemon()
|
true
|
||||||
|
|
||||||
if (profile.udpdns) {
|
|
||||||
startShadowsocksUDPDaemon()
|
|
||||||
}
|
|
||||||
|
|
||||||
val fd = startVpn()
|
|
||||||
val ret = sendFd(fd)
|
|
||||||
|
|
||||||
if (ret && profile.kcp) {
|
|
||||||
startKcptunDaemon()
|
|
||||||
}
|
|
||||||
|
|
||||||
ret
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def startKcptunDaemon() {
|
def startKcptunDaemon() {
|
||||||
|
if (profile.kcpcli == null) profile.kcpcli = ""
|
||||||
|
|
||||||
val cmd = new ArrayBuffer[String]
|
val cmd = new ArrayBuffer[String]
|
||||||
cmd += (getApplicationInfo.dataDir + "/kcptun"
|
cmd += (getApplicationInfo.dataDir + "/kcptun"
|
||||||
, "-r", profile.host + ":" + profile.kcpPort
|
, "-r", profile.host + ":" + profile.kcpPort
|
||||||
, "-l", "127.0.0.1:" + (profile.localPort + 90)
|
, "-l", "127.0.0.1:" + (profile.localPort + 90)
|
||||||
, "--path", getApplicationInfo.dataDir + "/protect_path"
|
, "--path", getApplicationInfo.dataDir + "/protect_path"
|
||||||
, profile.kcpcli)
|
, profile.kcpcli.trim)
|
||||||
|
|
||||||
if (BuildConfig.DEBUG)
|
if (BuildConfig.DEBUG)
|
||||||
Log.d(TAG, cmd.mkString(" "))
|
Log.d(TAG, cmd.mkString(" "))
|
||||||
@@ -275,6 +276,8 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
|||||||
|
|
||||||
if (profile.auth) cmd += "-A"
|
if (profile.auth) cmd += "-A"
|
||||||
|
|
||||||
|
if (profile.udpdns && !profile.kcp) cmd += "-u"
|
||||||
|
|
||||||
if (profile.route != Route.ALL) {
|
if (profile.route != Route.ALL) {
|
||||||
cmd += "--acl"
|
cmd += "--acl"
|
||||||
cmd += (getApplicationInfo.dataDir + "/acl.list")
|
cmd += (getApplicationInfo.dataDir + "/acl.list")
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ object DBHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DBHelper(val context: Context)
|
class DBHelper(val context: Context)
|
||||||
extends OrmLiteSqliteOpenHelper(context, DBHelper.PROFILE, null, 18) {
|
extends OrmLiteSqliteOpenHelper(context, DBHelper.PROFILE, null, 19) {
|
||||||
import DBHelper._
|
import DBHelper._
|
||||||
|
|
||||||
lazy val profileDao: Dao[Profile, Int] = getDao(classOf[Profile])
|
lazy val profileDao: Dao[Profile, Int] = getDao(classOf[Profile])
|
||||||
@@ -83,10 +83,11 @@ class DBHelper(val context: Context)
|
|||||||
}
|
}
|
||||||
if (oldVersion < 8) {
|
if (oldVersion < 8) {
|
||||||
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN udpdns SMALLINT;")
|
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN udpdns SMALLINT;")
|
||||||
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN route VARCHAR;")
|
|
||||||
}
|
}
|
||||||
if (oldVersion < 9) {
|
if (oldVersion < 9) {
|
||||||
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN route VARCHAR;")
|
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN route VARCHAR DEFAULT 'all';")
|
||||||
|
} else if (oldVersion < 19) {
|
||||||
|
profileDao.executeRawNoArgs("UPDATE `profile` SET route = 'all' WHERE route IS NULL;")
|
||||||
}
|
}
|
||||||
if (oldVersion < 10) {
|
if (oldVersion < 10) {
|
||||||
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN auth SMALLINT;")
|
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN auth SMALLINT;")
|
||||||
@@ -128,11 +129,13 @@ class DBHelper(val context: Context)
|
|||||||
|
|
||||||
if (oldVersion < 17) {
|
if (oldVersion < 17) {
|
||||||
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN kcp SMALLINT;")
|
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN kcp SMALLINT;")
|
||||||
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN kcpcli VARCHAR;")
|
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN kcpcli VARCHAR DEFAULT '';")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldVersion < 18) {
|
if (oldVersion < 18) {
|
||||||
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN kcpPort INTEGER;")
|
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN kcpPort INTEGER DEFAULT 8399;")
|
||||||
|
} else if (oldVersion < 19) {
|
||||||
|
profileDao.executeRawNoArgs("UPDATE `profile` SET kcpPort = 8399 WHERE kcpPort = 0;")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ package com.github.shadowsocks.preferences
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.preference.EditTextPreference
|
import android.preference.EditTextPreference
|
||||||
|
import android.text.TextUtils
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
|
||||||
class SummaryEditTextPreference(context: Context, attrs: AttributeSet, defStyle: Int)
|
class SummaryEditTextPreference(context: Context, attrs: AttributeSet, defStyle: Int)
|
||||||
@@ -57,7 +58,7 @@ class SummaryEditTextPreference(context: Context, attrs: AttributeSet, defStyle:
|
|||||||
}
|
}
|
||||||
|
|
||||||
override def setSummary(summary: CharSequence) {
|
override def setSummary(summary: CharSequence) {
|
||||||
if (summary.toString.isEmpty) {
|
if (TextUtils.isEmpty(summary)) {
|
||||||
super.setSummary(mDefaultSummary)
|
super.setSummary(mDefaultSummary)
|
||||||
} else {
|
} else {
|
||||||
super.setSummary(summary)
|
super.setSummary(summary)
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
export ARCH=`uname -m`
|
|
||||||
export ANDROID_NDK_HOME=$HOME/.android/android-ndk-r12b
|
|
||||||
export ANDROID_HOME=$HOME/.android/android-sdk-linux
|
|
||||||
export PATH=${ANDROID_NDK_HOME}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH}
|
|
||||||
|
|
||||||
if [ ! -d "$ANDROID_HOME" ]; then
|
|
||||||
mkdir -p $ANDROID_HOME
|
|
||||||
pushd $HOME/.android
|
|
||||||
wget -q http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
|
|
||||||
tar xf android-sdk_r24.4.1-linux.tgz
|
|
||||||
popd
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$ANDROID_NDK_HOME" ]; then
|
|
||||||
mkdir -p $ANDROID_NDK_HOME
|
|
||||||
pushd $HOME/.android
|
|
||||||
wget -q http://dl.google.com/android/repository/android-ndk-r12b-linux-${ARCH}.zip
|
|
||||||
unzip -q android-ndk-r12b-linux-${ARCH}.zip
|
|
||||||
popd
|
|
||||||
fi
|
|
||||||
|
|
||||||
( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk --filter tools,platform-tools,build-tools-24.0.0,android-23,android-24,extra-google-m2repository --no-ui -a
|
|
||||||
( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk --filter extra-android-m2repository --no-ui -a
|
|
||||||
Binary file not shown.
Reference in New Issue
Block a user