Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PDF Viewer Scanner White
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
wanglei
PDF Viewer Scanner White
Commits
ab608d8a
Commit
ab608d8a
authored
Oct 10, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
a35863f5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
24 deletions
+21
-24
NativeView.kt
...va/com/base/pdfviewerscannerwhite/ads/admob/NativeView.kt
+3
-1
DocumentFragment.kt
...om/base/pdfviewerscannerwhite/ui/main/DocumentFragment.kt
+1
-3
DocumentPageFragment.kt
...ase/pdfviewerscannerwhite/ui/main/DocumentPageFragment.kt
+17
-20
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/ads/admob/NativeView.kt
View file @
ab608d8a
...
...
@@ -27,7 +27,9 @@ class NativeView(context: Context, val layout: Int, attrs: AttributeSet? = null)
val
adView
=
LayoutInflater
.
from
(
context
)
.
inflate
(
layout
,
this
,
false
)
as
NativeAdView
adView
.
advertiserView
=
adView
.
findViewById
(
R
.
id
.
ad_advertiser
)
runCatching
{
adView
.
advertiserView
=
adView
.
findViewById
(
R
.
id
.
ad_advertiser
)
}
adView
.
mediaView
=
adView
.
findViewById
(
R
.
id
.
ad_media
)
adView
.
headlineView
=
adView
.
findViewById
(
R
.
id
.
ad_headline
)
adView
.
bodyView
=
adView
.
findViewById
(
R
.
id
.
ad_body
)
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/DocumentFragment.kt
View file @
ab608d8a
...
...
@@ -2,7 +2,6 @@ package com.base.pdfviewerscannerwhite.ui.main
import
android.annotation.SuppressLint
import
android.os.Bundle
import
android.util.Log
import
android.view.View
import
android.view.inputmethod.EditorInfo
import
androidx.core.content.ContextCompat
...
...
@@ -12,7 +11,6 @@ import androidx.viewpager2.widget.ViewPager2
import
com.angcyo.tablayout.DslTabIndicator
import
com.angcyo.tablayout.delegate2.ViewPager2Delegate
import
com.base.pdfviewerscannerwhite.R
import
com.base.pdfviewerscannerwhite.bean.ConstObject
import
com.base.pdfviewerscannerwhite.bean.ConstObject.BOOKMARK_DATA_TYPE
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DOCUMENT_DATA_TYPE
import
com.base.pdfviewerscannerwhite.bean.ConstObject.RECENT_DATA_TYPE
...
...
@@ -89,7 +87,7 @@ class DocumentFragment(
if
(
hidden
)
{
return
}
currentPage
.
refreshData
()
//
currentPage.refreshData()
}
private
fun
initSearchAdapter
()
{
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/DocumentPageFragment.kt
View file @
ab608d8a
...
...
@@ -32,7 +32,7 @@ import java.util.Locale
class
DocumentPageFragment
()
:
BaseFragment
<
FragmentDocumentPageBinding
>(),
DocumentView
{
private
val
TAG
=
"DocumentFragment"
private
val
TAG
=
"Document
Page
Fragment"
var
type
=
TYPE_PDF
var
dataType
:
String
=
""
lateinit
var
adapter
:
DocumentAdapter
...
...
@@ -59,34 +59,31 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
}
fun
refreshData
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
LogEx
.
logDebug
(
TAG
,
"type=$type refreshData"
)
if
(
isInitialized
&&
!
isHidden
)
{
val
list
=
(
requireActivity
()
as
MainActivity
).
mainPresenter
.
getDataByType
(
type
,
dataType
)
.
toMutableList
()
(
requireActivity
()
as
MainActivity
).
mainPresenter
.
getDataByType
(
type
,
dataType
)
val
dataType
=
(
parentFragment
as
DocumentFragment
).
dataType
launch
(
Dispatchers
.
Main
)
{
val
arrayList
=
arrayListOf
<
DocumentBean
>()
if
(
dataType
==
ConstObject
.
RECENT_DATA_TYPE
)
{
if
(
list
.
isNotEmpty
())
{
list
.
add
(
1
,
DocumentBean
().
apply
{
isAd
=
true
})
}
adapter
.
submitList
(
list
)
}
else
{
if
(
dataType
!=
ConstObject
.
RECENT_DATA_TYPE
)
{
val
sortList
=
sortByMode
(
list
)
val
arrayList
=
arrayListOf
<
DocumentBean
>()
arrayList
.
addAll
(
sortList
)
if
(
arrayList
.
isNotEmpty
())
{
arrayList
.
add
(
1
,
DocumentBean
().
apply
{
isAd
=
true
})
}
adapter
.
submitList
(
arrayList
)
}
else
{
arrayList
.
addAll
(
list
)
}
binding
.
llEmpty
.
isVisible
=
list
.
isEmpty
()
if
(
list
.
isEmpty
())
{
launch
(
Dispatchers
.
Main
)
{
binding
.
llEmpty
.
isVisible
=
arrayList
.
isEmpty
()
if
(
arrayList
.
isEmpty
())
{
binding
.
flAd
.
visibility
=
View
.
VISIBLE
AdmobNativeUtils
.
showNativeAd
(
requireActivity
(),
binding
.
flAd
,
R
.
layout
.
item
_document
)
AdmobNativeUtils
.
showNativeAd
(
requireActivity
(),
binding
.
flAd
,
R
.
layout
.
layout_admob
_document
)
}
else
{
binding
.
flAd
.
visibility
=
View
.
GONE
arrayList
.
add
(
1
,
DocumentBean
().
apply
{
isAd
=
true
})
}
adapter
.
submitList
(
arrayList
)
}
// Log.d("glc", "加载数据成功:" + type + " list:" + list.size)
}
else
{
...
...
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