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
e2d080b8
Commit
e2d080b8
authored
Dec 27, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine "Fix issues on Android 4.4"
parent
654b6277
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
29 deletions
+10
-29
src/main/scala/com/github/shadowsocks/GlobalSettingsFragment.scala
...scala/com/github/shadowsocks/GlobalSettingsFragment.scala
+3
-6
src/main/scala/com/github/shadowsocks/MainActivity.scala
src/main/scala/com/github/shadowsocks/MainActivity.scala
+7
-12
src/main/scala/com/github/shadowsocks/utils/Utils.scala
src/main/scala/com/github/shadowsocks/utils/Utils.scala
+0
-11
No files found.
src/main/scala/com/github/shadowsocks/GlobalSettingsFragment.scala
View file @
e2d080b8
...
...
@@ -33,11 +33,8 @@ class GlobalSettingsFragment extends ToolbarFragment {
super
.
onViewCreated
(
view
,
savedInstanceState
)
toolbar
.
setTitle
(
R
.
string
.
settings
)
val
fm
=
getChildFragmentManager
()
val
fragment
=
new
GlobalConfigFragment
()
val
ft
=
fm
.
beginTransaction
()
ft
.
replace
(
R
.
id
.
content
,
fragment
)
ft
.
commit
()
val
fm
=
getChildFragmentManager
fm
.
beginTransaction
().
replace
(
R
.
id
.
content
,
new
GlobalConfigFragment
()).
commit
()
fm
.
executePendingTransactions
()
}
...
...
@@ -49,7 +46,7 @@ class GlobalSettingsFragment extends ToolbarFragment {
childFragmentManager
.
setAccessible
(
true
)
childFragmentManager
.
set
(
this
,
null
)
}
catch
{
case
ex
:
Exception
=>
// ignore
case
_:
Exception
=>
// ignore
}
}
}
src/main/scala/com/github/shadowsocks/MainActivity.scala
View file @
e2d080b8
...
...
@@ -34,6 +34,7 @@ import android.os.{Build, Bundle, Handler, Message}
import
android.support.design.widget.
{
FloatingActionButton
,
Snackbar
}
import
android.support.v4.content.ContextCompat
import
android.support.v7.app.AlertDialog
import
android.support.v7.content.res.AppCompatResources
import
android.support.v7.widget.RecyclerView.ViewHolder
import
android.text.TextUtils
import
android.util.Log
...
...
@@ -45,8 +46,8 @@ import com.github.shadowsocks.aidl.IShadowsocksServiceCallback
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.utils.CloseUtils.autoDisconnect
import
com.github.shadowsocks.utils._
import
com.mikepenz.materialdrawer.model.PrimaryDrawerItem
import
com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
import
com.mikepenz.materialdrawer.model.
{
PrimaryDrawerItem
,
SecondaryDrawerItem
}
import
com.mikepenz.materialdrawer.
{
Drawer
,
DrawerBuilder
}
object
MainActivity
{
...
...
@@ -207,25 +208,25 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
new
PrimaryDrawerItem
()
.
withIdentifier
(
DRAWER_PROFILES
)
.
withName
(
R
.
string
.
profiles
)
.
withIcon
(
Utils
.
getAPICompatVector
Drawable
(
this
,
R
.
drawable
.
ic_action_description
))
.
withIcon
(
AppCompatResources
.
get
Drawable
(
this
,
R
.
drawable
.
ic_action_description
))
.
withIconTintingEnabled
(
true
),
new
PrimaryDrawerItem
()
.
withIdentifier
(
DRAWER_GLOBAL_SETTINGS
)
.
withName
(
R
.
string
.
settings
)
.
withIcon
(
Utils
.
getAPICompatVector
Drawable
(
this
,
R
.
drawable
.
ic_action_settings
))
.
withIcon
(
AppCompatResources
.
get
Drawable
(
this
,
R
.
drawable
.
ic_action_settings
))
.
withIconTintingEnabled
(
true
)
)
.
addStickyDrawerItems
(
new
PrimaryDrawerItem
()
.
withIdentifier
(
DRAWER_RECOVERY
)
.
withName
(
R
.
string
.
recovery
)
.
withIcon
(
Utils
.
getAPICompatVector
Drawable
(
this
,
R
.
drawable
.
ic_navigation_refresh
))
.
withIcon
(
AppCompatResources
.
get
Drawable
(
this
,
R
.
drawable
.
ic_navigation_refresh
))
.
withIconTintingEnabled
(
true
)
.
withSelectable
(
false
),
new
PrimaryDrawerItem
()
.
withIdentifier
(
DRAWER_ABOUT
)
.
withName
(
R
.
string
.
about
)
.
withIcon
(
Utils
.
getAPICompatVector
Drawable
(
this
,
R
.
drawable
.
ic_action_copyright
))
.
withIcon
(
AppCompatResources
.
get
Drawable
(
this
,
R
.
drawable
.
ic_action_copyright
))
.
withIconTintingEnabled
(
true
)
)
.
withOnDrawerItemClickListener
(
this
)
...
...
@@ -302,13 +303,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
val
intent
=
getIntent
if
(
intent
!=
null
)
handleShareIntent
(
intent
)
app
.
profileManager
.
getFirstProfile
match
{
case
Some
(
_
)
=>
// Ignore
case
_
=>
{
val
profile
=
app
.
profileManager
.
createProfile
()
app
.
profileId
(
profile
.
id
)
}
}
if
(
app
.
profileManager
.
getFirstProfile
.
isEmpty
)
app
.
profileId
(
app
.
profileManager
.
createProfile
().
id
)
}
override
def
onNewIntent
(
intent
:
Intent
)
{
...
...
src/main/scala/com/github/shadowsocks/utils/Utils.scala
View file @
e2d080b8
...
...
@@ -29,10 +29,7 @@ import android.animation.{Animator, AnimatorListenerAdapter}
import
android.content.pm.PackageManager
import
android.content.
{
Context
,
Intent
}
import
android.graphics._
import
android.graphics.drawable.Drawable
import
android.os.Build
import
android.support.v4.content.ContextCompat
import
android.support.graphics.drawable.VectorDrawableCompat
import
android.util.
{
Base64
,
DisplayMetrics
,
Log
}
import
android.view.View.MeasureSpec
import
android.view.
{
Gravity
,
View
,
Window
}
...
...
@@ -52,14 +49,6 @@ object Utils {
def
isLollipopOrAbove
:
Boolean
=
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
def
getAPICompatVectorDrawable
(
callingContext
:
Context
,
resource_id
:
Int
)
:
Drawable
=
{
if
(
Build
.
VERSION
.
SDK_INT
>=
21
)
{
return
ContextCompat
.
getDrawable
(
callingContext
.
getApplicationContext
(),
resource_id
);
}
else
{
return
VectorDrawableCompat
.
create
(
callingContext
.
getResources
(),
resource_id
,
callingContext
.
getTheme
());
}
}
def
getSignature
(
context
:
Context
)
:
String
=
{
val
info
=
context
.
getPackageManager
...
...
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