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
0acfaa12
Commit
0acfaa12
authored
May 17, 2017
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the new findViewById APIs
parent
1ec80175
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
24 additions
and
25 deletions
+24
-25
mobile/src/main/scala/com/github/shadowsocks/AboutFragment.scala
...src/main/scala/com/github/shadowsocks/AboutFragment.scala
+1
-1
mobile/src/main/scala/com/github/shadowsocks/AppManager.scala
...le/src/main/scala/com/github/shadowsocks/AppManager.scala
+2
-2
mobile/src/main/scala/com/github/shadowsocks/MainActivity.scala
.../src/main/scala/com/github/shadowsocks/MainActivity.scala
+1
-1
mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
.../main/scala/com/github/shadowsocks/ProfilesFragment.scala
+8
-8
mobile/src/main/scala/com/github/shadowsocks/TaskerActivity.scala
...rc/main/scala/com/github/shadowsocks/TaskerActivity.scala
+1
-1
mobile/src/main/scala/com/github/shadowsocks/ToolbarFragment.scala
...c/main/scala/com/github/shadowsocks/ToolbarFragment.scala
+1
-1
mobile/src/main/scala/com/github/shadowsocks/acl/CustomRulesFragment.scala
...cala/com/github/shadowsocks/acl/CustomRulesFragment.scala
+5
-6
mobile/src/main/scala/com/github/shadowsocks/preference/BottomSheetPreferenceDialogFragment.scala
...ocks/preference/BottomSheetPreferenceDialogFragment.scala
+3
-3
plugin/src/main/scala/be/mygod/preference/EditTextPreferenceDialogFragment.scala
...e/mygod/preference/EditTextPreferenceDialogFragment.scala
+1
-1
plugin/src/main/scala/be/mygod/preference/PreferenceGroupAdapter.scala
...in/scala/be/mygod/preference/PreferenceGroupAdapter.scala
+1
-1
No files found.
mobile/src/main/scala/com/github/shadowsocks/AboutFragment.scala
View file @
0acfaa12
...
...
@@ -34,7 +34,7 @@ class AboutFragment extends ToolbarFragment {
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
]
val
web
=
view
.
findViewById
[
WebView
](
R
.
id
.
web_view
)
web
.
loadUrl
(
"file:///android_asset/pages/about.html"
)
web
.
setWebViewClient
(
new
WebViewClient
()
{
override
def
shouldOverrideUrlLoading
(
view
:
WebView
,
url
:
String
)
:
Boolean
=
{
...
...
mobile/src/main/scala/com/github/shadowsocks/AppManager.scala
View file @
0acfaa12
...
...
@@ -70,8 +70,8 @@ class AppManager extends AppCompatActivity with OnMenuItemClickListener {
import
AppManager._
private
final
class
AppViewHolder
(
val
view
:
View
)
extends
RecyclerView
.
ViewHolder
(
view
)
with
View
.
OnClickListener
{
private
val
icon
=
itemView
.
findViewById
(
R
.
id
.
itemicon
).
asInstanceOf
[
ImageView
]
private
val
check
=
itemView
.
findViewById
(
R
.
id
.
itemcheck
).
asInstanceOf
[
Switch
]
private
val
icon
=
itemView
.
findViewById
[
ImageView
](
R
.
id
.
itemicon
)
private
val
check
=
itemView
.
findViewById
[
Switch
](
R
.
id
.
itemcheck
)
private
var
item
:
ProxiedApp
=
_
itemView
.
setOnClickListener
(
this
)
...
...
mobile/src/main/scala/com/github/shadowsocks/MainActivity.scala
View file @
0acfaa12
...
...
@@ -246,7 +246,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
}
else
drawer
=
drawerBuilder
.
build
()
val
header
=
drawer
.
getHeader
val
title
=
header
.
findViewById
(
R
.
id
.
drawer_title
).
asInstanceOf
[
TextView
]
val
title
=
header
.
findViewById
[
TextView
](
R
.
id
.
drawer_title
)
val
tf
=
Typefaces
.
get
(
this
,
"fonts/Iceland.ttf"
)
if
(
tf
!=
null
)
title
.
setTypeface
(
tf
)
...
...
mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
View file @
0acfaa12
...
...
@@ -78,20 +78,20 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
var
item
:
Profile
=
_
private
val
text1
=
itemView
.
findViewById
(
android
.
R
.
id
.
text1
).
asInstanceOf
[
TextView
]
private
val
text2
=
itemView
.
findViewById
(
android
.
R
.
id
.
text2
).
asInstanceOf
[
TextView
]
private
val
traffic
=
itemView
.
findViewById
(
R
.
id
.
traffic
).
asInstanceOf
[
TextView
]
private
val
edit
=
itemView
.
findViewById
(
R
.
id
.
edit
)
private
val
text1
=
itemView
.
findViewById
[
TextView
](
android
.
R
.
id
.
text1
)
private
val
text2
=
itemView
.
findViewById
[
TextView
](
android
.
R
.
id
.
text2
)
private
val
traffic
=
itemView
.
findViewById
[
TextView
](
R
.
id
.
traffic
)
private
val
edit
=
itemView
.
findViewById
[
View
]
(
R
.
id
.
edit
)
edit
.
setOnClickListener
(
_
=>
startConfig
(
item
.
id
))
edit
.
setOnLongClickListener
(
cardButtonLongClickListener
)
itemView
.
setOnClickListener
(
this
)
// it will not take effect unless set in code
itemView
.
findViewById
(
R
.
id
.
indicator
).
setBackgroundResource
(
R
.
drawable
.
background_profile
)
itemView
.
findViewById
[
View
]
(
R
.
id
.
indicator
).
setBackgroundResource
(
R
.
drawable
.
background_profile
)
private
var
adView
:
NativeExpressAdView
=
_
{
val
share
=
itemView
.
findViewById
(
R
.
id
.
share
)
val
share
=
itemView
.
findViewById
[
View
]
(
R
.
id
.
share
)
share
.
setOnClickListener
(
_
=>
{
val
popup
=
new
PopupMenu
(
getActivity
,
share
)
popup
.
getMenuInflater
.
inflate
(
R
.
menu
.
profile_share_popup
,
popup
.
getMenu
)
...
...
@@ -147,7 +147,7 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
adView
.
setLayoutParams
(
params
)
adView
.
setAdUnitId
(
"ca-app-pub-9097031975646651/5224027521"
)
adView
.
setAdSize
(
new
AdSize
(
328
,
132
))
itemView
.
findViewById
(
R
.
id
.
content
).
asInstanceOf
[
LinearLayout
]
.
addView
(
adView
)
itemView
.
findViewById
[
LinearLayout
](
R
.
id
.
content
)
.
addView
(
adView
)
// Demographics
val
random
=
new
Random
()
...
...
@@ -279,7 +279,7 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
toolbar
.
setOnMenuItemClickListener
(
this
)
if
(
app
.
profileManager
.
getFirstProfile
.
isEmpty
)
app
.
profileId
(
app
.
profileManager
.
createProfile
().
id
)
val
profilesList
=
view
.
findViewById
(
R
.
id
.
list
).
asInstanceOf
[
RecyclerView
]
val
profilesList
=
view
.
findViewById
[
RecyclerView
](
R
.
id
.
list
)
val
layoutManager
=
new
LinearLayoutManager
(
getActivity
,
LinearLayoutManager
.
VERTICAL
,
false
)
profilesList
.
setLayoutManager
(
layoutManager
)
layoutManager
.
scrollToPosition
(
profilesAdapter
.
profiles
.
zipWithIndex
.
collectFirst
{
...
...
mobile/src/main/scala/com/github/shadowsocks/TaskerActivity.scala
View file @
0acfaa12
...
...
@@ -42,7 +42,7 @@ class TaskerActivity extends AppCompatActivity {
typedArray
.
recycle
()
}
private
var
item
:
Profile
=
_
private
val
text
=
itemView
.
findViewById
(
android
.
R
.
id
.
text1
).
asInstanceOf
[
CheckedTextView
]
private
val
text
=
itemView
.
findViewById
[
CheckedTextView
](
android
.
R
.
id
.
text1
)
itemView
.
setOnClickListener
(
this
)
def
bindDefault
()
{
...
...
mobile/src/main/scala/com/github/shadowsocks/ToolbarFragment.scala
View file @
0acfaa12
...
...
@@ -30,7 +30,7 @@ class ToolbarFragment extends Fragment {
override
def
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
toolbar
=
view
.
findViewById
(
R
.
id
.
toolbar
).
asInstanceOf
[
Toolbar
]
toolbar
=
view
.
findViewById
[
Toolbar
](
R
.
id
.
toolbar
)
val
activity
=
getActivity
.
asInstanceOf
[
MainActivity
]
if
(
activity
.
crossfader
==
null
)
activity
.
drawer
.
setToolbar
(
activity
,
toolbar
,
true
)
}
...
...
mobile/src/main/scala/com/github/shadowsocks/acl/CustomRulesFragment.scala
View file @
0acfaa12
...
...
@@ -46,8 +46,8 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi
private
def
createAclRuleDialog
(
text
:
CharSequence
=
""
)
=
{
val
view
=
getActivity
.
getLayoutInflater
.
inflate
(
R
.
layout
.
dialog_acl_rule
,
null
)
val
templateSelector
=
view
.
findViewById
(
R
.
id
.
template_selector
).
asInstanceOf
[
Spinner
]
val
editText
=
view
.
findViewById
(
R
.
id
.
content
).
asInstanceOf
[
EditText
]
val
templateSelector
=
view
.
findViewById
[
Spinner
](
R
.
id
.
template_selector
)
val
editText
=
view
.
findViewById
[
EditText
](
R
.
id
.
content
)
PATTERN_DOMAIN
.
findFirstMatchIn
(
text
)
match
{
case
Some
(
m
)
=>
templateSelector
.
setSelection
(
DOMAIN
)
...
...
@@ -70,7 +70,7 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi
private
final
class
AclRuleViewHolder
(
view
:
View
)
extends
RecyclerView
.
ViewHolder
(
view
)
with
View
.
OnClickListener
with
View
.
OnLongClickListener
{
var
item
:
AnyRef
=
_
private
val
text
=
itemView
.
findViewById
(
android
.
R
.
id
.
text1
).
asInstanceOf
[
TextView
]
private
val
text
=
itemView
.
findViewById
[
TextView
](
android
.
R
.
id
.
text1
)
itemView
.
setOnClickListener
(
this
)
itemView
.
setOnLongClickListener
(
this
)
itemView
.
setBackgroundResource
(
R
.
drawable
.
background_selectable
)
...
...
@@ -252,12 +252,11 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi
toolbar
.
setOnMenuItemClickListener
(
this
)
selectionItem
=
toolbar
.
getMenu
.
findItem
(
R
.
id
.
selection
)
selectionItem
.
setVisible
(
selectedItems
.
nonEmpty
)
list
=
view
.
findViewById
(
R
.
id
.
list
)
.
asInstanceOf
[
RecyclerView
]
list
=
view
.
findViewById
(
R
.
id
.
list
)
list
.
setLayoutManager
(
new
LinearLayoutManager
(
getActivity
,
LinearLayoutManager
.
VERTICAL
,
false
))
list
.
setItemAnimator
(
new
DefaultItemAnimator
)
list
.
setAdapter
(
adapter
)
val
fastScroller
=
view
.
findViewById
(
R
.
id
.
fastscroller
).
asInstanceOf
[
FastScroller
]
fastScroller
.
setRecyclerView
(
list
)
view
.
findViewById
[
FastScroller
](
R
.
id
.
fastscroller
).
setRecyclerView
(
list
)
undoManager
=
new
UndoSnackbarManager
[
AnyRef
](
getActivity
.
findViewById
(
R
.
id
.
snackbar
),
adapter
.
undo
)
new
ItemTouchHelper
(
new
SimpleCallback
(
0
,
ItemTouchHelper
.
START
|
ItemTouchHelper
.
END
)
{
override
def
getSwipeDirs
(
recyclerView
:
RecyclerView
,
viewHolder
:
ViewHolder
)
:
Int
=
...
...
mobile/src/main/scala/com/github/shadowsocks/preference/BottomSheetPreferenceDialogFragment.scala
View file @
0acfaa12
...
...
@@ -46,9 +46,9 @@ final class BottomSheetPreferenceDialogFragment extends PreferenceDialogFragment
private
final
class
IconListViewHolder
(
val
dialog
:
BottomSheetDialog
,
view
:
View
)
extends
ViewHolder
(
view
)
with
View
.
OnClickListener
with
View
.
OnLongClickListener
{
private
var
index
:
Int
=
_
private
val
text1
=
view
.
findViewById
(
android
.
R
.
id
.
text1
).
asInstanceOf
[
TextView
]
private
val
text2
=
view
.
findViewById
(
android
.
R
.
id
.
text2
).
asInstanceOf
[
TextView
]
private
val
icon
=
view
.
findViewById
(
android
.
R
.
id
.
icon
).
asInstanceOf
[
ImageView
]
private
val
text1
=
view
.
findViewById
[
TextView
](
android
.
R
.
id
.
text1
)
private
val
text2
=
view
.
findViewById
[
TextView
](
android
.
R
.
id
.
text2
)
private
val
icon
=
view
.
findViewById
[
ImageView
](
android
.
R
.
id
.
icon
)
view
.
setOnClickListener
(
this
)
view
.
setOnLongClickListener
(
this
)
...
...
plugin/src/main/scala/be/mygod/preference/EditTextPreferenceDialogFragment.scala
View file @
0acfaa12
...
...
@@ -36,7 +36,7 @@ class EditTextPreferenceDialogFragment extends PreferenceDialogFragment {
val
oldParent
=
editText
.
getParent
.
asInstanceOf
[
ViewGroup
]
if
(
oldParent
eq
view
)
return
if
(
oldParent
!=
null
)
oldParent
.
removeView
(
editText
)
val
oldEdit
=
view
.
findViewById
(
android
.
R
.
id
.
edit
)
val
oldEdit
=
view
.
findViewById
[
View
]
(
android
.
R
.
id
.
edit
)
if
(
oldEdit
==
null
)
return
val
container
=
oldEdit
.
getParent
.
asInstanceOf
[
ViewGroup
]
if
(
container
==
null
)
return
...
...
plugin/src/main/scala/be/mygod/preference/PreferenceGroupAdapter.scala
View file @
0acfaa12
...
...
@@ -77,7 +77,7 @@ class PreferenceGroupAdapter(group: PreferenceGroup) extends Old(group) {
view
.
setBackground
(
background
)
ViewCompat
.
setPaddingRelative
(
view
,
s
,
t
,
e
,
b
)
}
val
widgetFrame
=
view
.
findViewById
(
android
.
R
.
id
.
widget_frame
).
asInstanceOf
[
ViewGroup
]
val
widgetFrame
=
view
.
findViewById
[
ViewGroup
](
android
.
R
.
id
.
widget_frame
)
if
(
widgetFrame
!=
null
)
{
val
widgetResId
=
fieldWidgetResId
.
get
(
pl
).
asInstanceOf
[
Int
]
if
(
widgetResId
!=
0
)
inflater
.
inflate
(
widgetResId
,
widgetFrame
)
else
widgetFrame
.
setVisibility
(
View
.
GONE
)
...
...
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