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
cceb4ad9
Commit
cceb4ad9
authored
Dec 24, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move about to fragment
parent
48a1abee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
20 deletions
+43
-20
src/main/res/layout/layout_about.xml
src/main/res/layout/layout_about.xml
+11
-0
src/main/scala/com/github/shadowsocks/AboutFragment.scala
src/main/scala/com/github/shadowsocks/AboutFragment.scala
+28
-0
src/main/scala/com/github/shadowsocks/MainActivity.scala
src/main/scala/com/github/shadowsocks/MainActivity.scala
+4
-20
No files found.
src/main/res/layout/layout_about.xml
0 → 100644
View file @
cceb4ad9
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<include
layout=
"@layout/toolbar_light_dark"
/>
<WebView
android:id=
"@+id/web_view"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
/>
</LinearLayout>
src/main/scala/com/github/shadowsocks/AboutFragment.scala
0 → 100644
View file @
cceb4ad9
package
com.github.shadowsocks
import
java.util.Locale
import
android.content.Intent
import
android.net.Uri
import
android.os.Bundle
import
android.view.
{
LayoutInflater
,
View
,
ViewGroup
}
import
android.webkit.
{
WebView
,
WebViewClient
}
class
AboutFragment
extends
ToolbarFragment
{
override
def
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
,
savedInstanceState
:
Bundle
)
:
View
=
inflater
.
inflate
(
R
.
layout
.
layout_about
,
container
,
false
)
override
def
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
toolbar
.
setTitle
(
getString
(
R
.
string
.
about_title
).
formatLocal
(
Locale
.
ENGLISH
,
BuildConfig
.
VERSION_NAME
))
val
web
=
view
.
findViewById
(
R
.
id
.
web_view
).
asInstanceOf
[
WebView
]
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
}
true
}
})
}
}
src/main/scala/com/github/shadowsocks/MainActivity.scala
View file @
cceb4ad9
...
@@ -24,11 +24,11 @@ import java.lang.System.currentTimeMillis
...
@@ -24,11 +24,11 @@ import java.lang.System.currentTimeMillis
import
java.net.
{
HttpURLConnection
,
URL
}
import
java.net.
{
HttpURLConnection
,
URL
}
import
java.util.Locale
import
java.util.Locale
import
android.app.
{
Activity
,
ProgressDialog
}
import
android.app.backup.BackupManager
import
android.app.backup.BackupManager
import
android.app.
{
Activity
,
ProgressDialog
}
import
android.content.SharedPreferences.OnSharedPreferenceChangeListener
import
android.content.SharedPreferences.OnSharedPreferenceChangeListener
import
android.content._
import
android.content._
import
android.net.
{
Uri
,
VpnService
}
import
android.net.
VpnService
import
android.nfc.
{
NdefMessage
,
NfcAdapter
}
import
android.nfc.
{
NdefMessage
,
NfcAdapter
}
import
android.os.
{
Build
,
Bundle
,
Handler
,
Message
}
import
android.os.
{
Build
,
Bundle
,
Handler
,
Message
}
import
android.support.design.widget.
{
FloatingActionButton
,
Snackbar
}
import
android.support.design.widget.
{
FloatingActionButton
,
Snackbar
}
...
@@ -38,7 +38,6 @@ import android.support.v7.widget.RecyclerView.ViewHolder
...
@@ -38,7 +38,6 @@ import android.support.v7.widget.RecyclerView.ViewHolder
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.util.Log
import
android.view.View
import
android.view.View
import
android.webkit.
{
WebView
,
WebViewClient
}
import
android.widget.
{
TextView
,
Toast
}
import
android.widget.
{
TextView
,
Toast
}
import
com.github.jorgecastilloprz.FABProgressCircle
import
com.github.jorgecastilloprz.FABProgressCircle
import
com.github.shadowsocks.ShadowsocksApplication.app
import
com.github.shadowsocks.ShadowsocksApplication.app
...
@@ -78,6 +77,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
...
@@ -78,6 +77,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
private
var
currentFragment
:
ToolbarFragment
=
_
private
var
currentFragment
:
ToolbarFragment
=
_
private
lazy
val
profilesFragment
=
new
ProfilesFragment
()
private
lazy
val
profilesFragment
=
new
ProfilesFragment
()
private
lazy
val
globalSettingsFragment
=
new
GlobalSettingsFragment
()
private
lazy
val
globalSettingsFragment
=
new
GlobalSettingsFragment
()
private
lazy
val
aboutFragment
=
new
AboutFragment
()
// Services
// Services
private
val
callback
=
new
IShadowsocksServiceCallback
.
Stub
{
private
val
callback
=
new
IShadowsocksServiceCallback
.
Stub
{
...
@@ -237,7 +237,6 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
...
@@ -237,7 +237,6 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
.
withName
(
R
.
string
.
about
)
.
withName
(
R
.
string
.
about
)
.
withIcon
(
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
ic_action_copyright
))
.
withIcon
(
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
ic_action_copyright
))
.
withIconTintingEnabled
(
true
)
.
withIconTintingEnabled
(
true
)
.
withSelectable
(
false
)
)
)
.
withOnDrawerItemClickListener
(
this
)
.
withOnDrawerItemClickListener
(
this
)
.
withActionBarDrawerToggle
(
true
)
.
withActionBarDrawerToggle
(
true
)
...
@@ -374,22 +373,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
...
@@ -374,22 +373,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
case
DRAWER_GLOBAL_SETTINGS
=>
displayFragment
(
globalSettingsFragment
)
case
DRAWER_GLOBAL_SETTINGS
=>
displayFragment
(
globalSettingsFragment
)
case
DRAWER_ABOUT
=>
case
DRAWER_ABOUT
=>
app
.
track
(
TAG
,
"about"
)
app
.
track
(
TAG
,
"about"
)
val
web
=
new
WebView
(
this
)
displayFragment
(
aboutFragment
)
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
}
true
}
})
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
getString
(
R
.
string
.
about_title
).
formatLocal
(
Locale
.
ENGLISH
,
BuildConfig
.
VERSION_NAME
))
.
setNegativeButton
(
getString
(
android
.
R
.
string
.
ok
),
null
)
.
setView
(
web
)
.
create
()
.
show
()
}
}
true
// unexpected cases will throw exception
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