Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
a2841483
Commit
a2841483
authored
Apr 28, 2013
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine UI
parent
d5a3e6da
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
5 deletions
+79
-5
AndroidManifest.xml
AndroidManifest.xml
+2
-2
assets/fonts/Iceland.ttf
assets/fonts/Iceland.ttf
+0
-0
pom.xml
pom.xml
+2
-2
res/layout/layout_switch.xml
res/layout/layout_switch.xml
+11
-0
res/values/strings.xml
res/values/strings.xml
+1
-1
src/com/github/shadowsocks/Shadowsocks.java
src/com/github/shadowsocks/Shadowsocks.java
+34
-0
src/com/github/shadowsocks/Utils.java
src/com/github/shadowsocks/Utils.java
+29
-0
No files found.
AndroidManifest.xml
View file @
a2841483
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.github.shadowsocks"
package=
"com.github.shadowsocks"
android:installLocation=
"auto"
android:installLocation=
"auto"
android:versionCode=
"2
0
"
android:versionCode=
"2
1
"
android:versionName=
"1.3.
8
"
>
android:versionName=
"1.3.
9
"
>
<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"
/>
...
...
assets/fonts/Iceland.ttf
0 → 100644
View file @
a2841483
File added
pom.xml
View file @
a2841483
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.github.shadowsocks
</groupId>
<groupId>
com.github.shadowsocks
</groupId>
<artifactId>
shadowsocks
</artifactId>
<artifactId>
shadowsocks
</artifactId>
<version>
1.3.
8
</version>
<version>
1.3.
9
</version>
<packaging>
apk
</packaging>
<packaging>
apk
</packaging>
<name>
Shadowsocks
</name>
<name>
Shadowsocks
</name>
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
<dependency>
<dependency>
<groupId>
com.actionbarsherlock
</groupId>
<groupId>
com.actionbarsherlock
</groupId>
<artifactId>
actionbarsherlock
</artifactId>
<artifactId>
actionbarsherlock
</artifactId>
<version>
4.
3
.0
</version>
<version>
4.
2
.0
</version>
<type>
apklib
</type>
<type>
apklib
</type>
</dependency>
</dependency>
...
...
res/layout/layout_switch.xml
View file @
a2841483
...
@@ -4,6 +4,17 @@
...
@@ -4,6 +4,17 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
>
<TextView
android:id=
"@+id/title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:layout_marginLeft=
"24dp"
android:textSize=
"24sp"
android:text=
"@string/app_name"
android:layout_alignParentLeft=
"true"
android:layout_centerVertical=
"true"
/>
<org.jraf.android.backport.switchwidget.Switch
<org.jraf.android.backport.switchwidget.Switch
android:id=
"@+id/switchButton"
android:id=
"@+id/switchButton"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
...
res/values/strings.xml
View file @
a2841483
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<string
name=
"app_name"
>
S
hadowsocks
</string>
<string
name=
"app_name"
>
s
hadowsocks
</string>
<!-- function category -->
<!-- function category -->
<string
name=
"function_cat"
>
Service Controller
</string>
<string
name=
"function_cat"
>
Service Controller
</string>
...
...
src/com/github/shadowsocks/Shadowsocks.java
View file @
a2841483
...
@@ -40,6 +40,7 @@ package com.github.shadowsocks;
...
@@ -40,6 +40,7 @@ package com.github.shadowsocks;
import
android.app.AlertDialog
;
import
android.app.AlertDialog
;
import
android.app.ProgressDialog
;
import
android.app.ProgressDialog
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
...
@@ -47,6 +48,7 @@ import android.content.SharedPreferences.Editor;
...
@@ -47,6 +48,7 @@ import android.content.SharedPreferences.Editor;
import
android.content.SharedPreferences.OnSharedPreferenceChangeListener
;
import
android.content.SharedPreferences.OnSharedPreferenceChangeListener
;
import
android.content.pm.PackageManager.NameNotFoundException
;
import
android.content.pm.PackageManager.NameNotFoundException
;
import
android.content.res.AssetManager
;
import
android.content.res.AssetManager
;
import
android.graphics.Typeface
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.os.Message
;
...
@@ -55,6 +57,7 @@ import android.util.Log;
...
@@ -55,6 +57,7 @@ import android.util.Log;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
import
android.widget.CompoundButton
;
import
android.widget.CompoundButton
;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.actionbarsherlock.view.Menu
;
import
com.actionbarsherlock.view.Menu
;
import
com.actionbarsherlock.view.MenuItem
;
import
com.actionbarsherlock.view.MenuItem
;
...
@@ -67,6 +70,7 @@ import java.io.FileOutputStream;
...
@@ -67,6 +70,7 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.util.Hashtable
;
public
class
Shadowsocks
extends
UnifiedSherlockPreferenceActivity
public
class
Shadowsocks
extends
UnifiedSherlockPreferenceActivity
implements
CompoundButton
.
OnCheckedChangeListener
,
OnSharedPreferenceChangeListener
{
implements
CompoundButton
.
OnCheckedChangeListener
,
OnSharedPreferenceChangeListener
{
...
@@ -186,9 +190,16 @@ public class Shadowsocks extends UnifiedSherlockPreferenceActivity
...
@@ -186,9 +190,16 @@ public class Shadowsocks extends UnifiedSherlockPreferenceActivity
getSupportActionBar
().
setCustomView
(
switchLayout
);
getSupportActionBar
().
setCustomView
(
switchLayout
);
getSupportActionBar
().
setDisplayShowTitleEnabled
(
false
);
getSupportActionBar
().
setDisplayShowTitleEnabled
(
false
);
getSupportActionBar
().
setDisplayShowCustomEnabled
(
true
);
getSupportActionBar
().
setDisplayShowCustomEnabled
(
true
);
getSupportActionBar
().
setDisplayShowHomeEnabled
(
false
);
switchButton
=
(
Switch
)
switchLayout
.
findViewById
(
R
.
id
.
switchButton
);
switchButton
=
(
Switch
)
switchLayout
.
findViewById
(
R
.
id
.
switchButton
);
TextView
title
=
(
TextView
)
switchLayout
.
findViewById
(
R
.
id
.
title
);
Typeface
tf
=
Typefaces
.
get
(
this
,
"fonts/Iceland.ttf"
);
if
(
tf
!=
null
)
title
.
setTypeface
(
tf
);
title
.
setText
(
R
.
string
.
app_name
);
}
}
@Override
@Override
...
@@ -616,4 +627,27 @@ public class Shadowsocks extends UnifiedSherlockPreferenceActivity
...
@@ -616,4 +627,27 @@ public class Shadowsocks extends UnifiedSherlockPreferenceActivity
}
}
}
}
public
static
class
Typefaces
{
private
static
final
String
TAG
=
"Typefaces"
;
private
static
final
Hashtable
<
String
,
Typeface
>
cache
=
new
Hashtable
<
String
,
Typeface
>();
public
static
Typeface
get
(
Context
c
,
String
assetPath
)
{
synchronized
(
cache
)
{
if
(!
cache
.
containsKey
(
assetPath
))
{
try
{
Typeface
t
=
Typeface
.
createFromAsset
(
c
.
getAssets
(),
assetPath
);
cache
.
put
(
assetPath
,
t
);
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"Could not get typeface '"
+
assetPath
+
"' because "
+
e
.
getMessage
());
return
null
;
}
}
return
cache
.
get
(
assetPath
);
}
}
}
}
}
src/com/github/shadowsocks/Utils.java
View file @
a2841483
...
@@ -45,9 +45,14 @@ import android.content.pm.PackageManager.NameNotFoundException;
...
@@ -45,9 +45,14 @@ import android.content.pm.PackageManager.NameNotFoundException;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Environment
;
import
android.os.Environment
;
import
android.util.Log
;
import
android.util.Log
;
import
org.apache.http.conn.util.InetAddressUtils
;
import
java.io.*
;
import
java.io.*
;
import
java.net.InetAddress
;
import
java.net.NetworkInterface
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
public
class
Utils
{
public
class
Utils
{
...
@@ -71,6 +76,30 @@ public class Utils {
...
@@ -71,6 +76,30 @@ public class Utils {
private
static
String
iptables
=
null
;
private
static
String
iptables
=
null
;
private
static
String
data_path
=
null
;
private
static
String
data_path
=
null
;
/**
* Get IP address from first non-localhost interface
*/
public
static
boolean
isIPv6Support
()
{
try
{
List
<
NetworkInterface
>
interfaces
=
Collections
.
list
(
NetworkInterface
.
getNetworkInterfaces
());
for
(
NetworkInterface
intf
:
interfaces
)
{
List
<
InetAddress
>
addrs
=
Collections
.
list
(
intf
.
getInetAddresses
());
for
(
InetAddress
addr
:
addrs
)
{
if
(!
addr
.
isLoopbackAddress
())
{
String
sAddr
=
addr
.
getHostAddress
().
toUpperCase
();
boolean
isIPv6
=
InetAddressUtils
.
isIPv6Address
(
sAddr
);
if
(
isIPv6
)
{
return
true
;
}
}
}
}
}
catch
(
Exception
ex
)
{
// Ignore
}
// for now eat exceptions
return
false
;
}
public
static
String
getABI
()
{
public
static
String
getABI
()
{
String
abi
=
getSystemProperty
(
ABI_PROP
);
String
abi
=
getSystemProperty
(
ABI_PROP
);
if
(
abi
!=
null
)
{
if
(
abi
!=
null
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment