Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PDF Viewer Scanner White ago
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kuxulei
PDF Viewer Scanner White ago
Commits
b54caee8
Commit
b54caee8
authored
Oct 17, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
df40beb7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
9 deletions
+23
-9
AdmobHelper.kt
...in/java/com/base/pdfviewerscannerwhite/ads/AdmobHelper.kt
+5
-1
AdmobInterstitialUtils.kt
...pdfviewerscannerwhite/ads/admob/AdmobInterstitialUtils.kt
+8
-3
PdfActivity.kt
...base/pdfviewerscannerwhite/ui/document/pdf/PdfActivity.kt
+9
-4
SplashActivity.kt
...om/base/pdfviewerscannerwhite/ui/splash/SplashActivity.kt
+1
-1
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/ads/AdmobHelper.kt
View file @
b54caee8
package
com.base.pdfviewerscannerwhite.ads
package
com.base.pdfviewerscannerwhite.ads
import
android.app.Activity
import
com.base.pdfviewerscannerwhite.ads.admob.AdmobInterstitialUtils
import
com.base.pdfviewerscannerwhite.ads.admob.AdmobNativeUtils
import
com.base.pdfviewerscannerwhite.ads.admob.AdmobNativeUtils
import
com.base.pdfviewerscannerwhite.helper.BaseActivity
import
com.base.pdfviewerscannerwhite.helper.EventUtils
import
com.base.pdfviewerscannerwhite.helper.EventUtils
import
com.base.pdfviewerscannerwhite.helper.MyApplication
import
com.base.pdfviewerscannerwhite.helper.MyApplication
import
com.base.pdfviewerscannerwhite.utils.AppPreferences
import
com.base.pdfviewerscannerwhite.utils.AppPreferences
...
@@ -57,11 +60,12 @@ object AdmobHelper {
...
@@ -57,11 +60,12 @@ object AdmobHelper {
var
isAdInit
=
AtomicBoolean
(
false
)
var
isAdInit
=
AtomicBoolean
(
false
)
fun
initAdmobAd
()
{
fun
initAdmobAd
(
activity
:
Activity
)
{
MobileAds
.
initialize
(
MyApplication
.
context
)
{
initializationStatus
->
MobileAds
.
initialize
(
MyApplication
.
context
)
{
initializationStatus
->
isAdInit
.
set
(
true
)
isAdInit
.
set
(
true
)
EventUtils
.
event
(
"AdmobInit"
,
"AdmobInit"
)
EventUtils
.
event
(
"AdmobInit"
,
"AdmobInit"
)
AdmobNativeUtils
.
loadNativeAd
()
AdmobNativeUtils
.
loadNativeAd
()
AdmobInterstitialUtils
.
loadInterstitialAd
(
activity
)
}
}
}
}
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ads/admob/AdmobInterstitialUtils.kt
View file @
b54caee8
...
@@ -28,7 +28,6 @@ object AdmobInterstitialUtils {
...
@@ -28,7 +28,6 @@ object AdmobInterstitialUtils {
private
var
interLoadTime
=
Long
.
MAX_VALUE
private
var
interLoadTime
=
Long
.
MAX_VALUE
private
var
adLastDisplayTime
:
Long
=
0
private
var
adLastDisplayTime
:
Long
=
0
private
val
mRequest
=
AdRequest
.
Builder
().
build
()
private
val
mRequest
=
AdRequest
.
Builder
().
build
()
private
var
dialog
:
Dialog
?
=
null
private
fun
isAdExpired
():
Boolean
{
private
fun
isAdExpired
():
Boolean
{
return
System
.
currentTimeMillis
()
-
interLoadTime
>
1000
*
60
*
60
return
System
.
currentTimeMillis
()
-
interLoadTime
>
1000
*
60
*
60
...
@@ -66,10 +65,11 @@ object AdmobInterstitialUtils {
...
@@ -66,10 +65,11 @@ object AdmobInterstitialUtils {
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj1
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj1
)
if
(
interAd
!=
null
)
{
if
(
interAd
!=
null
)
{
var
dialog
:
Dialog
?
=
null
if
(!
activity
.
isFinishing
&&
!
activity
.
isDestroyed
)
{
if
(!
activity
.
isFinishing
&&
!
activity
.
isDestroyed
)
{
dialog
=
activity
.
showAdPreparingDialog
()
dialog
=
activity
.
showAdPreparingDialog
()
}
}
displayInterstitialAd
(
activity
,
onHidden
)
displayInterstitialAd
(
activity
,
dialog
,
onHidden
)
}
else
{
}
else
{
showAdDialogAndLoadInterstitial
(
activity
,
isReLoadAd
,
isShowDialog
,
onHidden
)
showAdDialogAndLoadInterstitial
(
activity
,
isReLoadAd
,
isShowDialog
,
onHidden
)
}
}
...
@@ -148,7 +148,11 @@ object AdmobInterstitialUtils {
...
@@ -148,7 +148,11 @@ object AdmobInterstitialUtils {
}
}
}
}
private
fun
displayInterstitialAd
(
activity
:
Activity
,
onHidden
:
((
showed
:
Boolean
)
->
Unit
)?
=
null
)
{
private
fun
displayInterstitialAd
(
activity
:
Activity
,
dialog
:
Dialog
?
=
null
,
onHidden
:
((
showed
:
Boolean
)
->
Unit
)?
=
null
)
{
val
thisInterAd
=
interAd
val
thisInterAd
=
interAd
interAd
=
null
interAd
=
null
thisInterAd
?.
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
thisInterAd
?.
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
...
@@ -158,6 +162,7 @@ object AdmobInterstitialUtils {
...
@@ -158,6 +162,7 @@ object AdmobInterstitialUtils {
}
}
override
fun
onAdDismissedFullScreenContent
()
{
override
fun
onAdDismissedFullScreenContent
()
{
dialog
?.
dismiss
()
interAd
=
null
interAd
=
null
onHidden
?.
invoke
(
true
)
onHidden
?.
invoke
(
true
)
loadInterstitialAd
(
activity
)
loadInterstitialAd
(
activity
)
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/pdf/PdfActivity.kt
View file @
b54caee8
...
@@ -76,6 +76,15 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
...
@@ -76,6 +76,15 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
}
}
}
}
override
fun
onPause
()
{
super
.
onPause
()
searchTask
?.
stop
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
}
override
fun
initView
()
{
override
fun
initView
()
{
val
metrics
=
DisplayMetrics
()
val
metrics
=
DisplayMetrics
()
...
@@ -578,10 +587,6 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
...
@@ -578,10 +587,6 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
}
}
override
fun
onPause
()
{
super
.
onPause
()
searchTask
?.
stop
()
}
fun
switchOrientation
()
{
fun
switchOrientation
()
{
requestedOrientation
=
if
(
requestedOrientation
==
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
)
{
requestedOrientation
=
if
(
requestedOrientation
==
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
)
{
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/splash/SplashActivity.kt
View file @
b54caee8
...
@@ -144,7 +144,7 @@ class SplashActivity : BaseActivity<ActivitySplash2Binding>(), SplashView {
...
@@ -144,7 +144,7 @@ class SplashActivity : BaseActivity<ActivitySplash2Binding>(), SplashView {
override
fun
agreePrivacy
()
{
override
fun
agreePrivacy
()
{
if
(
umpCanAd
)
{
if
(
umpCanAd
)
{
initAdmobAd
()
initAdmobAd
(
this
)
showAd
()
showAd
()
splashPresenter
.
startJumpJob
=
true
splashPresenter
.
startJumpJob
=
true
splashPresenter
.
startJumpJob
(
lifecycleScope
)
splashPresenter
.
startJumpJob
(
lifecycleScope
)
...
...
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