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
5419b4b5
Commit
5419b4b5
authored
Dec 26, 2016
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issues on Android 4.4
parent
28523091
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
9 deletions
+47
-9
src/main/res/drawable/ic_navigation_close.xml
src/main/res/drawable/ic_navigation_close.xml
+0
-0
src/main/res/drawable/ic_navigation_refresh.xml
src/main/res/drawable/ic_navigation_refresh.xml
+0
-0
src/main/res/drawable/ic_qu_camera_launcher.xml
src/main/res/drawable/ic_qu_camera_launcher.xml
+0
-0
src/main/res/drawable/ic_qu_shadowsocks_launcher.xml
src/main/res/drawable/ic_qu_shadowsocks_launcher.xml
+0
-0
src/main/res/layout/layout_global_settings.xml
src/main/res/layout/layout_global_settings.xml
+4
-5
src/main/scala/com/github/shadowsocks/GlobalSettingsFragment.scala
...scala/com/github/shadowsocks/GlobalSettingsFragment.scala
+20
-0
src/main/scala/com/github/shadowsocks/MainActivity.scala
src/main/scala/com/github/shadowsocks/MainActivity.scala
+12
-4
src/main/scala/com/github/shadowsocks/utils/Utils.scala
src/main/scala/com/github/shadowsocks/utils/Utils.scala
+11
-0
No files found.
src/main/res/drawable
-anydpi-v21
/ic_navigation_close.xml
→
src/main/res/drawable/ic_navigation_close.xml
View file @
5419b4b5
File moved
src/main/res/drawable
-anydpi-v21
/ic_navigation_refresh.xml
→
src/main/res/drawable/ic_navigation_refresh.xml
View file @
5419b4b5
File moved
src/main/res/drawable
-anydpi-v21
/ic_qu_camera_launcher.xml
→
src/main/res/drawable/ic_qu_camera_launcher.xml
View file @
5419b4b5
File moved
src/main/res/drawable
-anydpi-v21
/ic_qu_shadowsocks_launcher.xml
→
src/main/res/drawable/ic_qu_shadowsocks_launcher.xml
View file @
5419b4b5
File moved
src/main/res/layout/layout_global_settings.xml
View file @
5419b4b5
...
...
@@ -4,9 +4,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<include
layout=
"@layout/toolbar_light_dark"
/>
<fragment
android:id=
"@+id/content"
class=
"com.github.shadowsocks.GlobalConfigFragment"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
/>
<LinearLayout
android:id=
"@+id/content"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
/>
</LinearLayout>
src/main/scala/com/github/shadowsocks/GlobalSettingsFragment.scala
View file @
5419b4b5
...
...
@@ -22,6 +22,7 @@ package com.github.shadowsocks
import
android.os.Bundle
import
android.view.
{
LayoutInflater
,
View
,
ViewGroup
}
import
android.app.Fragment
class
GlobalSettingsFragment
extends
ToolbarFragment
{
...
...
@@ -31,5 +32,24 @@ class GlobalSettingsFragment extends ToolbarFragment {
override
def
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
)
{
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
()
fm
.
executePendingTransactions
()
}
override
def
onDetach
()
{
super
.
onDetach
()
try
{
val
childFragmentManager
=
classOf
[
Fragment
].
getDeclaredField
(
"mChildFragmentManager"
)
childFragmentManager
.
setAccessible
(
true
)
childFragmentManager
.
set
(
this
,
null
)
}
catch
{
case
ex
:
Exception
=>
// ignore
}
}
}
src/main/scala/com/github/shadowsocks/MainActivity.scala
View file @
5419b4b5
...
...
@@ -207,25 +207,25 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
new
PrimaryDrawerItem
()
.
withIdentifier
(
DRAWER_PROFILES
)
.
withName
(
R
.
string
.
profiles
)
.
withIcon
(
ContextCompat
.
get
Drawable
(
this
,
R
.
drawable
.
ic_action_description
))
.
withIcon
(
Utils
.
getAPICompatVector
Drawable
(
this
,
R
.
drawable
.
ic_action_description
))
.
withIconTintingEnabled
(
true
),
new
PrimaryDrawerItem
()
.
withIdentifier
(
DRAWER_GLOBAL_SETTINGS
)
.
withName
(
R
.
string
.
settings
)
.
withIcon
(
ContextCompat
.
get
Drawable
(
this
,
R
.
drawable
.
ic_action_settings
))
.
withIcon
(
Utils
.
getAPICompatVector
Drawable
(
this
,
R
.
drawable
.
ic_action_settings
))
.
withIconTintingEnabled
(
true
)
)
.
addStickyDrawerItems
(
new
PrimaryDrawerItem
()
.
withIdentifier
(
DRAWER_RECOVERY
)
.
withName
(
R
.
string
.
recovery
)
.
withIcon
(
ContextCompat
.
get
Drawable
(
this
,
R
.
drawable
.
ic_navigation_refresh
))
.
withIcon
(
Utils
.
getAPICompatVector
Drawable
(
this
,
R
.
drawable
.
ic_navigation_refresh
))
.
withIconTintingEnabled
(
true
)
.
withSelectable
(
false
),
new
PrimaryDrawerItem
()
.
withIdentifier
(
DRAWER_ABOUT
)
.
withName
(
R
.
string
.
about
)
.
withIcon
(
ContextCompat
.
get
Drawable
(
this
,
R
.
drawable
.
ic_action_copyright
))
.
withIcon
(
Utils
.
getAPICompatVector
Drawable
(
this
,
R
.
drawable
.
ic_action_copyright
))
.
withIconTintingEnabled
(
true
)
)
.
withOnDrawerItemClickListener
(
this
)
...
...
@@ -301,6 +301,14 @@ 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
)
}
}
}
override
def
onNewIntent
(
intent
:
Intent
)
{
...
...
src/main/scala/com/github/shadowsocks/utils/Utils.scala
View file @
5419b4b5
...
...
@@ -29,7 +29,10 @@ 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
}
...
...
@@ -49,6 +52,14 @@ 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