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
5e9f78d3
Commit
5e9f78d3
authored
Jan 07, 2017
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent crash when importing
Fix #1060.
parent
f4026e5a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
+5
-2
src/main/scala/com/github/shadowsocks/acl/CustomRulesFragment.scala
...cala/com/github/shadowsocks/acl/CustomRulesFragment.scala
+11
-1
No files found.
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
View file @
5e9f78d3
...
@@ -26,6 +26,7 @@ import android.app.Activity
...
@@ -26,6 +26,7 @@ import android.app.Activity
import
android.content._
import
android.content._
import
android.net.Uri
import
android.net.Uri
import
android.os.Bundle
import
android.os.Bundle
import
android.support.design.widget.Snackbar
import
android.support.v7.widget.RecyclerView.ViewHolder
import
android.support.v7.widget.RecyclerView.ViewHolder
import
android.support.v7.widget._
import
android.support.v7.widget._
import
android.support.v7.widget.helper.ItemTouchHelper
import
android.support.v7.widget.helper.ItemTouchHelper
...
@@ -348,15 +349,17 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
...
@@ -348,15 +349,17 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
}
}
true
true
case
R
.
id
.
action_import
=>
case
R
.
id
.
action_import
=>
if
(
clipboard
.
hasPrimaryClip
)
{
try
{
val
profiles
=
Parser
.
findAll
(
clipboard
.
getPrimaryClip
.
getItemAt
(
0
).
getText
)
val
profiles
=
Parser
.
findAll
(
clipboard
.
getPrimaryClip
.
getItemAt
(
0
).
getText
)
if
(
profiles
.
nonEmpty
)
{
if
(
profiles
.
nonEmpty
)
{
profiles
.
foreach
(
app
.
profileManager
.
createProfile
)
profiles
.
foreach
(
app
.
profileManager
.
createProfile
)
Toast
.
makeText
(
getActivity
,
R
.
string
.
action_import_msg
,
Toast
.
LENGTH_SHORT
).
show
()
Toast
.
makeText
(
getActivity
,
R
.
string
.
action_import_msg
,
Toast
.
LENGTH_SHORT
).
show
()
return
true
return
true
}
}
}
catch
{
case
_:
Exception
=>
}
}
Toast
.
makeText
(
getActivity
,
R
.
string
.
action_import_err
,
Toast
.
LENGTH_SHORT
).
show
()
Snackbar
.
make
(
getActivity
.
findViewById
(
R
.
id
.
snackbar
),
R
.
string
.
action_import_err
,
Snackbar
.
LENGTH_LONG
).
show
()
true
true
case
R
.
id
.
action_manual_settings
=>
case
R
.
id
.
action_manual_settings
=>
startConfig
(
app
.
profileManager
.
createProfile
().
id
)
startConfig
(
app
.
profileManager
.
createProfile
().
id
)
...
...
src/main/scala/com/github/shadowsocks/acl/CustomRulesFragment.scala
View file @
5e9f78d3
...
@@ -5,6 +5,7 @@ import java.util.Locale
...
@@ -5,6 +5,7 @@ import java.util.Locale
import
android.content.
{
ClipData
,
ClipboardManager
,
Context
,
DialogInterface
}
import
android.content.
{
ClipData
,
ClipboardManager
,
Context
,
DialogInterface
}
import
android.os.
{
Bundle
,
Handler
}
import
android.os.
{
Bundle
,
Handler
}
import
android.support.design.widget.Snackbar
import
android.support.v7.app.AlertDialog
import
android.support.v7.app.AlertDialog
import
android.support.v7.widget.RecyclerView.ViewHolder
import
android.support.v7.widget.RecyclerView.ViewHolder
import
android.support.v7.widget.helper.ItemTouchHelper
import
android.support.v7.widget.helper.ItemTouchHelper
...
@@ -276,7 +277,16 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi
...
@@ -276,7 +277,16 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi
.
create
().
show
()
.
create
().
show
()
true
true
case
R
.
id
.
action_import
=>
case
R
.
id
.
action_import
=>
clipboard
.
getPrimaryClip
.
getItemAt
(
0
).
getText
.
toString
.
split
(
"\n"
).
foreach
(
adapter
.
addToProxy
)
try
{
val
items
=
clipboard
.
getPrimaryClip
.
getItemAt
(
0
).
getText
.
toString
.
split
(
"\n"
)
if
(
items
.
nonEmpty
)
{
items
.
foreach
(
adapter
.
addToProxy
)
return
true
}
}
catch
{
case
_:
Exception
=>
}
Snackbar
.
make
(
getActivity
.
findViewById
(
R
.
id
.
snackbar
),
R
.
string
.
action_import_err
,
Snackbar
.
LENGTH_LONG
).
show
()
true
true
case
R
.
id
.
action_import_gfwlist
=>
case
R
.
id
.
action_import_gfwlist
=>
val
acl
=
new
Acl
().
fromId
(
Acl
.
GFWLIST
)
val
acl
=
new
Acl
().
fromId
(
Acl
.
GFWLIST
)
...
...
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