Commit a03ef5df authored by Mygod's avatar Mygod

Initial commit for plugin-lib

parent f6bbaa72
...@@ -17,9 +17,30 @@ lazy val commonSettings = Seq( ...@@ -17,9 +17,30 @@ lazy val commonSettings = Seq(
typedResources := false typedResources := false
) )
lazy val shadowsocks = project.in(file(".")) val supportLibsVersion = "25.1.0"
lazy val root = Project(id = "shadowsocks-android", base = file("."))
.settings(commonSettings) .settings(commonSettings)
.aggregate(mobile) .aggregate(pluginLib, mobile)
install in Android := (install in (mobile, Android)).value
run in Android := (run in (mobile, Android)).evaluated
lazy val pluginLib = Project(id = "plugin-lib", base = file("plugin-lib"))
.settings(commonSettings)
.settings(
libraryDependencies ++=
"com.android.support" % "preference-v14" % supportLibsVersion ::
Nil
)
lazy val mobile = project lazy val mobile = project
.settings(commonSettings) .settings(commonSettings)
.settings(
libraryDependencies ++=
"com.android.support" % "cardview-v7" % supportLibsVersion ::
"com.android.support" % "customtabs" % supportLibsVersion ::
"com.android.support" % "design" % supportLibsVersion ::
"com.android.support" % "gridlayout-v7" % supportLibsVersion ::
Nil
)
.dependsOn(pluginLib)
...@@ -6,6 +6,12 @@ version := "4.0.0" ...@@ -6,6 +6,12 @@ version := "4.0.0"
versionCode := Some(174) versionCode := Some(174)
proguardOptions ++= proguardOptions ++=
"-keep class android.support.v14.preference.SwitchPreference { <init>(...); }" ::
"-keep class android.support.v7.preference.DropDownPreference { <init>(...); }" ::
"-keep class android.support.v7.preference.PreferenceScreen { <init>(...); }" ::
"-keep class be.mygod.preference.EditTextPreference { <init>(...); }" ::
"-keep class be.mygod.preference.NumberPickerPreference { <init>(...); }" ::
"-keep class be.mygod.preference.PreferenceCategory { <init>(...); }" ::
"-keep class com.github.shadowsocks.System { *; }" :: "-keep class com.github.shadowsocks.System { *; }" ::
"-dontwarn com.google.android.gms.internal.**" :: "-dontwarn com.google.android.gms.internal.**" ::
"-dontwarn com.j256.ormlite.**" :: "-dontwarn com.j256.ormlite.**" ::
...@@ -15,15 +21,9 @@ proguardOptions ++= ...@@ -15,15 +21,9 @@ proguardOptions ++=
resConfigs := Seq("ja", "ru", "zh-rCN", "zh-rTW") resConfigs := Seq("ja", "ru", "zh-rCN", "zh-rTW")
val supportLibsVersion = "25.1.0"
val playServicesVersion = "10.0.1" val playServicesVersion = "10.0.1"
resolvers += Resolver.jcenterRepo resolvers += Resolver.jcenterRepo
libraryDependencies ++= libraryDependencies ++=
"com.android.support" % "cardview-v7" % supportLibsVersion ::
"com.android.support" % "customtabs" % supportLibsVersion ::
"com.android.support" % "design" % supportLibsVersion ::
"com.android.support" % "gridlayout-v7" % supportLibsVersion ::
"com.android.support" % "preference-v14" % supportLibsVersion ::
"com.futuremind.recyclerfastscroll" % "fastscroll" % "0.2.5" :: "com.futuremind.recyclerfastscroll" % "fastscroll" % "0.2.5" ::
"com.evernote" % "android-job" % "1.1.4" :: "com.evernote" % "android-job" % "1.1.4" ::
"com.github.jorgecastilloprz" % "fabprogresscircle" % "1.01" :: "com.github.jorgecastilloprz" % "fabprogresscircle" % "1.01" ::
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
android:roundIcon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher"
android:backupAgent=".ShadowsocksBackupAgent" android:backupAgent=".ShadowsocksBackupAgent"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/Theme.Material"
android:banner="@drawable/ic_start_connected"> android:banner="@drawable/ic_start_connected">
<meta-data android:name="com.google.android.gms.version" <meta-data android:name="com.google.android.gms.version"
......
...@@ -4,8 +4,4 @@ ...@@ -4,8 +4,4 @@
<attr name="bounded_width" format="dimension" /> <attr name="bounded_width" format="dimension" />
<attr name="bounded_height" format="dimension" /> <attr name="bounded_height" format="dimension" />
</declare-styleable> </declare-styleable>
<declare-styleable name="NumberPickerPreference">
<attr name="max" format="integer" />
<attr name="min" format="integer" />
</declare-styleable>
</resources> </resources>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="Theme.Shadowsocks.Material" parent="MaterialDrawerTheme.Light.DarkToolbar">
<style name="Toolbar.Logo" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textSize">24sp</item>
</style>
<style name="Theme.MaterialBase" parent="MaterialDrawerTheme.Light.DarkToolbar">
<!--suppress NewApi -->
<item name="android:navigationBarColor">@color/material_primary_700</item>
<item name="colorAccent">@color/material_accent_200</item>
<item name="colorButtonNormal">@color/material_accent_200</item>
<item name="colorPrimary">@color/material_primary_500</item>
<item name="colorPrimaryDark">@color/material_primary_700</item>
<item name="preferenceTheme">@style/Theme.Material.PreferenceThemeOverlay</item>
<item name="material_drawer_selected_text">@color/material_accent_200</item> <item name="material_drawer_selected_text">@color/material_accent_200</item>
</style> </style>
<style name="Theme.Material.Dialog" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">@color/material_primary_500</item>
<item name="colorButtonNormal">@color/material_accent_200</item>
<item name="colorPrimary">@color/material_primary_500</item>
<item name="colorPrimaryDark">@color/material_primary_700</item>
<item name="preferenceTheme">@style/Theme.Material.PreferenceThemeOverlay</item>
<item name="windowNoTitle">true</item>
</style>
<!-- Fix for wrong padding on v17-v20 based on: https://github.com/Gericop/Android-Support-Preference-V7-Fix/blob/a6082cb/preference-v7/src/main/res/values-v17/styles.xml -->
<style name="Theme.Material" parent="Theme.MaterialBase">
<item name="android:listPreferredItemPaddingStart">16dp</item>
<item name="android:listPreferredItemPaddingEnd">16dp</item>
</style>
<!-- This is needed because the default PreferenceCategory appearance doesn't use bold text style -->
<style name="Preference_TextAppearanceMaterialBody2">
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="Theme.Material.PreferenceThemeOverlay" parent="@style/PreferenceThemeOverlay.v14.Material">
<item name="preferenceFragmentListStyle">@style/Theme.Material.PreferenceFragmentList</item>
</style>
<style name="Theme.Material.PreferenceFragmentList" parent="@style/PreferenceFragmentList.Material">
<item name="android:fadeScrollbars">true</item>
<item name="android:scrollbars">vertical</item>
</style>
<style name="NumberPickerStyle">
<item name="android:textSize">14sp</item>
</style>
<style name="StyledScrollerTextAppearance" parent="@android:style/TextAppearance"> <style name="StyledScrollerTextAppearance" parent="@android:style/TextAppearance">
<item name="android:textSize">24sp</item> <item name="android:textSize">24sp</item>
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
<item name="android:textColor">@android:color/white</item> <item name="android:textColor">@android:color/white</item>
</style> </style>
</resources> </resources>
...@@ -127,10 +127,10 @@ class DBHelper(val context: Context) ...@@ -127,10 +127,10 @@ class DBHelper(val context: Context)
profileDao.executeRawNoArgs("ALTER TABLE `profile` RENAME TO `tmp`;") profileDao.executeRawNoArgs("ALTER TABLE `profile` RENAME TO `tmp`;")
TableUtils.createTable(connectionSource, classOf[Profile]) TableUtils.createTable(connectionSource, classOf[Profile])
profileDao.executeRawNoArgs( profileDao.executeRawNoArgs(
"INSERT INTO `profile`(id, name, host, localPort, remotePort, password, method, route, proxyApps, bypass," + "INSERT INTO `profile`(id, name, host, localPort, remotePort, password, method, route, remoteDns, proxyApps," +
" udpdns, auth, ipv6, individual, tx, rx, date, userOrder, plugin) " + " bypass, udpdns, auth, ipv6, individual, tx, rx, date, userOrder, plugin) " +
"SELECT id, name, host, localPort, CASE WHEN kcp = 1 THEN kcpPort ELSE remotePort END, password, method, " + "SELECT id, name, host, localPort, CASE WHEN kcp = 1 THEN kcpPort ELSE remotePort END, password, method, " +
"route, proxyApps, bypass, udpdns, auth, ipv6, individual, tx, rx, date, userOrder, " + "route, remoteDns, proxyApps, bypass, udpdns, auth, ipv6, individual, tx, rx, date, userOrder, " +
"CASE WHEN kcp = 1 THEN 'kcptun ' || kcpcli ELSE NULL END FROM `tmp`;") "CASE WHEN kcp = 1 THEN 'kcptun ' || kcpcli ELSE NULL END FROM `tmp`;")
profileDao.executeRawNoArgs("DROP TABLE `tmp`;") profileDao.executeRawNoArgs("DROP TABLE `tmp`;")
profileDao.executeRawNoArgs("COMMIT;") profileDao.executeRawNoArgs("COMMIT;")
......
enablePlugins(AndroidLib)
android.useSupportVectors
name := "plugin"
version := "0.0.1-SNAPSHOT"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.shadowsocks.plugin">
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="25"/>
<application
android:theme="@style/Theme.Shadowsocks">
<meta-data android:name="com.github.shadowsocks.plugin.version"
android:value="0.0.1"/>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="Theme.Material" parent="Theme.MaterialBase"/> <style name="Theme.Shadowsocks" parent="Theme.ShadowsocksBase"/>
</resources> </resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="NumberPickerPreference">
<attr name="max" format="integer" />
<attr name="min" format="integer" />
</declare-styleable>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Shadowsocks.Material" parent="Theme.AppCompat.Light.NoActionBar"/>
<style name="Theme.ShadowsocksBase" parent="Theme.Shadowsocks.Material">
<!--suppress NewApi -->
<item name="android:navigationBarColor">@color/material_primary_700</item>
<item name="colorAccent">@color/material_accent_200</item>
<item name="colorButtonNormal">@color/material_accent_200</item>
<item name="colorPrimary">@color/material_primary_500</item>
<item name="colorPrimaryDark">@color/material_primary_700</item>
<item name="preferenceTheme">@style/Theme.Shadowsocks.PreferenceThemeOverlay</item>
</style>
<style name="Theme.Shadowsocks.Dialog" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">@color/material_primary_500</item>
<item name="colorButtonNormal">@color/material_accent_200</item>
<item name="colorPrimary">@color/material_primary_500</item>
<item name="colorPrimaryDark">@color/material_primary_700</item>
<item name="preferenceTheme">@style/Theme.Shadowsocks.PreferenceThemeOverlay</item>
<item name="windowNoTitle">true</item>
</style>
<!-- Fix for wrong padding on v17-v20 based on: https://github.com/Gericop/Android-Support-Preference-V7-Fix/blob/a6082cb/preference-v7/src/main/res/values-v17/styles.xml -->
<style name="Theme.Shadowsocks" parent="Theme.ShadowsocksBase">
<item name="android:listPreferredItemPaddingStart">16dp</item>
<item name="android:listPreferredItemPaddingEnd">16dp</item>
</style>
<!-- This is needed because the default PreferenceCategory appearance doesn't use bold text style -->
<style name="Preference_TextAppearanceMaterialBody2">
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="Theme.Shadowsocks.PreferenceThemeOverlay" parent="@style/PreferenceThemeOverlay.v14.Material">
<item name="preferenceFragmentListStyle">@style/Theme.Shadowsocks.PreferenceFragmentList</item>
</style>
<style name="Theme.Shadowsocks.PreferenceFragmentList" parent="@style/PreferenceFragmentList.Material">
<item name="android:fadeScrollbars">true</item>
<item name="android:scrollbars">vertical</item>
</style>
<style name="NumberPickerStyle">
<item name="android:textSize">14sp</item>
</style>
</resources>
...@@ -26,7 +26,7 @@ import android.support.v7.preference.DialogPreference ...@@ -26,7 +26,7 @@ import android.support.v7.preference.DialogPreference
import android.util.AttributeSet import android.util.AttributeSet
import android.view.ContextThemeWrapper import android.view.ContextThemeWrapper
import android.widget.NumberPicker import android.widget.NumberPicker
import com.github.shadowsocks.R import com.github.shadowsocks.plugin.R
class NumberPickerPreference(private val context: Context, attrs: AttributeSet = null) class NumberPickerPreference(private val context: Context, attrs: AttributeSet = null)
extends DialogPreference(context, attrs) with DialogPreferencePlus with SummaryPreference { extends DialogPreference(context, attrs) with DialogPreferencePlus with SummaryPreference {
......
...@@ -28,7 +28,7 @@ import android.support.v4.content.ContextCompat ...@@ -28,7 +28,7 @@ import android.support.v4.content.ContextCompat
import android.support.v4.view.ViewCompat import android.support.v4.view.ViewCompat
import android.support.v7.preference.{PreferenceGroup, PreferenceViewHolder, PreferenceGroupAdapter => Old} import android.support.v7.preference.{PreferenceGroup, PreferenceViewHolder, PreferenceGroupAdapter => Old}
import android.view.{LayoutInflater, View, ViewGroup} import android.view.{LayoutInflater, View, ViewGroup}
import com.github.shadowsocks.R import com.github.shadowsocks.plugin.R
/** /**
* Fix by: https://github.com/Gericop/Android-Support-Preference-V7-Fix/commit/7de016b007e28a264001a8bb353f110a7f64bb69 * Fix by: https://github.com/Gericop/Android-Support-Preference-V7-Fix/commit/7de016b007e28a264001a8bb353f110a7f64bb69
......
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