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
b3bab982
Commit
b3bab982
authored
Jan 23, 2017
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix HelpCallback
parent
6fb7330e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
22 deletions
+28
-22
mobile/src/main/scala/com/github/shadowsocks/ProfileConfigActivity.scala
.../scala/com/github/shadowsocks/ProfileConfigActivity.scala
+16
-1
mobile/src/main/scala/com/github/shadowsocks/ProfileConfigFragment.scala
.../scala/com/github/shadowsocks/ProfileConfigFragment.scala
+3
-3
mobile/src/main/scala/com/github/shadowsocks/preference/PluginConfigurationDialogFragment.scala
...wsocks/preference/PluginConfigurationDialogFragment.scala
+5
-16
plugin/src/main/scala/com/github/shadowsocks/plugin/HelpCallback.scala
...in/scala/com/github/shadowsocks/plugin/HelpCallback.scala
+4
-2
No files found.
mobile/src/main/scala/com/github/shadowsocks/ProfileConfigActivity.scala
View file @
b3bab982
...
...
@@ -21,14 +21,21 @@
package
com.github.shadowsocks
import
android.app.Activity
import
android.content.
DialogInterface
import
android.content.
{
DialogInterface
,
Intent
}
import
android.os.Bundle
import
android.support.v7.app.AlertDialog
import
android.support.v7.widget.Toolbar
import
com.github.shadowsocks.ShadowsocksApplication.app
import
com.github.shadowsocks.plugin.PluginContract
import
com.github.shadowsocks.utils.Key
object
ProfileConfigActivity
{
final
val
REQUEST_CODE_PLUGIN_HELP
=
1
}
class
ProfileConfigActivity
extends
Activity
{
import
ProfileConfigActivity._
private
lazy
val
child
=
getFragmentManager
.
findFragmentById
(
R
.
id
.
content
).
asInstanceOf
[
ProfileConfigFragment
]
override
def
onCreate
(
savedInstanceState
:
Bundle
)
{
...
...
@@ -49,4 +56,12 @@ class ProfileConfigActivity extends Activity {
.
setNeutralButton
(
android
.
R
.
string
.
cancel
,
null
)
.
create
()
.
show
()
else
super
.
onBackPressed
()
override
def
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
)
:
Unit
=
requestCode
match
{
case
REQUEST_CODE_PLUGIN_HELP
=>
if
(
resultCode
==
Activity
.
RESULT_OK
)
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
"?"
)
.
setMessage
(
data
.
getCharSequenceExtra
(
PluginContract
.
EXTRA_HELP_MESSAGE
))
.
show
()
case
_
=>
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
}
}
mobile/src/main/scala/com/github/shadowsocks/ProfileConfigFragment.scala
View file @
b3bab982
...
...
@@ -39,7 +39,7 @@ import com.github.shadowsocks.preference.{IconListPreference, PluginConfiguratio
import
com.github.shadowsocks.utils.
{
Action
,
Key
,
Utils
}
object
ProfileConfigFragment
{
private
final
val
REQUEST_CODE_CONFIGURE
=
1
private
final
val
REQUEST_CODE_
PLUGIN_
CONFIGURE
=
1
}
class
ProfileConfigFragment
extends
PreferenceFragment
with
OnMenuItemClickListener
...
...
@@ -135,7 +135,7 @@ class ProfileConfigFragment extends PreferenceFragment with OnMenuItemClickListe
val
intent
=
PluginManager
.
buildIntent
(
selected
,
PluginContract
.
ACTION_CONFIGURE
)
if
(
intent
.
resolveActivity
(
getActivity
.
getPackageManager
)
!=
null
)
startActivityForResult
(
intent
.
putExtra
(
PluginContract
.
EXTRA_OPTIONS
,
pluginConfiguration
.
selectedOptions
.
toString
),
REQUEST_CODE_CONFIGURE
)
else
{
pluginConfiguration
.
selectedOptions
.
toString
),
REQUEST_CODE_
PLUGIN_
CONFIGURE
)
else
{
val
bundle
=
new
Bundle
()
bundle
.
putString
(
PluginConfigurationDialogFragment
.
PLUGIN_ID_FRAGMENT_TAG
,
selected
)
displayPreferenceDialog
(
preference
.
getKey
,
new
PluginConfigurationDialogFragment
,
bundle
)
...
...
@@ -143,7 +143,7 @@ class ProfileConfigFragment extends PreferenceFragment with OnMenuItemClickListe
}
else
super
.
onDisplayPreferenceDialog
(
preference
)
override
def
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
)
:
Unit
=
requestCode
match
{
case
REQUEST_CODE_CONFIGURE
=>
if
(
resultCode
==
Activity
.
RESULT_OK
)
{
case
REQUEST_CODE_
PLUGIN_
CONFIGURE
=>
if
(
resultCode
==
Activity
.
RESULT_OK
)
{
val
options
=
data
.
getStringExtra
(
PluginContract
.
EXTRA_OPTIONS
)
pluginConfigure
.
setText
(
options
)
onPluginConfigureChanged
(
null
,
options
)
...
...
mobile/src/main/scala/com/github/shadowsocks/preference/PluginConfigurationDialogFragment.scala
View file @
b3bab982
...
...
@@ -20,9 +20,10 @@
package
com.github.shadowsocks.preference
import
android.app.
{
Activity
,
AlertDialog
}
import
android.content.
{
DialogInterface
,
Intent
}
import
android.app.
AlertDialog
import
android.content.
DialogInterface
import
be.mygod.preference.EditTextPreferenceDialogFragment
import
com.github.shadowsocks.ProfileConfigActivity
import
com.github.shadowsocks.plugin.
{
PluginContract
,
PluginManager
}
/**
...
...
@@ -30,7 +31,6 @@ import com.github.shadowsocks.plugin.{PluginContract, PluginManager}
*/
object
PluginConfigurationDialogFragment
{
final
val
PLUGIN_ID_FRAGMENT_TAG
=
"com.github.shadowsocks.preference.PluginConfigurationDialogFragment.PLUGIN_ID"
private
final
val
REQUEST_CODE_HELP
=
1
}
class
PluginConfigurationDialogFragment
extends
EditTextPreferenceDialogFragment
{
...
...
@@ -40,18 +40,7 @@ class PluginConfigurationDialogFragment extends EditTextPreferenceDialogFragment
super
.
onPrepareDialogBuilder
(
builder
)
val
intent
=
PluginManager
.
buildIntent
(
getArguments
.
getString
(
PLUGIN_ID_FRAGMENT_TAG
),
PluginContract
.
ACTION_HELP
)
if
(
intent
.
resolveActivity
(
getActivity
.
getPackageManager
)
!=
null
)
builder
.
setNeutralButton
(
"?"
,
((
_
,
_
)
=>
startActivityForResult
(
intent
.
putExtra
(
PluginContract
.
EXTRA_OPTIONS
,
editText
.
getText
.
toString
),
REQUEST_CODE_HELP
))
:
DialogInterface.OnClickListener
)
}
override
def
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
)
:
Unit
=
requestCode
match
{
case
REQUEST_CODE_HELP
=>
requestCode
match
{
case
Activity
.
RESULT_OK
=>
new
AlertDialog
.
Builder
(
getContext
)
.
setTitle
(
"?"
)
.
setMessage
(
data
.
getCharSequenceExtra
(
PluginContract
.
EXTRA_HELP_MESSAGE
))
.
show
()
case
_
=>
}
case
_
=>
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
getActivity
.
startActivityForResult
(
intent
.
putExtra
(
PluginContract
.
EXTRA_OPTIONS
,
editText
.
getText
.
toString
),
ProfileConfigActivity
.
REQUEST_CODE_PLUGIN_HELP
))
:
DialogInterface.OnClickListener
)
}
}
plugin/src/main/scala/com/github/shadowsocks/plugin/HelpCallback.scala
View file @
b3bab982
...
...
@@ -13,6 +13,8 @@ import android.content.Intent
trait
HelpCallback
extends
HelpActivity
{
def
produceHelpMessage
(
options
:
PluginOptions
)
:
CharSequence
override
protected
def
onInitializePluginOptions
(
options
:
PluginOptions
)
:
Unit
=
setResult
(
Activity
.
RESULT_OK
,
new
Intent
().
putExtra
(
PluginContract
.
EXTRA_HELP_MESSAGE
,
produceHelpMessage
(
options
)))
override
protected
def
onInitializePluginOptions
(
options
:
PluginOptions
)
{
setResult
(
Activity
.
RESULT_OK
,
new
Intent
().
putExtra
(
PluginContract
.
EXTRA_HELP_MESSAGE
,
produceHelpMessage
(
options
)))
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