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
75bc9334
Commit
75bc9334
authored
Mar 22, 2018
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1691
parent
ec803d98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
mobile/src/main/java/com/github/shadowsocks/ProfileConfigFragment.kt
...main/java/com/github/shadowsocks/ProfileConfigFragment.kt
+7
-11
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
.../src/main/java/com/github/shadowsocks/ProfilesFragment.kt
+6
-4
No files found.
mobile/src/main/java/com/github/shadowsocks/ProfileConfigFragment.kt
View file @
75bc9334
...
@@ -56,7 +56,7 @@ class ProfileConfigFragment : PreferenceFragmentCompatDividers(), Toolbar.OnMenu
...
@@ -56,7 +56,7 @@ class ProfileConfigFragment : PreferenceFragmentCompatDividers(), Toolbar.OnMenu
private
const
val
REQUEST_CODE_PLUGIN_CONFIGURE
=
1
private
const
val
REQUEST_CODE_PLUGIN_CONFIGURE
=
1
}
}
private
lateinit
var
profile
:
Profile
private
var
profileId
=
-
1
private
lateinit
var
isProxyApps
:
SwitchPreference
private
lateinit
var
isProxyApps
:
SwitchPreference
private
lateinit
var
plugin
:
IconListPreference
private
lateinit
var
plugin
:
IconListPreference
private
lateinit
var
pluginConfigure
:
EditTextPreference
private
lateinit
var
pluginConfigure
:
EditTextPreference
...
@@ -66,13 +66,7 @@ class ProfileConfigFragment : PreferenceFragmentCompatDividers(), Toolbar.OnMenu
...
@@ -66,13 +66,7 @@ class ProfileConfigFragment : PreferenceFragmentCompatDividers(), Toolbar.OnMenu
override
fun
onCreatePreferencesFix
(
savedInstanceState
:
Bundle
?,
rootKey
:
String
?)
{
override
fun
onCreatePreferencesFix
(
savedInstanceState
:
Bundle
?,
rootKey
:
String
?)
{
preferenceManager
.
preferenceDataStore
=
DataStore
.
privateStore
preferenceManager
.
preferenceDataStore
=
DataStore
.
privateStore
val
activity
=
requireActivity
()
val
activity
=
requireActivity
()
val
profile
=
ProfileManager
.
getProfile
(
activity
.
intent
.
getIntExtra
(
Action
.
EXTRA_PROFILE_ID
,
-
1
))
profileId
=
activity
.
intent
.
getIntExtra
(
Action
.
EXTRA_PROFILE_ID
,
-
1
)
if
(
profile
==
null
)
{
activity
.
finish
()
return
}
this
.
profile
=
profile
profile
.
serialize
()
addPreferencesFromResource
(
R
.
xml
.
pref_profile
)
addPreferencesFromResource
(
R
.
xml
.
pref_profile
)
if
(
Build
.
VERSION
.
SDK_INT
>=
25
&&
activity
.
getSystemService
(
UserManager
::
class
.
java
).
isDemoUser
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
25
&&
activity
.
getSystemService
(
UserManager
::
class
.
java
).
isDemoUser
)
{
findPreference
(
Key
.
host
).
summary
=
"shadowsocks.example.org"
findPreference
(
Key
.
host
).
summary
=
"shadowsocks.example.org"
...
@@ -130,10 +124,12 @@ class ProfileConfigFragment : PreferenceFragmentCompatDividers(), Toolbar.OnMenu
...
@@ -130,10 +124,12 @@ class ProfileConfigFragment : PreferenceFragmentCompatDividers(), Toolbar.OnMenu
}
}
fun
saveAndExit
()
{
fun
saveAndExit
()
{
val
profile
=
Profile
()
profile
.
id
=
profileId
profile
.
deserialize
()
profile
.
deserialize
()
ProfileManager
.
updateProfile
(
profile
)
ProfileManager
.
updateProfile
(
profile
)
ProfilesFragment
.
instance
?.
profilesAdapter
?.
deepRefreshId
(
profile
.
i
d
)
ProfilesFragment
.
instance
?.
profilesAdapter
?.
deepRefreshId
(
profile
I
d
)
if
(
DataStore
.
profileId
==
profile
.
i
d
&&
DataStore
.
directBootAware
)
DirectBoot
.
update
()
if
(
DataStore
.
profileId
==
profile
I
d
&&
DataStore
.
directBootAware
)
DirectBoot
.
update
()
requireActivity
().
finish
()
requireActivity
().
finish
()
}
}
...
@@ -187,7 +183,7 @@ class ProfileConfigFragment : PreferenceFragmentCompatDividers(), Toolbar.OnMenu
...
@@ -187,7 +183,7 @@ class ProfileConfigFragment : PreferenceFragmentCompatDividers(), Toolbar.OnMenu
AlertDialog
.
Builder
(
activity
)
AlertDialog
.
Builder
(
activity
)
.
setTitle
(
R
.
string
.
delete_confirm_prompt
)
.
setTitle
(
R
.
string
.
delete_confirm_prompt
)
.
setPositiveButton
(
R
.
string
.
yes
,
{
_
,
_
->
.
setPositiveButton
(
R
.
string
.
yes
,
{
_
,
_
->
ProfileManager
.
delProfile
(
profile
.
i
d
)
ProfileManager
.
delProfile
(
profile
I
d
)
activity
.
finish
()
activity
.
finish
()
})
})
.
setNegativeButton
(
R
.
string
.
no
,
null
)
.
setNegativeButton
(
R
.
string
.
no
,
null
)
...
...
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
View file @
75bc9334
...
@@ -123,7 +123,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
...
@@ -123,7 +123,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
private
var
adView
:
AdView
?
=
null
private
var
adView
:
AdView
?
=
null
init
{
init
{
edit
.
setOnClickListener
{
startConfig
(
item
.
id
)
}
edit
.
setOnClickListener
{
startConfig
(
item
)
}
TooltipCompat
.
setTooltipText
(
edit
,
edit
.
contentDescription
)
TooltipCompat
.
setTooltipText
(
edit
,
edit
.
contentDescription
)
itemView
.
setOnClickListener
(
this
)
itemView
.
setOnClickListener
(
this
)
val
share
=
itemView
.
findViewById
<
View
>(
R
.
id
.
share
)
val
share
=
itemView
.
findViewById
<
View
>(
R
.
id
.
share
)
...
@@ -307,8 +307,10 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
...
@@ -307,8 +307,10 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
private
val
clipboard
by
lazy
{
requireContext
().
getSystemService
(
Context
.
CLIPBOARD_SERVICE
)
as
ClipboardManager
}
private
val
clipboard
by
lazy
{
requireContext
().
getSystemService
(
Context
.
CLIPBOARD_SERVICE
)
as
ClipboardManager
}
private
fun
startConfig
(
id
:
Int
)
=
startActivity
(
Intent
(
context
,
ProfileConfigActivity
::
class
.
java
)
private
fun
startConfig
(
profile
:
Profile
)
{
.
putExtra
(
Action
.
EXTRA_PROFILE_ID
,
id
))
profile
.
serialize
()
startActivity
(
Intent
(
context
,
ProfileConfigActivity
::
class
.
java
).
putExtra
(
Action
.
EXTRA_PROFILE_ID
,
profile
.
id
))
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
=
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
=
inflater
.
inflate
(
R
.
layout
.
layout_list
,
container
,
false
)
inflater
.
inflate
(
R
.
layout
.
layout_list
,
container
,
false
)
...
@@ -379,7 +381,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
...
@@ -379,7 +381,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
true
true
}
}
R
.
id
.
action_manual_settings
->
{
R
.
id
.
action_manual_settings
->
{
startConfig
(
ProfileManager
.
createProfile
()
.
id
)
startConfig
(
ProfileManager
.
createProfile
())
true
true
}
}
R
.
id
.
action_export
->
{
R
.
id
.
action_export
->
{
...
...
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