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
820d71fb
Commit
820d71fb
authored
Aug 16, 2016
by
Mygod
Committed by
Max Lv
Aug 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add help for kcpcli (#811)
* Add help for kcpcli * Filter useless parameters
parent
a9a6e1c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
src/main/res/xml/pref_all.xml
src/main/res/xml/pref_all.xml
+1
-1
src/main/scala/com/github/shadowsocks/preferences/KcpCliPreference.scala
...com/github/shadowsocks/preferences/KcpCliPreference.scala
+38
-0
No files found.
src/main/res/xml/pref_all.xml
View file @
820d71fb
...
@@ -94,7 +94,7 @@
...
@@ -94,7 +94,7 @@
android:summary=
"@string/kcp_port_summary"
android:summary=
"@string/kcp_port_summary"
android:title=
"@string/kcp_port"
/>
android:title=
"@string/kcp_port"
/>
<com.github.shadowsocks.preferences.
SummaryEditText
Preference
<com.github.shadowsocks.preferences.
KcpCli
Preference
android:key=
"kcpcli"
android:key=
"kcpcli"
android:persistent=
"false"
android:persistent=
"false"
android:summary=
"@string/kcpcli_summary"
android:summary=
"@string/kcpcli_summary"
...
...
src/main/scala/com/github/shadowsocks/preferences/KcpCliPreference.scala
0 → 100644
View file @
820d71fb
package
com.github.shadowsocks.preferences
import
android.app.AlertDialog
import
android.content.
{
Context
,
DialogInterface
}
import
android.util.AttributeSet
import
android.view.ViewGroup
import
eu.chainfire.libsuperuser.Shell
import
scala.collection.JavaConversions._
/**
* @author Mygod
*/
class
KcpCliPreference
(
context
:
Context
,
attrs
:
AttributeSet
)
extends
SummaryEditTextPreference
(
context
,
attrs
)
{
override
def
onPrepareDialogBuilder
(
builder
:
AlertDialog.Builder
)
{
super
.
onPrepareDialogBuilder
(
builder
)
builder
.
setNeutralButton
(
"?"
,
((
_
,
_
)
=>
{
val
dialog
=
new
AlertDialog
.
Builder
(
context
)
.
setTitle
(
"?"
)
.
setMessage
(
asScalaBuffer
(
Shell
.
SH
.
run
(
context
.
getApplicationInfo
.
dataDir
+
"/kcptun --help"
))
.
dropWhile
(
line
=>
line
!=
"GLOBAL OPTIONS:"
)
.
drop
(
1
)
.
takeWhile
(
line
=>
line
.
length
()
>
3
)
.
filter
(
line
=>
!
line
.
startsWith
(
" --localaddr "
)
&&
!
line
.
startsWith
(
" --remoteaddr "
)
&&
!
line
.
startsWith
(
" --path "
)
&&
!
line
.
startsWith
(
" --help,"
)
&&
!
line
.
startsWith
(
" --version,"
))
.
mkString
(
"\n"
))
.
show
()
val
window
=
dialog
.
getWindow
val
attrs
=
window
.
getAttributes
attrs
.
width
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
window
.
setAttributes
(
attrs
)
})
:
DialogInterface.OnClickListener
)
}
}
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