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
4898ff58
Commit
4898ff58
authored
Aug 23, 2018
by
Mygod
Committed by
Max Lv
Aug 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch no files manager exception
parent
c6e4491a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
11 deletions
+35
-11
.circleci/config.yml
.circleci/config.yml
+3
-3
core/src/main/res/values/strings.xml
core/src/main/res/values/strings.xml
+1
-0
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
.../src/main/java/com/github/shadowsocks/ProfilesFragment.kt
+16
-6
tv/src/main/java/com/github/shadowsocks/tv/MainPreferenceFragment.kt
.../java/com/github/shadowsocks/tv/MainPreferenceFragment.kt
+15
-2
No files found.
.circleci/config.yml
View file @
4898ff58
...
@@ -5,10 +5,10 @@ jobs:
...
@@ -5,10 +5,10 @@ jobs:
docker
:
docker
:
-
image
:
shadowsocks/shadowsocks-android:circleci
-
image
:
shadowsocks/shadowsocks-android:circleci
environment
:
environment
:
JVM_OPTS
:
-Xmx3.5g
JVM_OPTS
:
-Xmx5g
resource_class
:
medium+
steps
:
steps
:
-
checkout
-
checkout
-
run
:
git submodule sync
-
run
:
git submodule update --init --recursive
-
run
:
git submodule update --init --recursive
-
restore_cache
:
-
restore_cache
:
key
:
jars-{{ checksum "build.gradle" }}
key
:
jars-{{ checksum "build.gradle" }}
...
@@ -16,7 +16,7 @@ jobs:
...
@@ -16,7 +16,7 @@ jobs:
key
:
go-full-{{ checksum "~/code/.git/modules/core/src/overture/go/HEAD" }}
key
:
go-full-{{ checksum "~/code/.git/modules/core/src/overture/go/HEAD" }}
-
run
:
-
run
:
name
:
Run Build and Tests
name
:
Run Build and Tests
command
:
./gradlew
goBuild
assembleDebug check
command
:
./gradlew assembleDebug check
-
save_cache
:
-
save_cache
:
paths
:
paths
:
-
~/.gradle
-
~/.gradle
...
...
core/src/main/res/values/strings.xml
View file @
4898ff58
...
@@ -77,6 +77,7 @@
...
@@ -77,6 +77,7 @@
<!-- alert category -->
<!-- alert category -->
<string
name=
"profile_empty"
>
Please select a profile
</string>
<string
name=
"profile_empty"
>
Please select a profile
</string>
<string
name=
"proxy_empty"
>
Proxy/Password should not be empty
</string>
<string
name=
"proxy_empty"
>
Proxy/Password should not be empty
</string>
<string
name=
"file_manager_missing"
>
Please install a file manager like MiXplorer
</string>
<string
name=
"connect"
>
Connect
</string>
<string
name=
"connect"
>
Connect
</string>
<!-- menu category -->
<!-- menu category -->
...
...
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
View file @
4898ff58
...
@@ -22,10 +22,7 @@ package com.github.shadowsocks
...
@@ -22,10 +22,7 @@ package com.github.shadowsocks
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Activity
import
android.content.ClipData
import
android.content.*
import
android.content.ClipboardManager
import
android.content.Context
import
android.content.Intent
import
android.nfc.NdefMessage
import
android.nfc.NdefMessage
import
android.nfc.NdefRecord
import
android.nfc.NdefRecord
import
android.nfc.NfcAdapter
import
android.nfc.NfcAdapter
...
@@ -42,6 +39,7 @@ import androidx.core.content.getSystemService
...
@@ -42,6 +39,7 @@ import androidx.core.content.getSystemService
import
androidx.core.os.bundleOf
import
androidx.core.os.bundleOf
import
androidx.fragment.app.DialogFragment
import
androidx.fragment.app.DialogFragment
import
androidx.recyclerview.widget.*
import
androidx.recyclerview.widget.*
import
com.crashlytics.android.Crashlytics
import
com.github.shadowsocks.bg.BaseService
import
com.github.shadowsocks.bg.BaseService
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.database.ProfileManager
import
com.github.shadowsocks.database.ProfileManager
...
@@ -383,7 +381,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
...
@@ -383,7 +381,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
true
true
}
}
R
.
id
.
action_import_file
->
{
R
.
id
.
action_import_file
->
{
start
Activity
ForResult
(
Intent
(
Intent
.
ACTION_GET_CONTENT
).
apply
{
start
Files
ForResult
(
Intent
(
Intent
.
ACTION_GET_CONTENT
).
apply
{
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
type
=
"application/json"
type
=
"application/json"
putExtra
(
Intent
.
EXTRA_ALLOW_MULTIPLE
,
true
)
putExtra
(
Intent
.
EXTRA_ALLOW_MULTIPLE
,
true
)
...
@@ -404,7 +402,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
...
@@ -404,7 +402,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
true
true
}
}
R
.
id
.
action_export_file
->
{
R
.
id
.
action_export_file
->
{
start
Activity
ForResult
(
Intent
(
Intent
.
ACTION_CREATE_DOCUMENT
).
apply
{
start
Files
ForResult
(
Intent
(
Intent
.
ACTION_CREATE_DOCUMENT
).
apply
{
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
type
=
"application/json"
type
=
"application/json"
putExtra
(
Intent
.
EXTRA_TITLE
,
"profiles.json"
)
// optional title that can be edited
putExtra
(
Intent
.
EXTRA_TITLE
,
"profiles.json"
)
// optional title that can be edited
...
@@ -415,6 +413,18 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
...
@@ -415,6 +413,18 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
}
}
}
}
private
fun
startFilesForResult
(
intent
:
Intent
?,
requestCode
:
Int
)
{
try
{
startActivityForResult
(
intent
,
requestCode
)
}
catch
(
e
:
ActivityNotFoundException
)
{
Crashlytics
.
logException
(
e
)
(
activity
as
MainActivity
).
snackbar
(
getString
(
R
.
string
.
file_manager_missing
)).
show
()
}
catch
(
e
:
SecurityException
)
{
Crashlytics
.
logException
(
e
)
(
activity
as
MainActivity
).
snackbar
(
getString
(
R
.
string
.
file_manager_missing
)).
show
()
}
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
if
(
resultCode
!=
Activity
.
RESULT_OK
)
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
resultCode
!=
Activity
.
RESULT_OK
)
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
else
when
(
requestCode
)
{
else
when
(
requestCode
)
{
...
...
tv/src/main/java/com/github/shadowsocks/tv/MainPreferenceFragment.kt
View file @
4898ff58
...
@@ -22,6 +22,7 @@ package com.github.shadowsocks.tv
...
@@ -22,6 +22,7 @@ package com.github.shadowsocks.tv
import
android.app.Activity
import
android.app.Activity
import
android.app.backup.BackupManager
import
android.app.backup.BackupManager
import
android.content.ActivityNotFoundException
import
android.content.Intent
import
android.content.Intent
import
android.net.VpnService
import
android.net.VpnService
import
android.os.Bundle
import
android.os.Bundle
...
@@ -238,7 +239,7 @@ class MainPreferenceFragment : LeanbackPreferenceFragment(), ShadowsocksConnecti
...
@@ -238,7 +239,7 @@ class MainPreferenceFragment : LeanbackPreferenceFragment(), ShadowsocksConnecti
true
true
}
}
Key
.
controlImport
->
{
Key
.
controlImport
->
{
start
Activity
ForResult
(
Intent
(
Intent
.
ACTION_GET_CONTENT
).
apply
{
start
Files
ForResult
(
Intent
(
Intent
.
ACTION_GET_CONTENT
).
apply
{
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
type
=
"application/json"
type
=
"application/json"
putExtra
(
Intent
.
EXTRA_ALLOW_MULTIPLE
,
true
)
putExtra
(
Intent
.
EXTRA_ALLOW_MULTIPLE
,
true
)
...
@@ -246,7 +247,7 @@ class MainPreferenceFragment : LeanbackPreferenceFragment(), ShadowsocksConnecti
...
@@ -246,7 +247,7 @@ class MainPreferenceFragment : LeanbackPreferenceFragment(), ShadowsocksConnecti
true
true
}
}
Key
.
controlExport
->
{
Key
.
controlExport
->
{
start
Activity
ForResult
(
Intent
(
Intent
.
ACTION_CREATE_DOCUMENT
).
apply
{
start
Files
ForResult
(
Intent
(
Intent
.
ACTION_CREATE_DOCUMENT
).
apply
{
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
type
=
"application/json"
type
=
"application/json"
putExtra
(
Intent
.
EXTRA_TITLE
,
"profiles.json"
)
// optional title that can be edited
putExtra
(
Intent
.
EXTRA_TITLE
,
"profiles.json"
)
// optional title that can be edited
...
@@ -256,6 +257,18 @@ class MainPreferenceFragment : LeanbackPreferenceFragment(), ShadowsocksConnecti
...
@@ -256,6 +257,18 @@ class MainPreferenceFragment : LeanbackPreferenceFragment(), ShadowsocksConnecti
else
->
super
.
onPreferenceTreeClick
(
preference
)
else
->
super
.
onPreferenceTreeClick
(
preference
)
}
}
private
fun
startFilesForResult
(
intent
:
Intent
?,
requestCode
:
Int
)
{
try
{
startActivityForResult
(
intent
,
requestCode
)
}
catch
(
e
:
ActivityNotFoundException
)
{
Crashlytics
.
logException
(
e
)
Toast
.
makeText
(
activity
,
R
.
string
.
file_manager_missing
,
Toast
.
LENGTH_SHORT
).
show
()
}
catch
(
e
:
SecurityException
)
{
Crashlytics
.
logException
(
e
)
Toast
.
makeText
(
activity
,
R
.
string
.
file_manager_missing
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
when
(
requestCode
)
{
when
(
requestCode
)
{
REQUEST_CONNECT
->
if
(
resultCode
==
Activity
.
RESULT_OK
)
Core
.
startService
()
else
{
REQUEST_CONNECT
->
if
(
resultCode
==
Activity
.
RESULT_OK
)
Core
.
startService
()
else
{
...
...
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