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
8598e5a1
Commit
8598e5a1
authored
Sep 30, 2013
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix UI on tablet
parent
9bcf54aa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
13 deletions
+43
-13
src/main/res/values/strings.xml
src/main/res/values/strings.xml
+1
-1
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+29
-9
src/main/scala/com/github/shadowsocks/database/Profile.scala
src/main/scala/com/github/shadowsocks/database/Profile.scala
+2
-2
src/main/scala/com/github/shadowsocks/database/ProfileManager.scala
...cala/com/github/shadowsocks/database/ProfileManager.scala
+11
-1
No files found.
src/main/res/values/strings.xml
View file @
8598e5a1
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
<string
name=
"loading"
>
Loading…
</string>
<string
name=
"loading"
>
Loading…
</string>
<string
name=
"yes"
>
Yes
</string>
<string
name=
"yes"
>
Yes
</string>
<string
name=
"no"
>
No
</string>
<string
name=
"no"
>
No
</string>
<string
name=
"remove_profile"
>
Remove this profile?
</string>
<string
name=
"remove_profile"
>
Remove this profile
: %s
?
</string>
<!-- menu category -->
<!-- menu category -->
<string
name=
"recovery"
>
Reset
</string>
<string
name=
"recovery"
>
Reset
</string>
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
8598e5a1
...
@@ -529,6 +529,7 @@ class Shadowsocks
...
@@ -529,6 +529,7 @@ class Shadowsocks
if
(!
status
.
getBoolean
(
getVersionName
,
false
))
{
if
(!
status
.
getBoolean
(
getVersionName
,
false
))
{
status
.
edit
.
putBoolean
(
getVersionName
,
true
).
apply
()
status
.
edit
.
putBoolean
(
getVersionName
,
true
).
apply
()
reset
()
reset
()
Shadowsocks
.
currentProfile
=
profileManager
.
create
()
}
}
handler
.
sendEmptyMessage
(
MSG_INITIAL_FINISH
)
handler
.
sendEmptyMessage
(
MSG_INITIAL_FINISH
)
}
}
...
@@ -567,14 +568,20 @@ class Shadowsocks
...
@@ -567,14 +568,20 @@ class Shadowsocks
handler
.
postDelayed
(
new
Runnable
{
handler
.
postDelayed
(
new
Runnable
{
def
run
()
{
def
run
()
{
Shadowsocks
.
currentProfile
=
profileManager
.
reload
(
id
)
Shadowsocks
.
currentProfile
=
profileManager
.
reload
(
id
)
updatePreferenceScreen
()
profileManager
.
save
()
profileManager
.
save
()
menuAdapter
.
updateList
(
getMenuList
,
Shadowsocks
.
currentProfile
.
id
)
menuAdapter
.
updateList
(
getMenuList
,
Shadowsocks
.
currentProfile
.
id
)
if
(!
isSinglePane
)
{
sendBroadcast
(
new
Intent
(
Action
.
UPDATE_FRAGMENT
))
}
else
{
updatePreferenceScreen
()
}
h
.
sendEmptyMessage
(
0
)
h
.
sendEmptyMessage
(
0
)
}
}
},
600
)
},
600
)
if
(!
isSinglePane
)
sendBroadcast
(
new
Intent
(
Action
.
UPDATE_FRAGMENT
))
}
}
def
updateProfile
(
id
:
Int
)
{
def
updateProfile
(
id
:
Int
)
{
...
@@ -585,21 +592,30 @@ class Shadowsocks
...
@@ -585,21 +592,30 @@ class Shadowsocks
handler
.
postDelayed
(
new
Runnable
{
handler
.
postDelayed
(
new
Runnable
{
def
run
()
{
def
run
()
{
Shadowsocks
.
currentProfile
=
profileManager
.
reload
(
id
)
Shadowsocks
.
currentProfile
=
profileManager
.
reload
(
id
)
updatePreferenceScreen
()
menuAdapter
.
setActiveId
(
id
)
menuAdapter
.
setActiveId
(
id
)
menuAdapter
.
notifyDataSetChanged
()
menuAdapter
.
notifyDataSetChanged
()
if
(!
isSinglePane
)
{
sendBroadcast
(
new
Intent
(
Action
.
UPDATE_FRAGMENT
))
}
else
{
updatePreferenceScreen
()
}
h
.
sendEmptyMessage
(
0
)
h
.
sendEmptyMessage
(
0
)
}
}
},
600
)
},
600
)
if
(!
isSinglePane
)
sendBroadcast
(
new
Intent
(
Action
.
UPDATE_FRAGMENT
))
}
}
def
delProfile
(
id
:
Int
)
:
Boolean
=
{
def
delProfile
(
id
:
Int
)
:
Boolean
=
{
drawer
.
closeMenu
(
true
)
drawer
.
closeMenu
(
true
)
val
profile
=
profileManager
.
getProfile
(
id
)
if
(!
profile
.
isDefined
)
return
false
new
AlertDialog
.
Builder
(
this
)
new
AlertDialog
.
Builder
(
this
)
.
setMessage
(
R
.
string
.
remove_profile
)
.
setMessage
(
String
.
format
(
getString
(
R
.
string
.
remove_profile
),
profile
.
get
.
name
)
)
.
setCancelable
(
false
)
.
setCancelable
(
false
)
.
setNegativeButton
(
R
.
string
.
no
,
new
DialogInterface
.
OnClickListener
()
{
.
setNegativeButton
(
R
.
string
.
no
,
new
DialogInterface
.
OnClickListener
()
{
override
def
onClick
(
dialog
:
DialogInterface
,
i
:
Int
)
=
dialog
.
cancel
()
override
def
onClick
(
dialog
:
DialogInterface
,
i
:
Int
)
=
dialog
.
cancel
()
...
@@ -612,14 +628,18 @@ class Shadowsocks
...
@@ -612,14 +628,18 @@ class Shadowsocks
if
(
profiles
.
isEmpty
)
-
1
else
profiles
(
0
).
id
if
(
profiles
.
isEmpty
)
-
1
else
profiles
(
0
).
id
}
}
Shadowsocks
.
currentProfile
=
profileManager
.
load
(
profileId
)
Shadowsocks
.
currentProfile
=
profileManager
.
load
(
profileId
)
updatePreferenceScreen
()
menuAdapter
.
updateList
(
getMenuList
,
Shadowsocks
.
currentProfile
.
id
)
menuAdapter
.
updateList
(
getMenuList
,
Shadowsocks
.
currentProfile
.
id
)
if
(!
isSinglePane
)
{
sendBroadcast
(
new
Intent
(
Action
.
UPDATE_FRAGMENT
))
}
else
{
updatePreferenceScreen
()
}
dialog
.
dismiss
()
dialog
.
dismiss
()
}
}
}).
create
().
show
()
}).
create
().
show
()
if
(!
isSinglePane
)
sendBroadcast
(
new
Intent
(
Action
.
UPDATE_FRAGMENT
))
true
true
}
}
...
@@ -636,7 +656,7 @@ class Shadowsocks
...
@@ -636,7 +656,7 @@ class Shadowsocks
buf
++=
getProfileList
buf
++=
getProfileList
buf
+=
new
Item
(-
1
,
getString
(
R
.
string
.
add_profile
),
android
.
R
.
drawable
.
ic_menu_add
,
addProfile
)
buf
+=
new
Item
(-
400
,
getString
(
R
.
string
.
add_profile
),
android
.
R
.
drawable
.
ic_menu_add
,
addProfile
)
buf
+=
new
Category
(
"Settings"
)
buf
+=
new
Category
(
"Settings"
)
...
...
src/main/scala/com/github/shadowsocks/database/Profile.scala
View file @
8598e5a1
...
@@ -73,10 +73,10 @@ class Profile {
...
@@ -73,10 +73,10 @@ class Profile {
var
download
:
Int
=
0
var
download
:
Int
=
0
@DatabaseField
@DatabaseField
var
chnroute
:
Boolean
=
fals
e
var
chnroute
:
Boolean
=
tru
e
@DatabaseField
@DatabaseField
var
global
:
Boolean
=
fals
e
var
global
:
Boolean
=
tru
e
@DatabaseField
@DatabaseField
var
bypass
:
Boolean
=
false
var
bypass
:
Boolean
=
false
...
...
src/main/scala/com/github/shadowsocks/database/ProfileManager.scala
View file @
8598e5a1
...
@@ -133,7 +133,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
...
@@ -133,7 +133,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
profile
profile
}
}
def
save
()
:
Profile
=
{
private
def
loadFromPreferences
:
Profile
=
{
val
profile
=
new
Profile
()
val
profile
=
new
Profile
()
profile
.
id
=
settings
.
getInt
(
Key
.
profileId
,
-
1
)
profile
.
id
=
settings
.
getInt
(
Key
.
profileId
,
-
1
)
...
@@ -162,8 +162,18 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
...
@@ -162,8 +162,18 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
}
}
profile
.
individual
=
settings
.
getString
(
Key
.
proxied
,
""
)
profile
.
individual
=
settings
.
getString
(
Key
.
proxied
,
""
)
profile
}
def
save
()
:
Profile
=
{
val
profile
=
loadFromPreferences
updateProfile
(
profile
)
updateProfile
(
profile
)
profile
}
def
create
()
:
Profile
=
{
val
profile
=
loadFromPreferences
createOrUpdateProfile
(
profile
)
profile
profile
}
}
}
}
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