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
eb7e608d
Commit
eb7e608d
authored
Dec 30, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use custom tabs in AboutFragment
parent
ef6a9e77
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
src/main/scala/com/github/shadowsocks/AboutFragment.scala
src/main/scala/com/github/shadowsocks/AboutFragment.scala
+1
-3
src/main/scala/com/github/shadowsocks/MainActivity.scala
src/main/scala/com/github/shadowsocks/MainActivity.scala
+4
-1
No files found.
src/main/scala/com/github/shadowsocks/AboutFragment.scala
View file @
eb7e608d
...
...
@@ -38,9 +38,7 @@ class AboutFragment extends ToolbarFragment {
web
.
loadUrl
(
"file:///android_asset/pages/about.html"
)
web
.
setWebViewClient
(
new
WebViewClient
()
{
override
def
shouldOverrideUrlLoading
(
view
:
WebView
,
url
:
String
)
:
Boolean
=
{
try
startActivity
(
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
)))
catch
{
case
_:
android.content.ActivityNotFoundException
=>
// Ignore
}
getActivity
.
asInstanceOf
[
MainActivity
].
launchUrl
(
url
)
true
}
})
...
...
src/main/scala/com/github/shadowsocks/MainActivity.scala
View file @
eb7e608d
...
...
@@ -89,6 +89,9 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
private
lazy
val
customTabsIntent
=
new
CustomTabsIntent
.
Builder
()
.
setToolbarColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
material_primary_500
))
.
build
()
def
launchUrl
(
url
:
String
)
:
Unit
=
try
customTabsIntent
.
launchUrl
(
this
,
Uri
.
parse
(
url
))
catch
{
case
_:
ActivityNotFoundException
=>
// Ignore
}
// Services
var
state
:
Int
=
_
...
...
@@ -374,7 +377,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
case
DRAWER_ABOUT
=>
app
.
track
(
TAG
,
"about"
)
displayFragment
(
aboutFragment
)
case
DRAWER_FAQ
=>
customTabsIntent
.
launchUrl
(
this
,
Uri
.
parse
(
getString
(
R
.
string
.
faq_url
)
))
case
DRAWER_FAQ
=>
launchUrl
(
getString
(
R
.
string
.
faq_url
))
}
true
// unexpected cases will throw exception
}
...
...
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