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
642f4ded
Commit
642f4ded
authored
Jun 28, 2013
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shuffle dns records
parent
bb9c0dab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+2
-2
src/main/scala/com/github/shadowsocks/Utils.scala
src/main/scala/com/github/shadowsocks/Utils.scala
+7
-5
No files found.
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
642f4ded
...
@@ -42,9 +42,9 @@ import android.content._
...
@@ -42,9 +42,9 @@ import android.content._
import
android.content.res.AssetManager
import
android.content.res.AssetManager
import
android.graphics.Typeface
import
android.graphics.Typeface
import
android.os._
import
android.os._
import
android.preference.
{
CheckBoxPreference
,
Preference
,
PreferenceManager
}
import
android.preference.
{
Preference
,
PreferenceManager
}
import
android.util.Log
import
android.util.Log
import
android.view.
{
View
Group
,
View
Parent
,
KeyEvent
}
import
android.view.
{
ViewParent
,
KeyEvent
}
import
android.widget.
{
LinearLayout
,
CompoundButton
,
RelativeLayout
,
TextView
}
import
android.widget.
{
LinearLayout
,
CompoundButton
,
RelativeLayout
,
TextView
}
import
com.actionbarsherlock.view.Menu
import
com.actionbarsherlock.view.Menu
import
com.actionbarsherlock.view.MenuItem
import
com.actionbarsherlock.view.MenuItem
...
...
src/main/scala/com/github/shadowsocks/Utils.scala
View file @
642f4ded
...
@@ -41,7 +41,6 @@ import android.content.{Intent, SharedPreferences, Context}
...
@@ -41,7 +41,6 @@ import android.content.{Intent, SharedPreferences, Context}
import
android.content.pm.ApplicationInfo
import
android.content.pm.ApplicationInfo
import
android.content.pm.PackageManager
import
android.content.pm.PackageManager
import
android.graphics.drawable.
{
BitmapDrawable
,
Drawable
}
import
android.graphics.drawable.
{
BitmapDrawable
,
Drawable
}
import
android.os.Environment
import
android.util.Log
import
android.util.Log
import
java.io._
import
java.io._
import
java.net.
{
UnknownHostException
,
InetAddress
,
NetworkInterface
}
import
java.net.
{
UnknownHostException
,
InetAddress
,
NetworkInterface
}
...
@@ -264,8 +263,9 @@ object Utils {
...
@@ -264,8 +263,9 @@ object Utils {
val
resolver
=
new
SimpleResolver
(
"8.8.8.8"
)
val
resolver
=
new
SimpleResolver
(
"8.8.8.8"
)
resolver
.
setTimeout
(
5
)
resolver
.
setTimeout
(
5
)
lookup
.
setResolver
(
resolver
)
lookup
.
setResolver
(
resolver
)
val
records
=
lookup
.
run
()
val
result
=
lookup
.
run
()
if
(
records
==
null
)
return
None
if
(
result
==
null
)
return
None
val
records
=
scala
.
util
.
Random
.
shuffle
(
result
.
toList
)
for
(
r
<-
records
)
{
for
(
r
<-
records
)
{
addrType
match
{
addrType
match
{
case
Type
.
A
=>
case
Type
.
A
=>
...
@@ -426,8 +426,10 @@ object Utils {
...
@@ -426,8 +426,10 @@ object Utils {
}
}
def
drawableToBitmap
(
drawable
:
Drawable
)
:
Bitmap
=
{
def
drawableToBitmap
(
drawable
:
Drawable
)
:
Bitmap
=
{
if
(
drawable
.
isInstanceOf
[
BitmapDrawable
])
{
drawable
match
{
return
drawable
.
asInstanceOf
[
BitmapDrawable
].
getBitmap
case
d
:
BitmapDrawable
=>
return
d
.
getBitmap
case
_
=>
}
}
val
width
=
if
(
drawable
.
getIntrinsicWidth
>
0
)
drawable
.
getIntrinsicWidth
else
1
val
width
=
if
(
drawable
.
getIntrinsicWidth
>
0
)
drawable
.
getIntrinsicWidth
else
1
...
...
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