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
afd91b71
Commit
afd91b71
authored
Dec 15, 2014
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #186
parent
e10272c8
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
87 additions
and
8 deletions
+87
-8
src/main/res/menu/app_manager_menu.xml
src/main/res/menu/app_manager_menu.xml
+8
-0
src/main/res/values-zh/strings.xml
src/main/res/values-zh/strings.xml
+7
-0
src/main/res/values/colors.xml
src/main/res/values/colors.xml
+2
-1
src/main/res/values/strings.xml
src/main/res/values/strings.xml
+6
-0
src/main/res/values/styles_shadow.xml
src/main/res/values/styles_shadow.xml
+15
-4
src/main/scala/com/github/shadowsocks/AppManager.scala
src/main/scala/com/github/shadowsocks/AppManager.scala
+49
-3
No files found.
src/main/res/menu/app_manager_menu.xml
0 → 100644
View file @
afd91b71
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@+id/action_export"
android:title=
"@string/action_export"
android:showAsAction=
"never"
/>
<item
android:id=
"@+id/action_import"
android:title=
"@string/action_import"
android:showAsAction=
"never"
/>
</menu>
src/main/res/values-zh/strings.xml
View file @
afd91b71
...
...
@@ -88,4 +88,11 @@
<item>
绕过局域网及中国大陆地址
</item>
</string-array>
<string
name=
"action_export"
>
导出至剪贴板
</string>
<string
name=
"action_import"
>
从剪贴板导入
</string>
<string
name=
"action_export_msg"
>
导出成功
</string>
<string
name=
"action_export_err"
>
导出失败
</string>
<string
name=
"action_import_msg"
>
导入成功
</string>
<string
name=
"action_import_err"
>
导入失败
</string>
</resources>
src/main/res/values/colors.xml
View file @
afd91b71
...
...
@@ -4,6 +4,7 @@
<color
name=
"title_background"
>
#ff5e5e5e
</color>
<color
name=
"dialog_title_background"
>
#17170443
</color>
<color
name=
"white"
>
#FFFFFF
</color>
<color
name=
"black"
>
#000000
</color>
<color
name=
"grey1"
>
#646464
</color>
<color
name=
"grey2"
>
#c8c8c8
</color>
...
...
src/main/res/values/strings.xml
View file @
afd91b71
...
...
@@ -86,6 +86,12 @@
<string
name=
"flush_dnscache"
>
Flush DNS Cache
</string>
<string
name=
"flushing"
>
Flushing
</string>
<string
name=
"add_profile"
>
Add Profile
</string>
<string
name=
"action_export"
>
Export to Clipboard
</string>
<string
name=
"action_import"
>
Import from Clipboard
</string>
<string
name=
"action_export_msg"
>
Successfully export!
</string>
<string
name=
"action_export_err"
>
Failed to export.
</string>
<string
name=
"action_import_msg"
>
Successfully import!
</string>
<string
name=
"action_import_err"
>
Failed to import.
</string>
<!-- profile -->
<string
name=
"add_profile_dialog"
>
Add this Shadowsocks Profile?
</string>
...
...
src/main/res/values/styles_shadow.xml
View file @
afd91b71
...
...
@@ -29,10 +29,10 @@
<item
name=
"android:actionModeBackground"
>
@drawable/cab_background_top_shadow
</item>
<item
name=
"android:actionModeSplitBackground"
>
@drawable/cab_background_bottom_shadow
</item>
<item
name=
"android:actionModeCloseButtonStyle"
>
@style/ActionButton.CloseMode.Shadow
</item>
<!-- Light.DarkActionBar specific -->
<item
name=
"android:actionBarWidgetTheme"
>
@style/Theme.Shadow.Widget
</item>
<item
name=
"android:textAppearanceLargePopupMenu"
>
@style/m_textAppearanceLargePopupMenu
</item>
<item
name=
"android:textAppearanceSmallPopupMenu"
>
@style/m_textAppearanceSmallPopupMenu
</item>
</style>
<style
name=
"ActionBar.Solid.Shadow"
parent=
"@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"
>
...
...
@@ -51,6 +51,14 @@
<item
name=
"android:popupBackground"
>
@drawable/menu_dropdown_panel_shadow
</item>
</style>
<style
name=
"m_textAppearanceSmallPopupMenu"
parent=
"@android:style/TextAppearance.Holo.Widget.PopupMenu.Small"
>
<item
name=
"android:textColor"
>
@android:color/white
</item>
</style>
<style
name=
"m_textAppearanceLargePopupMenu"
parent=
"@android:style/TextAppearance.Holo.Widget.PopupMenu.Large"
>
<item
name=
"android:textColor"
>
@android:color/white
</item>
</style>
<style
name=
"DropDownListView.Shadow"
parent=
"@android:style/Widget.Holo.ListView.DropDown"
>
<item
name=
"android:listSelector"
>
@drawable/selectable_background_shadow
</item>
</style>
...
...
@@ -77,6 +85,9 @@
<style
name=
"Theme.Shadow.Widget"
parent=
"@android:style/Theme.Holo"
>
<item
name=
"android:popupMenuStyle"
>
@style/PopupMenu.Shadow
</item>
<item
name=
"android:dropDownListViewStyle"
>
@style/DropDownListView.Shadow
</item>
<item
name=
"android:textColor"
>
@android:color/white
</item>
<item
name=
"android:textAppearanceLargePopupMenu"
>
@style/m_textAppearanceLargePopupMenu
</item>
<item
name=
"android:textAppearanceSmallPopupMenu"
>
@style/m_textAppearanceSmallPopupMenu
</item>
</style>
</resources>
src/main/scala/com/github/shadowsocks/AppManager.scala
View file @
afd91b71
...
...
@@ -40,6 +40,8 @@
package
com.github.shadowsocks
import
android.app.
{
Activity
,
ProgressDialog
}
import
android.content.ClipboardManager
import
android.content.ClipData
import
android.content.Context
import
android.content.SharedPreferences
import
android.content.pm.PackageManager
...
...
@@ -47,6 +49,8 @@ import android.graphics.{Bitmap, PixelFormat}
import
android.os.Bundle
import
android.os.Handler
import
android.preference.PreferenceManager
import
android.view.Menu
import
android.view.MenuItem
import
android.view.View
import
android.view.View.OnClickListener
import
android.view.ViewGroup
...
...
@@ -115,7 +119,7 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
var
appsLoaded
:
Boolean
=
false
def
loadApps
(
context
:
Context
)
:
Array
[
ProxiedApp
]
=
{
val
prefs
:
SharedPreferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
)
val
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
)
val
proxiedAppString
=
prefs
.
getString
(
Key
.
proxied
,
""
)
val
proxiedApps
=
proxiedAppString
.
split
(
'|'
).
sortWith
(
_
<
_
)
...
...
@@ -218,6 +222,48 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
}
}
protected
override
def
onOptionsItemSelected
(
item
:
MenuItem
)
:
Boolean
=
{
val
clipboard
=
getSystemService
(
Context
.
CLIPBOARD_SERVICE
).
asInstanceOf
[
ClipboardManager
]
val
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getBaseContext
)
item
.
getItemId
match
{
case
R
.
id
.
action_export
=>
val
proxiedAppString
=
prefs
.
getString
(
Key
.
proxied
,
""
)
val
clip
=
ClipData
.
newPlainText
(
Key
.
proxied
,
proxiedAppString
)
clipboard
.
setPrimaryClip
(
clip
)
Toast
.
makeText
(
this
,
R
.
string
.
action_export_msg
,
Toast
.
LENGTH_SHORT
).
show
()
return
true
case
R
.
id
.
action_import
=>
if
(
clipboard
.
hasPrimaryClip
)
{
val
clipdata
=
clipboard
.
getPrimaryClip
val
label
=
clipdata
.
getDescription
.
getLabel
if
(
label
==
Key
.
proxied
)
{
val
proxiedAppSequence
=
clipdata
.
getItemAt
(
0
).
getText
if
(
proxiedAppSequence
!=
null
)
{
val
proxiedAppString
=
proxiedAppSequence
.
toString
if
(!
proxiedAppString
.
isEmpty
)
{
Toast
.
makeText
(
this
,
R
.
string
.
action_import_msg
,
Toast
.
LENGTH_SHORT
).
show
()
prefs
.
edit
.
putString
(
Key
.
proxied
,
proxiedAppString
).
commit
()
// Restart activity
val
intent
=
getIntent
finish
()
startActivity
(
intent
)
return
true
}
}
}
}
Toast
.
makeText
(
this
,
R
.
string
.
action_import_err
,
Toast
.
LENGTH_SHORT
).
show
()
return
false
}
super
.
onOptionsItemSelected
(
item
)
}
protected
override
def
onCreateOptionsMenu
(
menu
:
Menu
)
:
Boolean
=
{
val
inflater
=
getMenuInflater
()
inflater
.
inflate
(
R
.
menu
.
app_manager_menu
,
menu
)
return
super
.
onCreateOptionsMenu
(
menu
)
}
protected
override
def
onCreate
(
savedInstanceState
:
Bundle
)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -239,7 +285,7 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
ImageLoader
.
getInstance
().
init
(
config
)
val
bypassSwitch
=
findViewById
(
R
.
id
.
bypassSwitch
).
asInstanceOf
[
Switch
]
val
prefs
:
SharedPreferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
getBaseContext
)
val
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getBaseContext
)
bypassSwitch
.
setOnCheckedChangeListener
(
new
OnCheckedChangeListener
{
def
onCheckedChanged
(
button
:
CompoundButton
,
checked
:
Boolean
)
{
prefs
.
edit
().
putBoolean
(
Key
.
isBypassApps
,
checked
).
commit
()
...
...
@@ -261,7 +307,7 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
def
saveAppSettings
(
context
:
Context
)
{
if
(
apps
==
null
)
return
val
prefs
:
SharedPreferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
)
val
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
)
val
proxiedApps
=
new
StringBuilder
apps
.
foreach
(
app
=>
if
(
app
.
proxied
)
{
...
...
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