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
58c16704
Commit
58c16704
authored
Nov 09, 2015
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No more restarting AppManager after importing
parent
bf9b3f4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
src/main/scala/com/github/shadowsocks/AppManager.scala
src/main/scala/com/github/shadowsocks/AppManager.scala
+16
-13
No files found.
src/main/scala/com/github/shadowsocks/AppManager.scala
View file @
58c16704
...
@@ -104,11 +104,12 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
...
@@ -104,11 +104,12 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
implicit
def
anyrefarray_tools
[
T
<:
AnyRef
](
a
:
Array
[
T
])
:
ObjectArrayTools
[
T
]
=
new
ObjectArrayTools
(
a
)
implicit
def
anyrefarray_tools
[
T
<:
AnyRef
](
a
:
Array
[
T
])
:
ObjectArrayTools
[
T
]
=
new
ObjectArrayTools
(
a
)
var
apps
:
Array
[
ProxiedApp
]
=
null
var
apps
:
Array
[
ProxiedApp
]
=
_
var
appListView
:
ListView
=
null
var
appListView
:
ListView
=
_
var
overlay
:
TextView
=
null
var
loadingView
:
View
=
_
var
adapter
:
ListAdapter
=
null
var
overlay
:
TextView
=
_
var
appsLoaded
:
Boolean
=
false
var
adapter
:
ListAdapter
=
_
@volatile
var
appsLoading
:
Boolean
=
_
def
loadApps
(
context
:
Context
)
:
Array
[
ProxiedApp
]
=
{
def
loadApps
(
context
:
Context
)
:
Array
[
ProxiedApp
]
=
{
val
proxiedAppString
=
ShadowsocksApplication
.
settings
.
getString
(
Key
.
proxied
,
""
)
val
proxiedAppString
=
ShadowsocksApplication
.
settings
.
getString
(
Key
.
proxied
,
""
)
...
@@ -133,6 +134,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
...
@@ -133,6 +134,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
}
}
def
loadApps
()
{
def
loadApps
()
{
appsLoading
=
true
apps
=
loadApps
(
this
).
sortWith
((
a
,
b
)
=>
{
apps
=
loadApps
(
this
).
sortWith
((
a
,
b
)
=>
{
if
(
a
==
null
||
b
==
null
||
a
.
name
==
null
||
b
.
name
==
null
)
{
if
(
a
==
null
||
b
==
null
||
a
.
name
==
null
||
b
.
name
==
null
)
{
true
true
...
@@ -173,7 +175,6 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
...
@@ -173,7 +175,6 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
convertView
convertView
}
}
}
}
appsLoaded
=
true
}
}
/** Called an application is check/unchecked */
/** Called an application is check/unchecked */
...
@@ -230,9 +231,9 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
...
@@ -230,9 +231,9 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
prefs
.
edit
.
putString
(
Key
.
proxied
,
apps
).
apply
()
prefs
.
edit
.
putString
(
Key
.
proxied
,
apps
).
apply
()
Toast
.
makeText
(
this
,
R
.
string
.
action_import_msg
,
Toast
.
LENGTH_SHORT
).
show
()
Toast
.
makeText
(
this
,
R
.
string
.
action_import_msg
,
Toast
.
LENGTH_SHORT
).
show
()
// Restart activity
// Restart activity
val
intent
=
getIntent
appListView
.
setVisibility
(
View
.
GONE
)
finish
(
)
loadingView
.
setVisibility
(
View
.
VISIBLE
)
startActivity
(
intent
)
if
(
appsLoading
)
appsLoading
=
false
else
loadAppsAsync
(
)
return
true
return
true
}
}
}
}
...
@@ -272,6 +273,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
...
@@ -272,6 +273,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
ShadowsocksApplication
.
settings
.
edit
().
putBoolean
(
Key
.
isBypassApps
,
checked
).
apply
())
ShadowsocksApplication
.
settings
.
edit
().
putBoolean
(
Key
.
isBypassApps
,
checked
).
apply
())
bypassSwitch
.
setChecked
(
ShadowsocksApplication
.
settings
.
getBoolean
(
Key
.
isBypassApps
,
false
))
bypassSwitch
.
setChecked
(
ShadowsocksApplication
.
settings
.
getBoolean
(
Key
.
isBypassApps
,
false
))
loadingView
=
findViewById
(
R
.
id
.
loading
)
appListView
=
findViewById
(
R
.
id
.
applistview
).
asInstanceOf
[
ListView
]
appListView
=
findViewById
(
R
.
id
.
applistview
).
asInstanceOf
[
ListView
]
appListView
.
setOnScrollListener
(
new
AbsListView
.
OnScrollListener
{
appListView
.
setOnScrollListener
(
new
AbsListView
.
OnScrollListener
{
var
visible
=
false
var
visible
=
false
...
@@ -294,15 +296,16 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
...
@@ -294,15 +296,16 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
}
}
}
}
})
})
loadAppsAsync
()
}
}
protected
override
def
onResume
()
{
def
loadAppsAsync
()
{
super
.
onResume
()
Future
{
Future
{
if
(!
appsLoaded
)
loadApps
()
while
(!
appsLoading
)
loadApps
()
appsLoading
=
false
handler
.
post
(()
=>
{
handler
.
post
(()
=>
{
appListView
.
setAdapter
(
adapter
)
appListView
.
setAdapter
(
adapter
)
Utils
.
crossFade
(
AppManager
.
this
,
findViewById
(
R
.
id
.
loading
)
,
appListView
)
Utils
.
crossFade
(
AppManager
.
this
,
loadingView
,
appListView
)
})
})
}
}
}
}
...
...
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