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
4d4d6ed1
Commit
4d4d6ed1
authored
Jan 23, 2017
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RESULT_FALLBACK to ConfigurationActivity
parent
a8222317
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
11 deletions
+29
-11
mobile/src/main/scala/com/github/shadowsocks/ProfileConfigFragment.scala
.../scala/com/github/shadowsocks/ProfileConfigFragment.scala
+17
-11
mobile/src/main/scala/com/github/shadowsocks/utils/Constants.scala
...c/main/scala/com/github/shadowsocks/utils/Constants.scala
+1
-0
plugin/src/main/java/com/github/shadowsocks/plugin/PluginContract.java
...in/java/com/github/shadowsocks/plugin/PluginContract.java
+3
-0
plugin/src/main/scala/com/github/shadowsocks/plugin/ConfigurationActivity.scala
...com/github/shadowsocks/plugin/ConfigurationActivity.scala
+8
-0
No files found.
mobile/src/main/scala/com/github/shadowsocks/ProfileConfigFragment.scala
View file @
4d4d6ed1
...
@@ -73,7 +73,7 @@ class ProfileConfigFragment extends PreferenceFragment with OnMenuItemClickListe
...
@@ -73,7 +73,7 @@ class ProfileConfigFragment extends PreferenceFragment with OnMenuItemClickListe
false
false
})
})
plugin
=
findPreference
(
Key
.
plugin
).
asInstanceOf
[
IconListPreference
]
plugin
=
findPreference
(
Key
.
plugin
).
asInstanceOf
[
IconListPreference
]
pluginConfigure
=
findPreference
(
"plugin.configure"
).
asInstanceOf
[
EditTextPreference
]
pluginConfigure
=
findPreference
(
Key
.
pluginConfigure
).
asInstanceOf
[
EditTextPreference
]
plugin
.
unknownValueSummary
=
getString
(
R
.
string
.
plugin_unknown
)
plugin
.
unknownValueSummary
=
getString
(
R
.
string
.
plugin_unknown
)
plugin
.
setOnPreferenceChangeListener
((
_
,
value
)
=>
{
plugin
.
setOnPreferenceChangeListener
((
_
,
value
)
=>
{
val
selected
=
value
.
asInstanceOf
[
String
]
val
selected
=
value
.
asInstanceOf
[
String
]
...
@@ -130,23 +130,29 @@ class ProfileConfigFragment extends PreferenceFragment with OnMenuItemClickListe
...
@@ -130,23 +130,29 @@ class ProfileConfigFragment extends PreferenceFragment with OnMenuItemClickListe
isProxyApps
.
setChecked
(
app
.
settings
.
getBoolean
(
Key
.
proxyApps
,
false
))
// fetch proxyApps updated by AppManager
isProxyApps
.
setChecked
(
app
.
settings
.
getBoolean
(
Key
.
proxyApps
,
false
))
// fetch proxyApps updated by AppManager
}
}
override
def
onDisplayPreferenceDialog
(
preference
:
Preference
)
:
Unit
=
if
(
preference
eq
pluginConfigure
)
{
private
def
showPluginEditor
()
{
val
selected
=
pluginConfiguration
.
selected
val
bundle
=
new
Bundle
()
val
intent
=
PluginManager
.
buildIntent
(
selected
,
PluginContract
.
ACTION_CONFIGURE
)
bundle
.
putString
(
PluginConfigurationDialogFragment
.
PLUGIN_ID_FRAGMENT_TAG
,
pluginConfiguration
.
selected
)
displayPreferenceDialog
(
Key
.
pluginConfigure
,
new
PluginConfigurationDialogFragment
,
bundle
)
}
override
def
onDisplayPreferenceDialog
(
preference
:
Preference
)
:
Unit
=
if
(
preference
.
getKey
==
Key
.
pluginConfigure
)
{
val
intent
=
PluginManager
.
buildIntent
(
pluginConfiguration
.
selected
,
PluginContract
.
ACTION_CONFIGURE
)
if
(
intent
.
resolveActivity
(
getActivity
.
getPackageManager
)
!=
null
)
if
(
intent
.
resolveActivity
(
getActivity
.
getPackageManager
)
!=
null
)
startActivityForResult
(
intent
.
putExtra
(
PluginContract
.
EXTRA_OPTIONS
,
startActivityForResult
(
intent
.
putExtra
(
PluginContract
.
EXTRA_OPTIONS
,
pluginConfiguration
.
selectedOptions
.
toString
),
REQUEST_CODE_PLUGIN_CONFIGURE
)
else
{
pluginConfiguration
.
selectedOptions
.
toString
),
REQUEST_CODE_PLUGIN_CONFIGURE
)
else
{
val
bundle
=
new
Bundle
()
showPluginEditor
()
bundle
.
putString
(
PluginConfigurationDialogFragment
.
PLUGIN_ID_FRAGMENT_TAG
,
selected
)
displayPreferenceDialog
(
preference
.
getKey
,
new
PluginConfigurationDialogFragment
,
bundle
)
}
}
}
else
super
.
onDisplayPreferenceDialog
(
preference
)
}
else
super
.
onDisplayPreferenceDialog
(
preference
)
override
def
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
)
:
Unit
=
requestCode
match
{
override
def
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
)
:
Unit
=
requestCode
match
{
case
REQUEST_CODE_PLUGIN_CONFIGURE
=>
if
(
resultCode
==
Activity
.
RESULT_OK
)
{
case
REQUEST_CODE_PLUGIN_CONFIGURE
=>
resultCode
match
{
val
options
=
data
.
getStringExtra
(
PluginContract
.
EXTRA_OPTIONS
)
case
Activity
.
RESULT_OK
=>
pluginConfigure
.
setText
(
options
)
val
options
=
data
.
getStringExtra
(
PluginContract
.
EXTRA_OPTIONS
)
onPluginConfigureChanged
(
null
,
options
)
pluginConfigure
.
setText
(
options
)
onPluginConfigureChanged
(
null
,
options
)
case
PluginContract
.
RESULT_FALLBACK
=>
showPluginEditor
()
case
_
=>
}
}
case
_
=>
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
case
_
=>
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
}
}
...
...
mobile/src/main/scala/com/github/shadowsocks/utils/Constants.scala
View file @
4d4d6ed1
...
@@ -152,6 +152,7 @@ object Key {
...
@@ -152,6 +152,7 @@ object Key {
val
remoteDns
=
"remoteDns"
val
remoteDns
=
"remoteDns"
val
plugin
=
"plugin"
val
plugin
=
"plugin"
val
pluginConfigure
=
"plugin.configure"
val
dirty
=
"profileDirty"
val
dirty
=
"profileDirty"
...
...
plugin/src/main/java/com/github/shadowsocks/plugin/PluginContract.java
View file @
4d4d6ed1
...
@@ -71,6 +71,9 @@ public final class PluginContract {
...
@@ -71,6 +71,9 @@ public final class PluginContract {
static
final
String
METHOD_GET_EXECUTABLE
=
"shadowsocks:getExecutable"
;
static
final
String
METHOD_GET_EXECUTABLE
=
"shadowsocks:getExecutable"
;
/** ConfigurationActivity result: fallback to manual edit mode. */
public
static
final
int
RESULT_FALLBACK
=
1
;
/**
/**
* Relative to the file to be copied. This column is required.
* Relative to the file to be copied. This column is required.
*
*
...
...
plugin/src/main/scala/com/github/shadowsocks/plugin/ConfigurationActivity.scala
View file @
4d4d6ed1
...
@@ -36,4 +36,12 @@ trait ConfigurationActivity extends OptionsCapableActivity {
...
@@ -36,4 +36,12 @@ trait ConfigurationActivity extends OptionsCapableActivity {
*/
*/
final
def
saveChanges
(
options
:
PluginOptions
)
:
Unit
=
final
def
saveChanges
(
options
:
PluginOptions
)
:
Unit
=
setResult
(
Activity
.
RESULT_OK
,
new
Intent
().
putExtra
(
PluginContract
.
EXTRA_OPTIONS
,
options
.
toString
))
setResult
(
Activity
.
RESULT_OK
,
new
Intent
().
putExtra
(
PluginContract
.
EXTRA_OPTIONS
,
options
.
toString
))
/**
* Finish this activity and request manual editor to pop up instead.
*/
final
def
fallbackToManualEditor
()
{
setResult
(
PluginContract
.
RESULT_FALLBACK
)
finish
()
}
}
}
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