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
bf9b3f4f
Commit
bf9b3f4f
authored
Nov 09, 2015
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide root summary if rooted
parent
5f0b1a50
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
21 deletions
+13
-21
src/main/res/values-zh/strings.xml
src/main/res/values-zh/strings.xml
+1
-1
src/main/res/values/strings.xml
src/main/res/values/strings.xml
+1
-1
src/main/res/xml/pref_all.xml
src/main/res/xml/pref_all.xml
+1
-2
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
...in/scala/com/github/shadowsocks/ShadowsocksSettings.scala
+6
-2
src/main/scala/com/github/shadowsocks/utils/Utils.scala
src/main/scala/com/github/shadowsocks/utils/Utils.scala
+4
-15
No files found.
src/main/res/values-zh/strings.xml
View file @
bf9b3f4f
...
...
@@ -56,7 +56,7 @@
<string
name=
"about"
>
关于
</string>
<string
name=
"about_title"
>
影梭(shadowsocks)%s
</string>
<string
name=
"flush_dnscache"
>
刷新 DNS 缓存
</string>
<string
name=
"flush_dnscache_summary"
>
需要 ROOT 权限
</string>
<string
name=
"flush_dnscache_summary
_disabled
"
>
需要 ROOT 权限
</string>
<string
name=
"flushing"
>
刷新中……
</string>
<string
name=
"qrcode"
>
二维码
</string>
<string
name=
"add_profile"
>
添加配置文件
</string>
...
...
src/main/res/values/strings.xml
View file @
bf9b3f4f
...
...
@@ -80,7 +80,7 @@
<string
name=
"about_title"
>
Shadowsocks %s
</string>
<string
name=
"qrcode"
>
QR Code
</string>
<string
name=
"flush_dnscache"
>
Flush DNS cache
</string>
<string
name=
"flush_dnscache_summary"
>
Requires ROOT permission
</string>
<string
name=
"flush_dnscache_summary
_disabled
"
>
Requires ROOT permission
</string>
<string
name=
"flushing"
>
Flushing
</string>
<string
name=
"add_profile"
>
Add Profile
</string>
<string
name=
"action_export"
>
Export to Clipboard
</string>
...
...
src/main/res/xml/pref_all.xml
View file @
bf9b3f4f
...
...
@@ -104,8 +104,7 @@
android:summary=
"@string/nat_summary"
/>
<Preference
android:key=
"recovery"
android:title=
"@string/recovery"
android:summary=
"@string/recovery_summary"
/>
<Preference
android:key=
"flush_dnscache"
android:title=
"@string/flush_dnscache"
android:summary=
"@string/flush_dnscache_summary"
/>
<Preference
android:key=
"flush_dnscache"
android:title=
"@string/flush_dnscache"
/>
<Preference
android:key=
"about"
android:title=
"@string/about"
/>
</PreferenceCategory>
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
View file @
bf9b3f4f
...
...
@@ -5,7 +5,7 @@ import java.util.Locale
import
android.app.AlertDialog
import
android.content.
{
DialogInterface
,
Intent
}
import
android.net.Uri
import
android.os.
Bundle
import
android.os.
{
Build
,
Bundle
}
import
android.preference.
{
Preference
,
PreferenceFragment
}
import
android.webkit.
{
WebViewClient
,
WebView
}
import
com.github.shadowsocks.utils.Key
...
...
@@ -30,7 +30,11 @@ class ShadowsocksSettings extends PreferenceFragment {
true
})
findPreference
(
"flush_dnscache"
).
setOnPreferenceClickListener
((
preference
:
Preference
)
=>
{
val
flush
=
findPreference
(
"flush_dnscache"
)
if
(
Build
.
VERSION
.
SDK_INT
>=
17
&&
!
ShadowsocksApplication
.
isRoot
)
{
flush
.
setEnabled
(
false
)
flush
.
setSummary
(
R
.
string
.
flush_dnscache_summary_disabled
)
}
else
flush
.
setOnPreferenceClickListener
((
preference
:
Preference
)
=>
{
ShadowsocksApplication
.
track
(
Shadowsocks
.
TAG
,
"flush_dnscache"
)
activity
.
flushDnsCache
()
true
...
...
src/main/scala/com/github/shadowsocks/utils/Utils.scala
View file @
bf9b3f4f
...
...
@@ -55,7 +55,7 @@ import android.util.{DisplayMetrics, Base64, Log}
import
android.view.View.MeasureSpec
import
android.view.
{
Gravity
,
View
,
Window
}
import
android.widget.Toast
import
com.github.shadowsocks.
BuildConfig
import
com.github.shadowsocks.
{
ShadowsocksApplication
,
BuildConfig
}
import
org.xbill.DNS._
...
...
@@ -155,24 +155,13 @@ object Utils {
// Blocked > 3 seconds
def
toggleAirplaneMode
(
context
:
Context
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
17
)
{
toggleAboveApiLevel17
(
)
}
else
{
if
(
ShadowsocksApplication
.
isRoot
)
{
Console
.
runRootCommand
(
Array
(
"ndc resolver flushdefaultif"
,
"ndc resolver flushif wlan0"
)
)
}
else
if
(
Build
.
VERSION
.
SDK_INT
<
17
)
{
toggleBelowApiLevel17
(
context
)
}
}
private
def
toggleAboveApiLevel17
()
{
// Android 4.2 and above
Console
.
runRootCommand
(
Array
(
"ndc resolver flushdefaultif"
,
"ndc resolver flushif wlan0"
))
//Utils.runRootCommand("settings put global airplane_mode_on 1\n"
// + "am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true\n"
// + "settings put global airplane_mode_on 0\n"
// + "am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false\n")
}
//noinspection ScalaDeprecation
private
def
toggleBelowApiLevel17
(
context
:
Context
)
{
// Android 4.2 below
...
...
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