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
cdb9ebe5
Commit
cdb9ebe5
authored
Nov 09, 2015
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix menu in AppManager
parent
f679772d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
src/main/scala/com/github/shadowsocks/AppManager.scala
src/main/scala/com/github/shadowsocks/AppManager.scala
+14
-17
No files found.
src/main/scala/com/github/shadowsocks/AppManager.scala
View file @
cdb9ebe5
...
...
@@ -42,16 +42,17 @@ package com.github.shadowsocks
import
java.io.
{
ByteArrayInputStream
,
ByteArrayOutputStream
,
InputStream
}
import
android.app.ProgressDialog
import
android.content.
{
ClipData
,
ClipboardManager
,
Context
,
SharedPreferences
}
import
android.content.pm.PackageManager
import
android.content.
{
ClipData
,
ClipboardManager
,
Context
,
SharedPreferences
}
import
android.graphics.
{
Bitmap
,
PixelFormat
}
import
android.os.
{
Bundle
,
Handler
}
import
android.preference.PreferenceManager
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.widget.Toolbar
import
android.support.v7.widget.Toolbar.OnMenuItemClickListener
import
android.view.View.OnClickListener
import
android.view.ViewGroup.LayoutParams
import
android.view.
{
Menu
,
Menu
Item
,
View
,
ViewGroup
,
WindowManager
}
import
android.view.
{
MenuItem
,
View
,
ViewGroup
,
WindowManager
}
import
android.widget.AbsListView.OnScrollListener
import
android.widget.CompoundButton.OnCheckedChangeListener
import
android.widget._
...
...
@@ -99,7 +100,8 @@ object AppManager {
}
}
class
AppManager
extends
AppCompatActivity
with
OnCheckedChangeListener
with
OnClickListener
{
class
AppManager
extends
AppCompatActivity
with
OnCheckedChangeListener
with
OnClickListener
with
OnMenuItemClickListener
{
val
MSG_LOAD_START
=
1
val
MSG_LOAD_FINISH
=
2
...
...
@@ -115,8 +117,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
var
appsLoaded
:
Boolean
=
false
def
loadApps
(
context
:
Context
)
:
Array
[
ProxiedApp
]
=
{
val
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
)
val
proxiedAppString
=
prefs
.
getString
(
Key
.
proxied
,
""
)
val
proxiedAppString
=
ShadowsocksApplication
.
settings
.
getString
(
Key
.
proxied
,
""
)
val
proxiedApps
=
proxiedAppString
.
split
(
'|'
).
sortWith
(
_
<
_
)
import
scala.collection.JavaConversions._
...
...
@@ -218,7 +219,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
}
}
protected
override
def
onOptionsItemSelected
(
item
:
MenuItem
)
:
Boolean
=
{
def
onMenuItemClick
(
item
:
MenuItem
)
:
Boolean
=
{
val
clipboard
=
getSystemService
(
Context
.
CLIPBOARD_SERVICE
).
asInstanceOf
[
ClipboardManager
]
val
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getBaseContext
)
item
.
getItemId
match
{
...
...
@@ -256,12 +257,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
Toast
.
makeText
(
this
,
R
.
string
.
action_import_err
,
Toast
.
LENGTH_SHORT
).
show
()
return
false
}
super
.
onOptionsItemSelected
(
item
)
}
protected
override
def
onCreateOptionsMenu
(
menu
:
Menu
)
:
Boolean
=
{
getMenuInflater
.
inflate
(
R
.
menu
.
app_manager_menu
,
menu
)
super
.
onCreateOptionsMenu
(
menu
)
false
}
protected
override
def
onCreate
(
savedInstanceState
:
Bundle
)
{
...
...
@@ -277,6 +273,9 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
val
intent
=
getParentActivityIntent
if
(
intent
==
null
)
finish
else
navigateUpTo
(
intent
)
})
toolbar
.
inflateMenu
(
R
.
menu
.
app_manager_menu
)
toolbar
.
setOnMenuItemClickListener
(
this
)
this
.
overlay
=
View
.
inflate
(
this
,
R
.
layout
.
overlay
,
null
).
asInstanceOf
[
TextView
]
getWindowManager
.
addView
(
overlay
,
new
WindowManager
.
LayoutParams
(
LayoutParams
.
WRAP_CONTENT
,
LayoutParams
.
WRAP_CONTENT
,
...
...
@@ -291,10 +290,9 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
ImageLoader
.
getInstance
().
init
(
config
)
val
bypassSwitch
=
findViewById
(
R
.
id
.
bypassSwitch
).
asInstanceOf
[
Switch
]
val
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getBaseContext
)
bypassSwitch
.
setOnCheckedChangeListener
((
button
:
CompoundButton
,
checked
:
Boolean
)
=>
pref
s
.
edit
().
putBoolean
(
Key
.
isBypassApps
,
checked
).
apply
())
bypassSwitch
.
setChecked
(
pref
s
.
getBoolean
(
Key
.
isBypassApps
,
false
))
ShadowsocksApplication
.
setting
s
.
edit
().
putBoolean
(
Key
.
isBypassApps
,
checked
).
apply
())
bypassSwitch
.
setChecked
(
ShadowsocksApplication
.
setting
s
.
getBoolean
(
Key
.
isBypassApps
,
false
))
appListView
=
findViewById
(
R
.
id
.
applistview
).
asInstanceOf
[
ListView
]
}
...
...
@@ -310,14 +308,13 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
def
saveAppSettings
(
context
:
Context
)
{
if
(
apps
==
null
)
return
val
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
)
val
proxiedApps
=
new
StringBuilder
apps
.
foreach
(
app
=>
if
(
app
.
proxied
)
{
proxiedApps
++=
app
.
uid
.
toString
proxiedApps
+=
'|'
})
val
edit
:
SharedPreferences.Editor
=
pref
s
.
edit
val
edit
:
SharedPreferences.Editor
=
ShadowsocksApplication
.
setting
s
.
edit
edit
.
putString
(
Key
.
proxied
,
proxiedApps
.
toString
())
edit
.
apply
}
...
...
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