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
ae222a10
Commit
ae222a10
authored
Jul 14, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine code style
parent
f36a0adf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
23 deletions
+18
-23
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
.../src/main/java/com/github/shadowsocks/ProfilesFragment.kt
+18
-23
No files found.
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
View file @
ae222a10
...
...
@@ -118,34 +118,29 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
fun
attach
()
{
if
(!
isAdLoaded
&&
item
.
host
==
"198.199.101.152"
)
{
if
(
this
.
adView
==
null
)
{
val
params
=
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
AdSize
.
SMART_BANNER
.
getHeightInPixels
(
context
))
params
.
gravity
=
Gravity
.
CENTER_HORIZONTAL
var
adView
=
AdView
(
context
)
adView
.
layoutParams
=
params
adView
.
adUnitId
=
"ca-app-pub-9097031975646651/7760346322"
adView
.
adSize
=
AdSize
.
SMART_BANNER
itemView
.
findViewById
<
LinearLayout
>(
R
.
id
.
content
).
addView
(
adView
)
// Load Ad
val
adBuilder
=
AdRequest
.
Builder
()
adBuilder
.
addTestDevice
(
"B08FC1764A7B250E91EA9D0D5EBEB208"
)
adBuilder
.
addTestDevice
(
"7509D18EB8AF82F915874FEF53877A64"
)
adView
.
loadAd
(
adBuilder
.
build
())
this
.
adView
=
adView
}
else
this
.
adView
?.
visibility
=
View
.
VISIBLE
if
(
adView
==
null
)
{
adView
=
AdView
(
context
).
apply
{
layoutParams
=
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
AdSize
.
SMART_BANNER
.
getHeightInPixels
(
context
)).
apply
{
gravity
=
Gravity
.
CENTER_HORIZONTAL
}
adUnitId
=
"ca-app-pub-9097031975646651/7760346322"
adSize
=
AdSize
.
SMART_BANNER
itemView
.
findViewById
<
LinearLayout
>(
R
.
id
.
content
).
addView
(
this
)
loadAd
(
AdRequest
.
Builder
().
apply
{
addTestDevice
(
"B08FC1764A7B250E91EA9D0D5EBEB208"
)
addTestDevice
(
"7509D18EB8AF82F915874FEF53877A64"
)
}.
build
())
}
}
else
adView
?.
visibility
=
View
.
VISIBLE
isAdLoaded
=
true
}
else
this
.
adView
?.
visibility
=
View
.
GONE
}
else
adView
?.
visibility
=
View
.
GONE
}
fun
detach
()
{
if
(
this
.
adView
?.
visibility
==
View
.
VISIBLE
)
{
if
(
adView
?.
visibility
==
View
.
VISIBLE
)
{
isAdLoaded
=
false
this
.
adView
?.
visibility
=
=
View
.
GONE
adView
?.
visibility
=
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