Skip to content

Commit

Permalink
Merge pull request shadowsocks#1258 from shadowsocks/o-preview
Browse files Browse the repository at this point in the history
Support for Android O preview
  • Loading branch information
madeye authored Jul 19, 2017
2 parents 315aeae + 27c08e6 commit 3ddf747
Show file tree
Hide file tree
Showing 56 changed files with 633 additions and 341 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ jdk:

env:
global:
- NDK_VERSION=r14
- NDK_VERSION=r15b
- NDK_CCACHE=ccache
- GOROOT_BOOTSTRAP=$GOROOT
- ANDROID_NDK_HOME=$HOME/.android/android-ndk-${NDK_VERSION}
- SBTPATH=$HOME/.sbt
- PATH=${ANDROID_NDK_HOME}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH}

scala:
- 2.11.8
- 2.11.11

before_cache:
- find $HOME/.sbt -name "*.lock" | xargs rm
Expand All @@ -27,7 +27,7 @@ cache:
android:
components:
- tools
- build-tools-25.0.2
- build-tools-26.0.0
- extra-android-m2repository
- extra-google-m2repository

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ A [shadowsocks](http://shadowsocks.org) client for Android, written in Scala.
* SBT 0.13.0+
* Go 1.4+
* Android SDK
- Build Tools 25+
- Build Tools 26+
- Android Support Repository and Google Repository (see `build.sbt` for version)
- Android NDK r14+
- Android NDK r15+

### BUILD

Expand Down
8 changes: 5 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ lazy val commonSettings = Seq(

organization := "com.github.shadowsocks",

platformTarget := "android-25",
platformTarget := "android-26",

compileOrder := CompileOrder.JavaThenScala,
javacOptions ++= "-source" :: "1.7" :: "-target" :: "1.7" :: Nil,
Expand All @@ -18,10 +18,12 @@ lazy val commonSettings = Seq(
shrinkResources := true,
typedResources := false,

resConfigs := Seq("ja", "ko", "ru", "zh-rCN", "zh-rTW")
resConfigs := Seq("ja", "ko", "ru", "zh-rCN", "zh-rTW"),

resolvers += "google" at "https://maven.google.com"
)

val supportLibsVersion = "25.3.1"
val supportLibsVersion = "26.0.0-beta2"
lazy val root = Project(id = "shadowsocks-android", base = file("."))
.settings(commonSettings)
.aggregate(plugin, mobile)
Expand Down
19 changes: 10 additions & 9 deletions mobile/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ enablePlugins(AndroidGms)
android.useSupportVectors

name := "shadowsocks"
version := "4.1.7"
versionCode := Some(187)
version := "4.2.0"
versionCode := Some(190)

proguardOptions ++=
"-dontwarn com.google.android.gms.internal.**" ::
Expand All @@ -16,26 +16,27 @@ proguardOptions ++=
"-keep class com.github.shadowsocks.JniHelper { *; }" ::
Nil

val playServicesVersion = "10.2.6"
val playServicesVersion = "11.0.2"
resolvers += Resolver.jcenterRepo
libraryDependencies ++=
"com.futuremind.recyclerfastscroll" % "fastscroll" % "0.2.5" ::
"com.evernote" % "android-job" % "1.1.10" ::
"com.evernote" % "android-job" % "1.2.0-alpha3" ::
"com.github.jorgecastilloprz" % "fabprogresscircle" % "1.01" ::
"com.google.android.gms" % "play-services-ads" % playServicesVersion ::
"com.google.android.gms" % "play-services-analytics" % playServicesVersion ::
"com.google.android.gms" % "play-services-gcm" % playServicesVersion ::
"com.google.firebase" % "firebase-config" % playServicesVersion ::
"com.j256.ormlite" % "ormlite-android" % "5.0" ::
"com.mikepenz" % "crossfader" % "1.5.0" ::
"com.mikepenz" % "fastadapter" % "2.5.2" ::
"com.mikepenz" % "iconics-core" % "2.8.4" ::
"com.mikepenz" % "materialdrawer" % "5.9.1" ::
"com.mikepenz" % "materialize" % "1.0.1" ::
"com.squareup.okhttp3" % "okhttp" % "3.8.0" ::
"com.mikepenz" % "fastadapter" % "2.6.2" ::
"com.mikepenz" % "iconics-core" % "2.8.9" ::
"com.mikepenz" % "materialdrawer" % "5.9.4" ::
"com.mikepenz" % "materialize" % "1.0.2" ::
"com.squareup.okhttp3" % "okhttp" % "3.8.1" ::
"com.twofortyfouram" % "android-plugin-api-for-locale" % "1.0.2" ::
"dnsjava" % "dnsjava" % "2.1.8" ::
"eu.chainfire" % "libsuperuser" % "1.0.0.201704021214" ::
"me.dm7.barcodescanner" % "zxing" % "1.9.3" ::
"net.glxn.qrgen" % "android" % "2.0" ::
Nil

Expand Down
30 changes: 18 additions & 12 deletions mobile/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,30 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.CAMERA" />

<uses-feature android:name="android.hardware.touchscreen"
android:required="false"/>
<uses-feature android:name="android.hardware.nfc"
android:required="false"/>
<uses-feature android:name="android.software.leanback"
android:required="false"/>
<uses-feature android:name="android.hardware.camera"
android:required="false"/>

<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="25"/>
android:targetSdkVersion="26"/>

<meta-data android:name="android.webkit.WebView.EnableSafeBrowsing"
android:value="true" />

<application
android:name=".ShadowsocksApplication"
android:icon="@mipmap/ic_launcher"
android:backupAgent=".ShadowsocksBackupAgent"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:banner="@drawable/ic_start_connected">

<meta-data android:name="com.google.android.gms.version"
Expand Down Expand Up @@ -75,6 +82,12 @@
android:excludeFromRecents="true"
android:launchMode="singleTask"/>

<activity
android:name=".ScannerActivity"
android:label="@string/add_profile_methods_scan_qr_code"
android:parentActivityName=".MainActivity"
android:excludeFromRecents="true"/>

<activity android:name=".TaskerActivity"
android:icon="@mipmap/ic_launcher">
<intent-filter>
Expand All @@ -87,18 +100,14 @@
android:label="@string/quick_toggle"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:excludeFromRecents="true"
android:taskAffinity=""
android:taskAffinity=""
android:process=":bg"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
</intent-filter>
</activity>

<service
android:name=".ShadowsocksRunnerService"
android:exported="false">
</service>

<service
android:name=".ShadowsocksNatService"
android:process=":bg"
Expand All @@ -125,13 +134,13 @@
</intent-filter>
</service>

<receiver android:name=".BootReceiver" android:enabled="false">
<receiver android:name=".BootReceiver" android:process=":bg" android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>

<receiver android:name=".TaskerReceiver" tools:ignore="ExportedReceiver">
<receiver android:name=".TaskerReceiver" android:process=":bg" tools:ignore="ExportedReceiver">
<intent-filter>
<action android:name="com.twofortyfouram.locale.intent.action.FIRE_SETTING"/>
</intent-filter>
Expand All @@ -150,9 +159,6 @@
android:process=":bg"/>
<receiver android:name="com.evernote.android.job.JobBootReceiver"
android:process=":bg"/>

<!-- Strip useless components -->
<activity android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity" tools:node="remove"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@ interface IShadowsocksService {
oneway void startListeningForBandwidth(IShadowsocksServiceCallback cb);
oneway void stopListeningForBandwidth(IShadowsocksServiceCallback cb);
oneway void unregisterCallback(IShadowsocksServiceCallback cb);

oneway void use(in int profileId);
void useSync(in int profileId);
}
Binary file modified mobile/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
android:startColor="#19000000"
android:endColor="#00000000"
android:startX="46.15"
android:endX="108"
android:startY="40.34"
android:endY="102.18"
android:type="linear"/>
13 changes: 13 additions & 0 deletions mobile/src/main/res/drawable-anydpi-v24/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector android:height="108dp" android:viewportHeight="108.0"
android:viewportWidth="108.0" android:width="108dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/ic_launcher_foreground_shadow"
android:pathData="M70.94,35.7l37.06,36.3l0,36l-23.92,0l-53.02,-52.57l39.88,-19.73l0,0"/>
<path android:fillAlpha="0.79" android:fillColor="#fff"
android:pathData="M70.94,35.7l-6.94,30.53l-15.56,-5l13.74,-16.38l-18.31,15.4l-12.81,-4.82l39.88,-19.73z"/>
<path android:fillAlpha="0.79" android:fillColor="#fff"
android:pathData="M48.79,64.37l4.96,1.6l-4.94,6.73l-0.02,-8.33z"/>
<path android:fillAlpha="0.79" android:fillColor="#fff"
android:pathData="M70.94,35.7l-6.94,30.53l-15.56,-5l13.74,-16.38l-18.31,15.4l-12.81,-4.82l39.88,-19.73z"/>
<path android:fillAlpha="0.79" android:fillColor="#fff"
android:pathData="M48.79,64.37l4.96,1.6l-4.94,6.73l-0.02,-8.33z"/>
</vector>
12 changes: 12 additions & 0 deletions mobile/src/main/res/layout/layout_scanner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar_light_dark" />
<me.dm7.barcodescanner.zxing.ZXingScannerView android:id="@+id/scanner"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
5 changes: 5 additions & 0 deletions mobile/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified mobile/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion mobile/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<string name="add_profile_methods_scan_qr_code">"QR コードを読み取る"</string>
<string name="add_profile_methods_manual_settings">"手動設定"</string>
<string name="add_profile_scanner_not_installed">"Zxingに準拠したQRコードスキャンアプリをインストールして下さい"</string>
<string name="add_profile_scanner_permission_required">QRコードを読み取るにはカメラの使用権限が必要です。</string>
<plurals name="removed">
<item quantity="other">"削除済み"</item>
</plurals>
Expand Down Expand Up @@ -132,4 +133,4 @@
<string name="plugin_unknown">"不明なプラグイン"</string>
<string name="plugin_untrusted">"警告:このプラグインは信頼されていないソースからの可能性があります"</string>
<string name="profile_plugin">"プラグイン"</string>
</resources>
</resources>
3 changes: 2 additions & 1 deletion mobile/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<string name="add_profile_methods_scan_qr_code">"Сканировать QR-код"</string>
<string name="add_profile_methods_manual_settings">"Ручные настройки"</string>
<string name="add_profile_scanner_not_installed">"Пожалуйста, установите любое ZXing-совместимое приложение для сканирования QR-кодов."</string>
<string name="add_profile_scanner_permission_required">Разрешение камеры требуется для сканирования QR код.</string>
<plurals name="removed">
<item quantity="one">"Удалено"</item>
<item quantity="few">"Удалено %d элемента"</item>
Expand Down Expand Up @@ -140,4 +141,4 @@
<string name="plugin_unknown">"Неизвестный плагин %s"</string>
<string name="plugin_untrusted">"Предупреждение: этот плагин получен из недоверенного источника."</string>
<string name="profile_plugin">"Плагин: %s"</string>
</resources>
</resources>
3 changes: 2 additions & 1 deletion mobile/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<string name="add_profile_methods_scan_qr_code">"扫描二维码"</string>
<string name="add_profile_methods_manual_settings">"手动设置"</string>
<string name="add_profile_scanner_not_installed">"请安装任意兼容 ZXing 的二维码扫描应用。"</string>
<string name="add_profile_scanner_permission_required">扫描二维码需要相机权限。</string>
<plurals name="removed">
<item quantity="other">"已删除 %d 项"</item>
</plurals>
Expand Down Expand Up @@ -133,4 +134,4 @@
<string name="plugin_unknown">"未知插件 %s"</string>
<string name="plugin_untrusted">"警告:该插件似乎并非来自已知的可信源。"</string>
<string name="profile_plugin">"插件:%s"</string>
</resources>
</resources>
1 change: 1 addition & 0 deletions mobile/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<string name="add_profile_methods_scan_qr_code">"掃描 QR 碼"</string>
<string name="add_profile_methods_manual_settings">"手動設定"</string>
<string name="add_profile_scanner_not_installed">"請安裝任何相容 ZXing 的 QR 碼掃描應用程式。"</string>
<string name="add_profile_scanner_permission_required">掃描 QR 碼需要相機權限。</string>
<plurals name="removed">
<item quantity="other">"已移除 %d 項"</item>
</plurals>
Expand Down
4 changes: 4 additions & 0 deletions mobile/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#7488A1</color>
</resources>
3 changes: 3 additions & 0 deletions mobile/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="udp_dns_summary">Forward all DNS requests to remote</string>

<!-- notification category -->
<string name="service_vpn">VPN Service</string>
<string name="service_nat">NAT Service</string>
<string name="forward_success">Shadowsocks started.</string>
<string name="invalid_server">Invalid server name</string>
<string name="service_failed">Failed to connect the remote server</string>
Expand Down Expand Up @@ -104,6 +106,7 @@
<string name="add_profile_methods_scan_qr_code">Scan QR code</string>
<string name="add_profile_methods_manual_settings">Manual Settings</string>
<string name="add_profile_scanner_not_installed">Please install any ZXing-compliant QR code scanning app.</string>
<string name="add_profile_scanner_permission_required">Camera permission is required for scanning QR code.</string>
<plurals name="removed">
<item quantity="one">Removed</item>
<item quantity="other">%d items removed</item>
Expand Down
4 changes: 4 additions & 0 deletions mobile/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="false"/>
</network-security-config>
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AboutFragment extends ToolbarFragment {
override def onViewCreated(view: View, savedInstanceState: Bundle) {
super.onViewCreated(view, savedInstanceState)
toolbar.setTitle(getString(R.string.about_title).formatLocal(Locale.ENGLISH, BuildConfig.VERSION_NAME))
val web = view.findViewById(R.id.web_view).asInstanceOf[WebView]
val web = view.findViewById[WebView](R.id.web_view)
web.loadUrl("file:///android_asset/pages/about.html")
web.setWebViewClient(new WebViewClient() {
override def shouldOverrideUrlLoading(view: WebView, url: String): Boolean = {
Expand Down
Loading

0 comments on commit 3ddf747

Please sign in to comment.