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
7096a17f
Commit
7096a17f
authored
Sep 25, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
c7a1e38b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1575 additions
and
1399 deletions
+1575
-1399
build.gradle.kts
app/build.gradle.kts
+1
-0
ExcelActivity.kt
.../pdfviewerscannerwhite/ui/document/excel/ExcelActivity.kt
+97
-8
PptActivity.kt
...base/pdfviewerscannerwhite/ui/document/ppt/PptActivity.kt
+75
-3
MainActivity.kt
...va/com/base/pdfviewerscannerwhite/ui/main/MainActivity.kt
+1
-1
DialogView.kt
...java/com/base/pdfviewerscannerwhite/ui/view/DialogView.kt
+21
-0
activity_excel.xml
app/src/main/res/layout/activity_excel.xml
+109
-6
activity_main.xml
app/src/main/res/layout/activity_main.xml
+0
-1
activity_ppt.xml
app/src/main/res/layout/activity_ppt.xml
+126
-3
dialog_document_more.xml
app/src/main/res/layout/dialog_document_more.xml
+173
-0
IOffice.java
library/src/main/java/com/cherry/lib/doc/office/IOffice.java
+6
-2
TouchEventListener.java
...a/com/cherry/lib/doc/office/macro/TouchEventListener.java
+0
-1
PGControl.java
.../java/com/cherry/lib/doc/office/pg/control/PGControl.java
+215
-301
PGEventManage.java
...a/com/cherry/lib/doc/office/pg/control/PGEventManage.java
+0
-2
PGPrintMode.java
...ava/com/cherry/lib/doc/office/pg/control/PGPrintMode.java
+258
-347
AbstractControl.kt
.../java/com/cherry/lib/doc/office/system/AbstractControl.kt
+1
-1
IMainFrame.java
...ain/java/com/cherry/lib/doc/office/system/IMainFrame.java
+110
-110
MainControl.java
...in/java/com/cherry/lib/doc/office/system/MainControl.java
+2
-1
AEventManage.java
.../com/cherry/lib/doc/office/system/beans/AEventManage.java
+115
-172
PrintWord.java
.../java/com/cherry/lib/doc/office/wp/control/PrintWord.java
+234
-337
Word.java
.../main/java/com/cherry/lib/doc/office/wp/control/Word.java
+2
-0
DocView.kt
library/src/main/java/com/cherry/lib/doc/widget/DocView.kt
+29
-59
doc_view.xml
library/src/main/res/layout/doc_view.xml
+0
-44
No files found.
app/build.gradle.kts
View file @
7096a17f
...
@@ -60,6 +60,7 @@ dependencies {
...
@@ -60,6 +60,7 @@ dependencies {
implementation
(
"io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.4"
)
implementation
(
"io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.4"
)
implementation
(
"com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:1.0.0"
)
implementation
(
"com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:1.0.0"
)
implementation
(
"com.github.angcyo.DslTablayout:TabLayout:3.5.5"
)
implementation
(
"com.github.angcyo.DslTablayout:TabLayout:3.5.5"
)
implementation
(
"com.github.angcyo.DslTablayout:ViewPager2Delegate:3.5.5"
)
//mlkit
//mlkit
implementation
(
"com.google.android.gms:play-services-mlkit-document-scanner:16.0.0-beta1"
)
implementation
(
"com.google.android.gms:play-services-mlkit-document-scanner:16.0.0-beta1"
)
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/excel/ExcelActivity.kt
View file @
7096a17f
package
com.base.pdfviewerscannerwhite.ui.document.excel
package
com.base.pdfviewerscannerwhite.ui.document.excel
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Activity
import
android.content.Intent
import
android.content.Intent
import
android.content.pm.ActivityInfo
import
android.view.View
import
android.view.animation.Animation
import
android.view.animation.TranslateAnimation
import
androidx.activity.addCallback
import
com.base.pdfviewerscannerwhite.bean.DocumentBean
import
com.base.pdfviewerscannerwhite.databinding.ActivityExcelBinding
import
com.base.pdfviewerscannerwhite.databinding.ActivityExcelBinding
import
com.base.pdfviewerscannerwhite.helper.BaseActivity
import
com.base.pdfviewerscannerwhite.helper.BaseActivity
import
com.base.pdfviewerscannerwhite.ui.view.DialogView.showDocumentMore
import
com.base.pdfviewerscannerwhite.utils.KeyBoardUtils.hideKeyboard
import
com.base.pdfviewerscannerwhite.utils.LogEx
import
com.base.pdfviewerscannerwhite.utils.LogEx
import
com.cherry.lib.doc.bean.DocEngine
import
com.cherry.lib.doc.bean.DocEngine
import
com.cherry.lib.doc.util.Constant
import
com.cherry.lib.doc.util.Constant
import
java.io.File
class
ExcelActivity
:
BaseActivity
<
ActivityExcelBinding
>()
{
class
ExcelActivity
:
BaseActivity
<
ActivityExcelBinding
>()
{
...
@@ -20,13 +30,13 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
...
@@ -20,13 +30,13 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
fun
launchDocViewer
(
fun
launchDocViewer
(
activity
:
Activity
,
activity
:
Activity
,
docSourceType
:
Int
,
docSourceType
:
Int
,
path
:
String
?,
path
OrUri
:
String
?,
fileType
:
Int
?
=
null
,
fileType
:
Int
?
=
null
,
engine
:
Int
?
=
null
engine
:
Int
?
=
null
)
{
)
{
val
intent
=
Intent
(
activity
,
ExcelActivity
::
class
.
java
)
val
intent
=
Intent
(
activity
,
ExcelActivity
::
class
.
java
)
intent
.
putExtra
(
Constant
.
INTENT_SOURCE_KEY
,
docSourceType
)
intent
.
putExtra
(
Constant
.
INTENT_SOURCE_KEY
,
docSourceType
)
intent
.
putExtra
(
Constant
.
INTENT_DATA_KEY
,
path
)
intent
.
putExtra
(
Constant
.
INTENT_DATA_KEY
,
path
OrUri
)
intent
.
putExtra
(
Constant
.
INTENT_TYPE_KEY
,
fileType
)
intent
.
putExtra
(
Constant
.
INTENT_TYPE_KEY
,
fileType
)
intent
.
putExtra
(
Constant
.
INTENT_ENGINE_KEY
,
engine
)
intent
.
putExtra
(
Constant
.
INTENT_ENGINE_KEY
,
engine
)
activity
.
startActivity
(
intent
)
activity
.
startActivity
(
intent
)
...
@@ -34,21 +44,100 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
...
@@ -34,21 +44,100 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
}
}
override
fun
initView
()
{
override
fun
initView
()
{
initData
(
intent
)
initSpData
(
intent
)
val
file
=
File
(
pathOrUri
?:
""
)
if
(
file
.
exists
())
{
binding
.
tvName
.
text
=
file
.
name
}
}
@SuppressLint
(
"ClickableViewAccessibility"
)
override
fun
initListener
()
{
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
finishToMain
()
}
binding
.
flFanhui
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
}
binding
.
ivXuanzhuan
.
setOnClickListener
{
switchOrientation
()
}
binding
.
ivMore
.
setOnClickListener
{
showDocumentMore
(
DocumentBean
.
TYPE_EXCEL
)
}
binding
.
mDocView
.
singleTapAction
=
{
LogEx
.
logDebug
(
TAG
,
"actionDownCallBack"
)
if
(
isShowTopLayout
)
{
LogEx
.
logDebug
(
TAG
,
"hide"
)
hideTopLayout
()
}
else
{
showTopLayout
()
LogEx
.
logDebug
(
TAG
,
"show"
)
}
}
}
private
fun
switchOrientation
()
{
requestedOrientation
=
if
(
requestedOrientation
==
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
)
{
ActivityInfo
.
SCREEN_ORIENTATION_LANDSCAPE
}
else
{
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
}
}
private
var
isShowTopLayout
=
true
private
fun
showTopLayout
()
{
if
(!
isShowTopLayout
)
{
isShowTopLayout
=
true
val
topAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
-
binding
.
vAnimatorTop
.
height
.
toFloat
(),
0f
)
topAnim
.
setDuration
(
200
)
topAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{
binding
.
vAnimatorTop
.
visibility
=
View
.
VISIBLE
}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
}
})
binding
.
vAnimatorTop
.
startAnimation
(
topAnim
)
}
}
private
fun
hideTopLayout
()
{
if
(
isShowTopLayout
)
{
isShowTopLayout
=
false
hideKeyboard
(
binding
.
editSearch
)
val
topAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
0f
,
-
binding
.
vAnimatorTop
.
height
.
toFloat
())
topAnim
.
setDuration
(
200
)
topAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
binding
.
vAnimatorTop
.
visibility
=
View
.
GONE
}
})
binding
.
vAnimatorTop
.
startAnimation
(
topAnim
)
}
}
}
private
var
docSourceType
=
0
private
var
docSourceType
=
0
private
var
fileType
=
-
1
private
var
fileType
=
-
1
private
var
engine
:
Int
=
DocEngine
.
INTERNAL
.
value
private
var
engine
:
Int
=
DocEngine
.
INTERNAL
.
value
private
var
docUrl
:
String
?
=
null
// 文件地址
private
var
pathOrUri
:
String
?
=
null
// 文件地址
fun
init
Data
(
intent
:
Intent
?)
{
private
fun
initSp
Data
(
intent
:
Intent
?)
{
docUrl
=
intent
?.
getStringExtra
(
Constant
.
INTENT_DATA_KEY
)
pathOrUri
=
intent
?.
getStringExtra
(
Constant
.
INTENT_DATA_KEY
)
docSourceType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_SOURCE_KEY
,
0
)
?:
0
docSourceType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_SOURCE_KEY
,
0
)
?:
0
fileType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_TYPE_KEY
,
-
1
)
?:
-
1
fileType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_TYPE_KEY
,
-
1
)
?:
-
1
engine
=
intent
?.
getIntExtra
(
Constant
.
INTENT_ENGINE_KEY
,
DocEngine
.
INTERNAL
.
value
)
?:
DocEngine
.
INTERNAL
.
value
engine
=
intent
?.
getIntExtra
(
Constant
.
INTENT_ENGINE_KEY
,
DocEngine
.
INTERNAL
.
value
)
?:
DocEngine
.
INTERNAL
.
value
binding
.
mDocView
.
openDoc
(
this
,
docUrl
,
docSourceType
,
fileType
,
false
,
DocEngine
.
values
().
first
{
it
.
value
==
engine
})
binding
.
mDocView
.
openDoc
(
this
,
pathOrUri
,
docSourceType
,
fileType
,
false
,
DocEngine
.
values
().
first
{
it
.
value
==
engine
})
LogEx
.
logDebug
(
TAG
,
"initData-
docUrl = $docUrl
"
)
LogEx
.
logDebug
(
TAG
,
"initData-
pathOrUri = $pathOrUri
"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
LogEx
.
logDebug
(
TAG
,
"initData-engine = $engine"
)
LogEx
.
logDebug
(
TAG
,
"initData-engine = $engine"
)
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/ppt/PptActivity.kt
View file @
7096a17f
package
com.base.pdfviewerscannerwhite.ui.document.ppt
package
com.base.pdfviewerscannerwhite.ui.document.ppt
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Activity
import
android.content.Intent
import
android.content.Intent
import
android.view.View
import
android.view.animation.Animation
import
android.view.animation.TranslateAnimation
import
androidx.activity.addCallback
import
androidx.core.view.isVisible
import
com.base.pdfviewerscannerwhite.databinding.ActivityPptBinding
import
com.base.pdfviewerscannerwhite.databinding.ActivityPptBinding
import
com.base.pdfviewerscannerwhite.helper.BaseActivity
import
com.base.pdfviewerscannerwhite.helper.BaseActivity
import
com.base.pdfviewerscannerwhite.utils.KeyBoardUtils.hideKeyboard
import
com.base.pdfviewerscannerwhite.utils.LogEx
import
com.base.pdfviewerscannerwhite.utils.LogEx
import
com.cherry.lib.doc.bean.DocEngine
import
com.cherry.lib.doc.bean.DocEngine
import
com.cherry.lib.doc.util.Constant
import
com.cherry.lib.doc.util.Constant
...
@@ -31,18 +38,45 @@ class PptActivity : BaseActivity<ActivityPptBinding>() {
...
@@ -31,18 +38,45 @@ class PptActivity : BaseActivity<ActivityPptBinding>() {
intent
.
putExtra
(
Constant
.
INTENT_ENGINE_KEY
,
engine
)
intent
.
putExtra
(
Constant
.
INTENT_ENGINE_KEY
,
engine
)
activity
.
startActivity
(
intent
)
activity
.
startActivity
(
intent
)
}
}
}
}
@SuppressLint
(
"SetTextI18n"
)
override
fun
initView
()
{
override
fun
initView
()
{
initData
(
intent
)
initSpData
(
intent
)
binding
.
mDocView
binding
.
mDocView
.
getPageNumberAction
=
{
current
,
total
->
if
(!
binding
.
tvPageCount
.
isVisible
)
{
binding
.
tvPageCount
.
isVisible
=
true
}
binding
.
tvPageCount
.
text
=
"$current/$total"
}
binding
.
mDocView
.
singleTapAction
=
{
LogEx
.
logDebug
(
TAG
,
"actionDownCallBack"
)
if
(
isShowTopLayout
)
{
LogEx
.
logDebug
(
TAG
,
"hide"
)
hideTopLayout
()
}
else
{
showTopLayout
()
LogEx
.
logDebug
(
TAG
,
"show"
)
}
}
}
override
fun
initListener
()
{
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
finishToMain
()
}
binding
.
flFanhui
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
}
}
}
private
var
docSourceType
=
0
private
var
docSourceType
=
0
private
var
fileType
=
-
1
private
var
fileType
=
-
1
private
var
engine
:
Int
=
DocEngine
.
INTERNAL
.
value
private
var
engine
:
Int
=
DocEngine
.
INTERNAL
.
value
private
var
docUrl
:
String
?
=
null
// 文件地址
private
var
docUrl
:
String
?
=
null
// 文件地址
fun
init
Data
(
intent
:
Intent
?)
{
private
fun
initSp
Data
(
intent
:
Intent
?)
{
docUrl
=
intent
?.
getStringExtra
(
Constant
.
INTENT_DATA_KEY
)
docUrl
=
intent
?.
getStringExtra
(
Constant
.
INTENT_DATA_KEY
)
docSourceType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_SOURCE_KEY
,
0
)
?:
0
docSourceType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_SOURCE_KEY
,
0
)
?:
0
fileType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_TYPE_KEY
,
-
1
)
?:
-
1
fileType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_TYPE_KEY
,
-
1
)
?:
-
1
...
@@ -54,4 +88,42 @@ class PptActivity : BaseActivity<ActivityPptBinding>() {
...
@@ -54,4 +88,42 @@ class PptActivity : BaseActivity<ActivityPptBinding>() {
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
LogEx
.
logDebug
(
TAG
,
"initData-engine = $engine"
)
LogEx
.
logDebug
(
TAG
,
"initData-engine = $engine"
)
}
}
private
fun
showTopLayout
()
{
if
(!
isShowTopLayout
)
{
isShowTopLayout
=
true
val
topAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
-
binding
.
vAnimatorTop
.
height
.
toFloat
(),
0f
)
topAnim
.
setDuration
(
200
)
topAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{
binding
.
vAnimatorTop
.
visibility
=
View
.
VISIBLE
}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
}
})
binding
.
vAnimatorTop
.
startAnimation
(
topAnim
)
}
}
private
var
isShowTopLayout
=
true
private
fun
hideTopLayout
()
{
if
(
isShowTopLayout
)
{
isShowTopLayout
=
false
hideKeyboard
(
binding
.
editSearch
)
val
topAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
0f
,
-
binding
.
vAnimatorTop
.
height
.
toFloat
())
topAnim
.
setDuration
(
200
)
topAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
binding
.
vAnimatorTop
.
visibility
=
View
.
GONE
}
})
binding
.
vAnimatorTop
.
startAnimation
(
topAnim
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/MainActivity.kt
View file @
7096a17f
...
@@ -61,7 +61,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), MainView {
...
@@ -61,7 +61,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), MainView {
binding
.
viewPager2
.
offscreenPageLimit
=
4
binding
.
viewPager2
.
offscreenPageLimit
=
4
binding
.
viewPager2
.
run
{
binding
.
viewPager2
.
run
{
isUserInputEnabled
=
fals
e
isUserInputEnabled
=
tru
e
adapter
=
object
:
FragmentStateAdapter
(
this
@MainActivity
)
{
adapter
=
object
:
FragmentStateAdapter
(
this
@MainActivity
)
{
override
fun
getItemCount
():
Int
{
override
fun
getItemCount
():
Int
{
return
fragments
.
size
return
fragments
.
size
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/view/DialogView.kt
View file @
7096a17f
...
@@ -12,9 +12,11 @@ import androidx.core.content.FileProvider
...
@@ -12,9 +12,11 @@ import androidx.core.content.FileProvider
import
androidx.core.widget.addTextChangedListener
import
androidx.core.widget.addTextChangedListener
import
com.base.pdfviewerscannerwhite.R
import
com.base.pdfviewerscannerwhite.R
import
com.base.pdfviewerscannerwhite.bean.DocumentBean
import
com.base.pdfviewerscannerwhite.bean.DocumentBean
import
com.base.pdfviewerscannerwhite.bean.DocumentBean.Companion.TYPE_EXCEL
import
com.base.pdfviewerscannerwhite.databinding.DialogCommonTipBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogCommonTipBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogDeleteBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogDeleteBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogDocumentDetailBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogDocumentDetailBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogDocumentMoreBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogDocumentRenameBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogDocumentRenameBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogPageNumberBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogPageNumberBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogPdfDetailBinding
import
com.base.pdfviewerscannerwhite.databinding.DialogPdfDetailBinding
...
@@ -25,6 +27,7 @@ import com.base.pdfviewerscannerwhite.ui.adapter.DocumentAdapter
...
@@ -25,6 +27,7 @@ import com.base.pdfviewerscannerwhite.ui.adapter.DocumentAdapter
import
com.base.pdfviewerscannerwhite.ui.document.pdf.PdfBoxUtils
import
com.base.pdfviewerscannerwhite.ui.document.pdf.PdfBoxUtils
import
com.base.pdfviewerscannerwhite.ui.main.DocumentView
import
com.base.pdfviewerscannerwhite.ui.main.DocumentView
import
com.base.pdfviewerscannerwhite.ui.document.pdf.PdfView
import
com.base.pdfviewerscannerwhite.ui.document.pdf.PdfView
import
com.base.pdfviewerscannerwhite.ui.view.DialogView.showPdfMoreDialog
import
com.base.pdfviewerscannerwhite.utils.ActivityLauncher
import
com.base.pdfviewerscannerwhite.utils.ActivityLauncher
import
com.base.pdfviewerscannerwhite.utils.IntentShareUtils.sharePdfIntent
import
com.base.pdfviewerscannerwhite.utils.IntentShareUtils.sharePdfIntent
import
com.base.pdfviewerscannerwhite.utils.IntentShareUtils.sharePdfPrintIntent
import
com.base.pdfviewerscannerwhite.utils.IntentShareUtils.sharePdfPrintIntent
...
@@ -228,6 +231,24 @@ object DialogView {
...
@@ -228,6 +231,24 @@ object DialogView {
}
}
fun
Activity
.
showDocumentMore
(
type
:
String
)
{
val
dialog
=
BottomSheetDialog
(
this
,
R
.
style
.
BottomSheetDialog
)
val
binding
=
DialogDocumentMoreBinding
.
inflate
(
LayoutInflater
.
from
(
this
))
dialog
.
setContentView
(
binding
.
root
)
dialog
.
setCanceledOnTouchOutside
(
false
)
dialog
.
show
()
val
parentView
=
binding
.
root
.
parent
as
View
val
behavior
=
BottomSheetBehavior
.
from
(
parentView
)
//展开
behavior
.
state
=
BottomSheetBehavior
.
STATE_EXPANDED
if
(
type
==
TYPE_EXCEL
)
{
binding
.
llJump
.
visibility
=
View
.
GONE
}
}
@SuppressLint
(
"SetTextI18n"
)
@SuppressLint
(
"SetTextI18n"
)
fun
Context
.
showPdfPwdDialog
(
fun
Context
.
showPdfPwdDialog
(
...
...
app/src/main/res/layout/activity_excel.xml
View file @
7096a17f
...
@@ -7,16 +7,119 @@
...
@@ -7,16 +7,119 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.document.excel.ExcelActivity"
>
tools:context=
".ui.document.excel.ExcelActivity"
>
<ViewAnimator
android:id=
"@+id/v_animator_top"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:background=
"@color/white"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_top"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
app:layout_constraintTop_toTopOf=
"parent"
>
<FrameLayout
android:id=
"@+id/fl_fanhui"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/tv_name"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:padding=
"15dp"
android:src=
"@mipmap/fanhui_b"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<TextView
android:id=
"@+id/tv_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:singleLine=
"true"
android:textColor=
"@color/black"
android:textSize=
"19sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/iv_xuanzhuan"
app:layout_constraintStart_toEndOf=
"@id/fl_fanhui"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"HardcodedText"
tools:text=
"DEMO.xlsx"
/>
<ImageView
android:id=
"@+id/iv_xuanzhuan"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/hengping"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_search"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_search"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/h_sousuo"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_more"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_more"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/x_genduo"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<EditText
android:id=
"@+id/edit_search"
android:layout_width=
"0dp"
android:layout_height=
"40dp"
android:layout_marginStart=
"5dp"
android:layout_marginEnd=
"20dp"
android:background=
"@drawable/bg_f8f9fe_10"
android:hint=
"input..."
android:paddingHorizontal=
"18dp"
android:singleLine=
"true"
android:textColor=
"@color/black"
android:textColorHint=
"#B8B9BD"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_search"
app:layout_constraintStart_toEndOf=
"@id/fl_fanhui"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"Autofill,HardcodedText,TextFields"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ViewAnimator>
<com.cherry.lib.doc.widget.DocView
<com.cherry.lib.doc.widget.DocView
android:id=
"@+id/mDocView"
android:id=
"@+id/mDocView"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"0dp"
app:dv_engine=
"internal"
app:dv_moving_orientation=
"vertical"
app:dv_moving_orientation=
"vertical"
app:dv_page_pb_color=
"@color/yellow"
app:dv_show_page_num=
"false"
app:dv_page_pb_height=
"2dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:dv_quality=
"normal"
app:layout_constraintTop_toBottomOf=
"@id/v_animator_top"
/>
app:dv_show_page_num=
"false"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
7096a17f
...
@@ -166,7 +166,6 @@
...
@@ -166,7 +166,6 @@
</com.angcyo.tablayout.DslTabLayout>
</com.angcyo.tablayout.DslTabLayout>
</FrameLayout>
</FrameLayout>
<androidx.viewpager2.widget.ViewPager2
<androidx.viewpager2.widget.ViewPager2
android:id=
"@+id/viewPager2"
android:id=
"@+id/viewPager2"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/activity_ppt.xml
View file @
7096a17f
...
@@ -7,15 +7,138 @@
...
@@ -7,15 +7,138 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.document.ppt.PptActivity"
>
tools:context=
".ui.document.ppt.PptActivity"
>
<ViewAnimator
android:id=
"@+id/v_animator_top"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:background=
"@color/white"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_top"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
app:layout_constraintTop_toTopOf=
"parent"
>
<FrameLayout
android:id=
"@+id/fl_fanhui"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/tv_name"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:padding=
"15dp"
android:src=
"@mipmap/fanhui_b"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<TextView
android:id=
"@+id/tv_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:singleLine=
"true"
android:textColor=
"@color/black"
android:textSize=
"19sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/iv_xuanzhuan"
app:layout_constraintStart_toEndOf=
"@id/fl_fanhui"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"HardcodedText"
tools:text=
"DEMO.ppt"
/>
<ImageView
android:id=
"@+id/iv_xuanzhuan"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/hengping"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_search"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_search"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/h_sousuo"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_more"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_more"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/x_genduo"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<EditText
android:id=
"@+id/edit_search"
android:layout_width=
"0dp"
android:layout_height=
"40dp"
android:layout_marginStart=
"5dp"
android:layout_marginEnd=
"20dp"
android:background=
"@drawable/bg_f8f9fe_10"
android:hint=
"input..."
android:paddingHorizontal=
"18dp"
android:singleLine=
"true"
android:textColor=
"@color/black"
android:textColorHint=
"#B8B9BD"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_search"
app:layout_constraintStart_toEndOf=
"@id/fl_fanhui"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"Autofill,HardcodedText,TextFields"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ViewAnimator>
<com.cherry.lib.doc.widget.DocView
<com.cherry.lib.doc.widget.DocView
android:id=
"@+id/mDocView"
android:id=
"@+id/mDocView"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
match_parent
"
android:layout_height=
"
0dp
"
app:dv_engine=
"internal"
app:dv_engine=
"internal"
app:dv_moving_orientation=
"vertical"
app:dv_moving_orientation=
"vertical"
app:dv_page_pb_color=
"@color/yellow"
app:dv_page_pb_color=
"@color/yellow"
app:dv_page_pb_height=
"2dp"
app:dv_page_pb_height=
"2dp"
app:dv_quality=
"normal"
app:dv_show_page_num=
"true"
app:dv_show_page_num=
"false"
/>
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/v_animator_top"
/>
<TextView
android:visibility=
"gone"
android:id=
"@+id/tv_pageCount"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"28dp"
android:layout_marginTop=
"28dp"
android:background=
"@drawable/bg_54585b_5"
android:includeFontPadding=
"false"
android:paddingHorizontal=
"2dp"
android:paddingVertical=
"2dp"
android:textColor=
"@color/white"
android:textSize=
"12sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/v_animator_top"
tools:text=
"1/3"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/dialog_document_more.xml
0 → 100644
View file @
7096a17f
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_f1f1f1_tlr25"
android:orientation=
"vertical"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl"
android:layout_width=
"match_parent"
android:layout_height=
"65dp"
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"15dp"
android:text=
"More"
android:textColor=
"#333333"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:id=
"@+id/iv_bookmark"
android:layout_width=
"24dp"
android:layout_height=
"32dp"
android:layout_marginEnd=
"27dp"
android:src=
"@mipmap/h_soucang_n"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/cl"
>
<LinearLayout
android:id=
"@+id/ll_jump"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:background=
"?android:selectableItemBackground"
android:orientation=
"horizontal"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"13dp"
android:src=
"@mipmap/jump"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"13dp"
android:layout_weight=
"1"
android:ellipsize=
"end"
android:includeFontPadding=
"false"
android:singleLine=
"true"
android:text=
"Jump to the specified page"
android:textColor=
"#333333"
android:textSize=
"16sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"20dp"
android:src=
"@mipmap/jianotou"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_detail"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:background=
"?android:selectableItemBackground"
android:orientation=
"horizontal"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"13dp"
android:src=
"@mipmap/particulars"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"13dp"
android:layout_weight=
"1"
android:ellipsize=
"end"
android:includeFontPadding=
"false"
android:singleLine=
"true"
android:text=
"Detail"
android:textColor=
"#333333"
android:textSize=
"16sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"20dp"
android:src=
"@mipmap/jianotou"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_share"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_marginBottom=
"20dp"
android:background=
"?android:selectableItemBackground"
android:orientation=
"horizontal"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"13dp"
android:src=
"@mipmap/share"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"13dp"
android:layout_weight=
"1"
android:ellipsize=
"end"
android:includeFontPadding=
"false"
android:singleLine=
"true"
android:text=
"Share"
android:textColor=
"#333333"
android:textSize=
"16sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"20dp"
android:src=
"@mipmap/jianotou"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
library/src/main/java/com/cherry/lib/doc/office/IOffice.java
View file @
7096a17f
...
@@ -3,8 +3,10 @@ package com.cherry.lib.doc.office;
...
@@ -3,8 +3,10 @@ package com.cherry.lib.doc.office;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.util.Log
;
import
android.view.MotionEvent
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.View
;
import
com.blankj.utilcode.util.AppUtils
;
import
com.blankj.utilcode.util.AppUtils
;
import
com.cherry.lib.doc.office.common.IOfficeToPicture
;
import
com.cherry.lib.doc.office.common.IOfficeToPicture
;
import
com.cherry.lib.doc.office.constant.EventConstant
;
import
com.cherry.lib.doc.office.constant.EventConstant
;
...
@@ -12,6 +14,7 @@ import com.cherry.lib.doc.office.constant.wp.WPViewConstant;
...
@@ -12,6 +14,7 @@ import com.cherry.lib.doc.office.constant.wp.WPViewConstant;
import
com.cherry.lib.doc.office.res.ResKit
;
import
com.cherry.lib.doc.office.res.ResKit
;
import
com.cherry.lib.doc.office.system.IMainFrame
;
import
com.cherry.lib.doc.office.system.IMainFrame
;
import
com.cherry.lib.doc.office.system.MainControl
;
import
com.cherry.lib.doc.office.system.MainControl
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -22,6 +25,7 @@ import java.util.List;
...
@@ -22,6 +25,7 @@ import java.util.List;
*/
*/
public
abstract
class
IOffice
implements
IMainFrame
{
public
abstract
class
IOffice
implements
IMainFrame
{
private
String
TAG
=
"IOffice"
;
private
MainControl
control
;
private
MainControl
control
;
private
boolean
writeLog
=
true
;
private
boolean
writeLog
=
true
;
//view background
//view background
...
@@ -148,6 +152,7 @@ public abstract class IOffice implements IMainFrame {
...
@@ -148,6 +152,7 @@ public abstract class IOffice implements IMainFrame {
* @return True if the listener has consumed the event, false otherwise.
* @return True if the listener has consumed the event, false otherwise.
*/
*/
public
boolean
doActionEvent
(
int
actionID
,
Object
obj
)
{
public
boolean
doActionEvent
(
int
actionID
,
Object
obj
)
{
Log
.
e
(
TAG
,
"doActionEvent actionID"
+
actionID
);
try
{
try
{
switch
(
actionID
)
{
switch
(
actionID
)
{
case
EventConstant
.
SYS_UPDATE_TOOLSBAR_BUTTON_STATUS
:
//update toolsbar state
case
EventConstant
.
SYS_UPDATE_TOOLSBAR_BUTTON_STATUS
:
//update toolsbar state
...
@@ -192,8 +197,7 @@ public abstract class IOffice implements IMainFrame {
...
@@ -192,8 +197,7 @@ public abstract class IOffice implements IMainFrame {
return
0
;
return
0
;
}
}
public
boolean
onEventMethod
(
View
v
,
MotionEvent
e1
,
MotionEvent
e2
,
float
xValue
,
public
boolean
onEventMethod
(
View
v
,
MotionEvent
e1
,
MotionEvent
e2
,
float
xValue
,
float
yValue
,
byte
eventMethodType
)
{
float
yValue
,
byte
eventMethodType
)
{
return
false
;
return
false
;
}
}
...
...
library/src/main/java/com/cherry/lib/doc/office/macro/TouchEventListener.java
View file @
7096a17f
...
@@ -39,7 +39,6 @@ public interface TouchEventListener
...
@@ -39,7 +39,6 @@ public interface TouchEventListener
* @param e2 MotionEvent instance
* @param e2 MotionEvent instance
* @param velocityX x axis velocity
* @param velocityX x axis velocity
* @param velocityY y axis velocity
* @param velocityY y axis velocity
* @param eventNethodType event method
* @see TouchEventListener#EVENT_CLICK
* @see TouchEventListener#EVENT_CLICK
* @see TouchEventListener#EVENT_DOUBLE_TAP
* @see TouchEventListener#EVENT_DOUBLE_TAP
* @see TouchEventListener#EVENT_DOUBLE_TAP_EVENT
* @see TouchEventListener#EVENT_DOUBLE_TAP_EVENT
...
...
library/src/main/java/com/cherry/lib/doc/office/pg/control/PGControl.java
View file @
7096a17f
This diff is collapsed.
Click to expand it.
library/src/main/java/com/cherry/lib/doc/office/pg/control/PGEventManage.java
View file @
7096a17f
...
@@ -9,8 +9,6 @@ package com.cherry.lib.doc.office.pg.control;
...
@@ -9,8 +9,6 @@ package com.cherry.lib.doc.office.pg.control;
import
com.cherry.lib.doc.office.common.ISlideShow
;
import
com.cherry.lib.doc.office.common.ISlideShow
;
import
com.cherry.lib.doc.office.system.IControl
;
import
com.cherry.lib.doc.office.system.IControl
;
import
com.cherry.lib.doc.office.system.beans.AEventManage
;
import
com.cherry.lib.doc.office.system.beans.AEventManage
;
import
com.cherry.lib.doc.office.system.beans.ATimer
;
import
android.graphics.Rect
;
import
android.graphics.Rect
;
import
android.view.MotionEvent
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.View
;
...
...
library/src/main/java/com/cherry/lib/doc/office/pg/control/PGPrintMode.java
View file @
7096a17f
This diff is collapsed.
Click to expand it.
library/src/main/java/com/cherry/lib/doc/office/system/AbstractControl.kt
View file @
7096a17f
...
@@ -38,7 +38,7 @@ import com.cherry.lib.doc.office.common.ISlideShow
...
@@ -38,7 +38,7 @@ import com.cherry.lib.doc.office.common.ISlideShow
*
*
*
*
*/
*/
abstract
class
AbstractControl
:
IControl
{
abstract
class
AbstractControl
:
IControl
{
override
fun
layoutView
(
x
:
Int
,
y
:
Int
,
w
:
Int
,
h
:
Int
)
{}
override
fun
layoutView
(
x
:
Int
,
y
:
Int
,
w
:
Int
,
h
:
Int
)
{}
override
fun
actionEvent
(
actionID
:
Int
,
obj
:
Any
?)
{}
override
fun
actionEvent
(
actionID
:
Int
,
obj
:
Any
?)
{}
override
fun
getActionValue
(
actionID
:
Int
,
obj
:
Any
?):
Any
?
{
override
fun
getActionValue
(
actionID
:
Int
,
obj
:
Any
?):
Any
?
{
...
...
library/src/main/java/com/cherry/lib/doc/office/system/IMainFrame.java
View file @
7096a17f
/*
/*
* 文件名称: IActivity.java
* 文件名称: IActivity.java
*
*
* 编译器: android2.2
* 编译器: android2.2
* 时间: 下午5:24:10
* 时间: 下午5:24:10
*/
*/
...
@@ -25,12 +25,11 @@ import android.view.View;
...
@@ -25,12 +25,11 @@ import android.view.View;
* <p>
* <p>
* 负责人: ljj8494
* 负责人: ljj8494
* <p>
* <p>
* 负责小组:
* 负责小组:
* <p>
* <p>
* <p>
* <p>
*/
*/
public
interface
IMainFrame
public
interface
IMainFrame
{
{
// onTouch
// onTouch
public
final
static
byte
ON_TOUCH
=
0
;
public
final
static
byte
ON_TOUCH
=
0
;
// onDown
// onDown
...
@@ -56,280 +55,281 @@ public interface IMainFrame
...
@@ -56,280 +55,281 @@ public interface IMainFrame
/**
/**
* get activity instance
* get activity instance
*
* @return activity instance
* @return activity instance
*/
*/
public
Activity
getActivity
();
public
Activity
getActivity
();
/**
/**
* do action
* do action
*
*
* @param actionID action ID
* @param actionID action ID
*
* @param obj acValue
* @param obj acValue
* @return True if the listener has consumed the event, false otherwise.
*
* @return True if the listener has consumed the event, false otherwise.
*/
*/
public
boolean
doActionEvent
(
int
actionID
,
Object
obj
);
public
boolean
doActionEvent
(
int
actionID
,
Object
obj
);
/**
/**
* reader file finish call this method
* reader file finish call this method
*/
*/
public
void
openFileFinish
();
public
void
openFileFinish
();
public
void
openFileFailed
();
public
void
openFileFailed
();
/**
/**
* update tool bar status
* update tool bar status
*/
*/
public
void
updateToolsbarStatus
();
public
void
updateToolsbarStatus
();
/**
/**
* set the find back button and find forward button state
* set the find back button and find forward button state
*
*
* @param state
* @param state
*/
*/
public
void
setFindBackForwardState
(
boolean
state
);
public
void
setFindBackForwardState
(
boolean
state
);
/**
/**
* get bottom bar height
* get bottom bar height
*
* @return bottom bar height
* @return bottom bar height
*/
*/
public
int
getBottomBarHeight
();
public
int
getBottomBarHeight
();
/**
/**
* get top bar height
* get top bar height
*
* @return top bar height
* @return top bar height
*/
*/
public
int
getTopBarHeight
();
public
int
getTopBarHeight
();
/**
/**
* get application name;
* get application name;
*
* @return application name
* @return application name
*/
*/
public
String
getAppName
();
public
String
getAppName
();
/**
/**
*
* @return
* @return
*/
*/
public
File
getTemporaryDirectory
();
public
File
getTemporaryDirectory
();
/**
/**
* event method, office engine dispatch
* event method, office engine dispatch
*
*
* @param v event source
* @param v event source
* @param e1 MotionEvent instance
* @param e1 MotionEvent instance
* @param e2 MotionEvent instance
* @param e2 MotionEvent instance
* @param xValue eventNethodType is ON_SCROLL, this is value distanceX
* @param xValue eventNethodType is ON_SCROLL, this is value distanceX
* eventNethodType is ON_FLING, this is value velocityY
* eventNethodType is ON_FLING, this is value velocityY
* eventNethodType is other type, this is value -1
* eventNethodType is other type, this is value -1
*
* @param yValue eventNethodType is ON_SCROLL, this is value distanceY
* @param yValue eventNethodType is ON_SCROLL, this is value distanceY
* eventNethodType is ON_FLING, this is value velocityY
* eventNethodType is ON_FLING, this is value velocityY
* eventNethodType is other type, this is value -1
* eventNethodType is other type, this is value -1
* @see IMainFrame#ON_CLICK
* @param eventNethodType event method
* @see IMainFrame#ON_DOUBLE_TAP
* @see IMainFrame#ON_CLICK
* @see IMainFrame#ON_DOUBLE_TAP_EVENT
* @see IMainFrame#ON_DOUBLE_TAP
* @see IMainFrame#ON_DOWN
* @see IMainFrame#ON_DOUBLE_TAP_EVENT
* @see IMainFrame#ON_FLING
* @see IMainFrame#ON_DOWN
* @see IMainFrame#ON_LONG_PRESS
* @see IMainFrame#ON_FLING
* @see IMainFrame#ON_SCROLL
* @see IMainFrame#ON_LONG_PRESS
* @see IMainFrame#ON_SHOW_PRESS
* @see IMainFrame#ON_SCROLL
* @see IMainFrame#ON_SINGLE_TAP_CONFIRMED
* @see IMainFrame#ON_SHOW_PRESS
* @see IMainFrame#ON_SINGLE_TAP_UP
* @see IMainFrame#ON_SINGLE_TAP_CONFIRMED
* @see IMainFrame#ON_TOUCH
* @see IMainFrame#ON_SINGLE_TAP_UP
* @see IMainFrame#ON_TOUCH
*/
*/
public
boolean
onEventMethod
(
View
v
,
MotionEvent
e1
,
MotionEvent
e2
,
float
xValue
,
float
yValue
,
byte
eventMethodType
);
public
boolean
onEventMethod
(
View
v
,
MotionEvent
e1
,
MotionEvent
e2
,
float
xValue
,
float
yValue
,
byte
eventMethodType
);
//单次点击
public
void
singleTap
();
//获取页码
public
void
getPageNumber
(
int
current
,
int
total
);
/**
/**
* is support draw page number
* is support draw page number
* @return true draw page number
*
* false don’t draw page number
* @return true draw page number
* false don’t draw page number
*/
*/
public
boolean
isDrawPageNumber
();
public
boolean
isDrawPageNumber
();
/**
/**
* true: show message when zooming
* true: show message when zooming
* false: not show message when zooming
* false: not show message when zooming
*
* @return
* @return
*/
*/
public
boolean
isShowZoomingMsg
();
public
boolean
isShowZoomingMsg
();
/**
/**
* true: pop up dialog when throw err
* true: pop up dialog when throw err
* false: not pop up dialog when throw err
* false: not pop up dialog when throw err
*
* @return
* @return
*/
*/
public
boolean
isPopUpErrorDlg
();
public
boolean
isPopUpErrorDlg
();
/**
/**
* show password dialog when parse file with password
* show password dialog when parse file with password
*
* @return
* @return
*/
*/
public
boolean
isShowPasswordDlg
();
public
boolean
isShowPasswordDlg
();
/**
/**
* show progress bar or not when parsing document
* show progress bar or not when parsing document
*
* @return
* @return
*/
*/
public
boolean
isShowProgressBar
();
public
boolean
isShowProgressBar
();
/**
/**
*
*
*/
*/
public
boolean
isShowFindDlg
();
public
boolean
isShowFindDlg
();
/**
/**
* show txt encode dialog when parse txt file
* show txt encode dialog when parse txt file
*
* @return
* @return
*/
*/
public
boolean
isShowTXTEncodeDlg
();
public
boolean
isShowTXTEncodeDlg
();
/**
/**
* get txt default encode when not showing txt encode dialog
* get txt default encode when not showing txt encode dialog
*
* @return null if showing txt encode dialog
* @return null if showing txt encode dialog
*/
*/
public
String
getTXTDefaultEncode
();
public
String
getTXTDefaultEncode
();
/**
/**
* is support zoom in / zoom out
* is support zoom in / zoom out
*
*
* @return
true touch zoom
* @return true touch zoom
*
false don’t touch zoom
* false don’t touch zoom
*/
*/
public
boolean
isTouchZoom
();
public
boolean
isTouchZoom
();
/**
/**
* normal view, changed after zoom bend, you need to re-layout
* normal view, changed after zoom bend, you need to re-layout
*
*
*
@return
true re-layout
*
@return
true re-layout
*
false don't re-layout
*
false don't re-layout
*/
*/
public
boolean
isZoomAfterLayoutForWord
();
public
boolean
isZoomAfterLayoutForWord
();
/**
/**
* Word application default view (Normal or Page)
* Word application default view (Normal or Page)
*
*
* @return 0, page view
* @return 0, page view
* 1,normal view;
* 1,normal view;
*
*/
*/
public
byte
getWordDefaultView
();
public
byte
getWordDefaultView
();
/**
/**
* get Internationalization resource
* get Internationalization resource
*
*
* @param resName Internationalization resource name
* @param resName Internationalization resource name
*/
*/
public
String
getLocalString
(
String
resName
);
public
String
getLocalString
(
String
resName
);
/**
/**
* callback this method after zoom change
* callback this method after zoom change
*/
*/
public
void
changeZoom
();
public
void
changeZoom
();
/**
/**
*
*
*/
*/
public
void
changePage
();
public
void
changePage
();
/**
/**
*
*
*/
*/
public
void
completeLayout
();
public
void
completeLayout
();
/**
/**
* when engine error occurred callback this method
* when engine error occurred callback this method
*/
*/
public
void
error
(
int
errorCode
);
public
void
error
(
int
errorCode
);
/**
/**
* full screen, not show top tool bar
* full screen, not show top tool bar
*/
*/
public
void
fullScreen
(
boolean
fullscreen
);
public
void
fullScreen
(
boolean
fullscreen
);
/**
/**
*
* @param visible
* @param visible
*/
*/
public
void
showProgressBar
(
boolean
visible
);
public
void
showProgressBar
(
boolean
visible
);
/**
/**
*
* @param viewList
* @param viewList
*/
*/
public
void
updateViewImages
(
List
<
Integer
>
viewList
);
public
void
updateViewImages
(
List
<
Integer
>
viewList
);
/**
/**
* set change page flag, Only when effectively the PageSize greater than ViewSize.
* set change page flag, Only when effectively the PageSize greater than ViewSize.
* (for PPT, word print mode, PDF)
* (for PPT, word print mode, PDF)
*
* @param b = true, change page
* = false, don't change page
*/
*/
public
boolean
isChangePage
();
public
boolean
isChangePage
();
/**
/**
* when need destroy office engine instance callback this method
* when need destroy office engine instance callback this method
*/
*/
//public void destroyEngine();
//public void destroyEngine();
/**
/**
*
* @param saveLog
* @param saveLog
*/
*/
public
void
setWriteLog
(
boolean
saveLog
);
public
void
setWriteLog
(
boolean
saveLog
);
/**
/**
*
* @return
* @return
*/
*/
public
boolean
isWriteLog
();
public
boolean
isWriteLog
();
/**
/**
*
* @param isThumbnail
* @param isThumbnail
*/
*/
public
void
setThumbnail
(
boolean
isThumbnail
);
public
void
setThumbnail
(
boolean
isThumbnail
);
/**
/**
*
* @return
* @return
*/
*/
public
boolean
isThumbnail
();
public
boolean
isThumbnail
();
/**
/**
* get view backgrouond
* get view backgrouond
*
* @return
* @return
*/
*/
public
Object
getViewBackground
();
public
Object
getViewBackground
();
/**
/**
* set flag whether fitzoom can be larger than 100% but smaller than the max zoom
* set flag whether fitzoom can be larger than 100% but smaller than the max zoom
*
* @param ignoreOriginalSize
* @param ignoreOriginalSize
*/
*/
public
void
setIgnoreOriginalSize
(
boolean
ignoreOriginalSize
);
public
void
setIgnoreOriginalSize
(
boolean
ignoreOriginalSize
);
/**
/**
*
* @return true fitzoom may be larger than 100% but smaller than the max zoom
* @return
* true fitzoom may be larger than 100% but smaller than the max zoom
* false fitzoom can not larger than 100%
* false fitzoom can not larger than 100%
*/
*/
public
boolean
isIgnoreOriginalSize
();
public
boolean
isIgnoreOriginalSize
();
/**
/**
* page list view moving position
* page list view moving position
* @param position horizontal or vertical
*/
*/
public
int
getPageListViewMovingPosition
();
public
int
getPageListViewMovingPosition
();
/**
/**
*
*
*/
*/
public
void
dispose
();
public
void
dispose
();
}
}
library/src/main/java/com/cherry/lib/doc/office/system/MainControl.java
View file @
7096a17f
...
@@ -140,7 +140,7 @@ public class MainControl extends AbstractControl {
...
@@ -140,7 +140,7 @@ public class MainControl extends AbstractControl {
*/
*/
public
void
dismissProgressDialog
()
{
public
void
dismissProgressDialog
()
{
if
(
progressDialog
!=
null
)
{
if
(
progressDialog
!=
null
)
{
if
(
progressDialog
.
getWindow
()
!=
null
)
{
if
(
progressDialog
.
getWindow
()
!=
null
)
{
progressDialog
.
dismiss
();
progressDialog
.
dismiss
();
}
}
progressDialog
=
null
;
progressDialog
=
null
;
...
@@ -316,6 +316,7 @@ public class MainControl extends AbstractControl {
...
@@ -316,6 +316,7 @@ public class MainControl extends AbstractControl {
* @param obj 动作ID的Value
* @param obj 动作ID的Value
*/
*/
public
void
actionEvent
(
int
actionID
,
final
Object
obj
)
{
public
void
actionEvent
(
int
actionID
,
final
Object
obj
)
{
Log
.
e
(
"MainControl"
,
"actionEvent "
+
actionID
);
if
(
actionID
==
EventConstant
.
SYS_READER_FINSH_ID
)
{
if
(
actionID
==
EventConstant
.
SYS_READER_FINSH_ID
)
{
if
(
reader
!=
null
)
{
if
(
reader
!=
null
)
{
if
(
appControl
!=
null
)
{
if
(
appControl
!=
null
)
{
...
...
library/src/main/java/com/cherry/lib/doc/office/system/beans/AEventManage.java
View file @
7096a17f
This diff is collapsed.
Click to expand it.
library/src/main/java/com/cherry/lib/doc/office/wp/control/PrintWord.java
View file @
7096a17f
This diff is collapsed.
Click to expand it.
library/src/main/java/com/cherry/lib/doc/office/wp/control/Word.java
View file @
7096a17f
...
@@ -17,6 +17,7 @@ import android.graphics.Rect;
...
@@ -17,6 +17,7 @@ import android.graphics.Rect;
import
android.graphics.Typeface
;
import
android.graphics.Typeface
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
...
@@ -569,6 +570,7 @@ public class Word extends LinearLayout implements IWord {
...
@@ -569,6 +570,7 @@ public class Word extends LinearLayout implements IWord {
* @param zoom
* @param zoom
*/
*/
private
void
drawPageNubmer
(
Canvas
canvas
,
float
zoom
)
{
private
void
drawPageNubmer
(
Canvas
canvas
,
float
zoom
)
{
Log
.
e
(
"Word"
,
"drawPageNubmer"
);
int
currentNumber
=
getCurrentPageNumber
();
int
currentNumber
=
getCurrentPageNumber
();
if
(
control
.
getMainFrame
().
isDrawPageNumber
()
&&
pageRoot
!=
null
)
{
if
(
control
.
getMainFrame
().
isDrawPageNumber
()
&&
pageRoot
!=
null
)
{
Rect
rect
=
canvas
.
getClipBounds
();
Rect
rect
=
canvas
.
getClipBounds
();
...
...
library/src/main/java/com/cherry/lib/doc/widget/DocView.kt
View file @
7096a17f
...
@@ -9,6 +9,7 @@ import android.graphics.Rect
...
@@ -9,6 +9,7 @@ import android.graphics.Rect
import
android.graphics.drawable.Drawable
import
android.graphics.drawable.Drawable
import
android.util.AttributeSet
import
android.util.AttributeSet
import
android.util.Log
import
android.util.Log
import
android.view.MotionEvent
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.widget.FrameLayout
import
android.widget.FrameLayout
...
@@ -52,27 +53,19 @@ class DocView : FrameLayout {
...
@@ -52,27 +53,19 @@ class DocView : FrameLayout {
private
val
TAG
=
"DocView"
private
val
TAG
=
"DocView"
var
mActivity
:
Activity
?
=
null
var
mActivity
:
Activity
?
=
null
var
lifecycleScope
:
LifecycleCoroutineScope
=
(
context
as
AppCompatActivity
).
lifecycleScope
private
var
mPoiViewer
:
PoiViewer
?
=
null
private
var
mPoiViewer
:
PoiViewer
?
=
null
private
var
mMovingOrientation
=
DocMovingOrientation
.
HORIZONTAL
private
var
mMovingOrientation
=
DocMovingOrientation
.
HORIZONTAL
private
var
engine
=
DocEngine
.
INTERNAL
private
var
engine
=
DocEngine
.
INTERNAL
private
var
showDivider
=
true
private
var
showDivider
=
true
private
var
showPageNum
=
true
private
var
showPageNum
=
true
private
var
divider
:
Drawable
?
=
null
private
var
divider
:
Drawable
?
=
null
private
var
runnable
=
Runnable
{}
var
enableLoadingForPages
:
Boolean
=
true
var
enableLoadingForPages
:
Boolean
=
true
var
pbDefaultHeight
=
2
var
pbDefaultHeight
=
2
var
pbHeight
:
Int
=
pbDefaultHeight
var
pbHeight
:
Int
=
pbDefaultHeight
var
pbDefaultColor
=
Color
.
RED
var
pbDefaultColor
=
Color
.
RED
var
pbColor
:
Int
=
pbDefaultColor
var
pbColor
:
Int
=
pbDefaultColor
private
var
pdfRendererCoreInitialised
=
false
var
pageMargin
:
Rect
=
Rect
(
0
,
0
,
0
,
0
)
var
pageMargin
:
Rect
=
Rect
(
0
,
0
,
0
,
0
)
var
totalPageCount
=
0
var
mOnDocPageChangeListener
:
OnDocPageChangeListener
?
=
null
var
mOnDocPageChangeListener
:
OnDocPageChangeListener
?
=
null
var
sourceFilePath
:
String
?
=
null
var
sourceFilePath
:
String
?
=
null
var
mViewPdfInPage
:
Boolean
=
true
var
mViewPdfInPage
:
Boolean
=
true
...
@@ -87,9 +80,6 @@ class DocView : FrameLayout {
...
@@ -87,9 +80,6 @@ class DocView : FrameLayout {
fun
initView
(
attrs
:
AttributeSet
?,
defStyle
:
Int
)
{
fun
initView
(
attrs
:
AttributeSet
?,
defStyle
:
Int
)
{
inflate
(
context
,
R
.
layout
.
doc_view
,
this
)
inflate
(
context
,
R
.
layout
.
doc_view
,
this
)
binding
=
DocViewBinding
.
bind
(
this
)
binding
=
DocViewBinding
.
bind
(
this
)
binding
.
mIvPdf
.
setOnClickListener
{
binding
.
mLlBigPdfImage
.
hide
()
}
val
typedArray
=
val
typedArray
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
DocView
,
defStyle
,
0
)
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
DocView
,
defStyle
,
0
)
...
@@ -114,7 +104,6 @@ class DocView : FrameLayout {
...
@@ -114,7 +104,6 @@ class DocView : FrameLayout {
bottom
=
typedArray
.
getDimensionPixelSize
(
R
.
styleable
.
DocView_dv_page_marginBottom
,
bottom
)
bottom
=
typedArray
.
getDimensionPixelSize
(
R
.
styleable
.
DocView_dv_page_marginBottom
,
bottom
)
}
}
binding
.
mPdfPageNo
.
isVisible
=
showPageNum
val
layoutParams
=
binding
.
mPlLoadProgress
.
layoutParams
val
layoutParams
=
binding
.
mPlLoadProgress
.
layoutParams
layoutParams
.
height
=
pbHeight
layoutParams
.
height
=
pbHeight
...
@@ -125,7 +114,6 @@ class DocView : FrameLayout {
...
@@ -125,7 +114,6 @@ class DocView : FrameLayout {
typedArray
.
recycle
()
typedArray
.
recycle
()
}
}
fun
openDoc
(
fun
openDoc
(
activity
:
Activity
,
docUrl
:
String
?,
docSourceType
:
Int
,
activity
:
Activity
,
docUrl
:
String
?,
docSourceType
:
Int
,
engine
:
DocEngine
=
this
.
engine
engine
:
DocEngine
=
this
.
engine
...
@@ -136,8 +124,10 @@ class DocView : FrameLayout {
...
@@ -136,8 +124,10 @@ class DocView : FrameLayout {
@SuppressLint
(
"ObsoleteSdkInt"
)
@SuppressLint
(
"ObsoleteSdkInt"
)
fun
openDoc
(
fun
openDoc
(
activity
:
Activity
?,
docUrl
:
String
?,
activity
:
Activity
?,
docSourceType
:
Int
,
fileType
:
Int
,
docUrl
:
String
?,
docSourceType
:
Int
,
fileType
:
Int
,
viewPdfInPage
:
Boolean
=
false
,
viewPdfInPage
:
Boolean
=
false
,
engine
:
DocEngine
=
this
.
engine
engine
:
DocEngine
=
this
.
engine
)
{
)
{
...
@@ -180,7 +170,6 @@ class DocView : FrameLayout {
...
@@ -180,7 +170,6 @@ class DocView : FrameLayout {
when
(
type
)
{
when
(
type
)
{
FileType
.
PDF
->
{
FileType
.
PDF
->
{
Log
.
e
(
TAG
,
"openDoc()......PDF"
)
Log
.
e
(
TAG
,
"openDoc()......PDF"
)
// binding.mDocWeb.hide()
binding
.
mFlDocContainer
.
hide
()
binding
.
mFlDocContainer
.
hide
()
binding
.
mIvImage
.
hide
()
binding
.
mIvImage
.
hide
()
...
@@ -191,7 +180,6 @@ class DocView : FrameLayout {
...
@@ -191,7 +180,6 @@ class DocView : FrameLayout {
showPageNum
=
false
showPageNum
=
false
}
}
Log
.
e
(
TAG
,
"openDoc()......"
)
Log
.
e
(
TAG
,
"openDoc()......"
)
// binding.mDocWeb.hide()
binding
.
mFlDocContainer
.
hide
()
binding
.
mFlDocContainer
.
hide
()
binding
.
mIvImage
.
show
()
binding
.
mIvImage
.
show
()
if
(
docSourceType
==
DocSourceType
.
PATH
)
{
if
(
docSourceType
==
DocSourceType
.
PATH
)
{
...
@@ -218,9 +206,33 @@ class DocView : FrameLayout {
...
@@ -218,9 +206,33 @@ class DocView : FrameLayout {
}
}
}
}
var
singleTapAction
:
(()
->
Unit
)?
=
null
var
getPageNumberAction
:
((
current
:
Int
,
total
:
Int
)
->
Unit
)?
=
null
fun
showDoc
(
activity
:
Activity
,
mDocContainer
:
ViewGroup
?,
url
:
String
?,
docSourceType
:
Int
,
fileType
:
Int
)
{
fun
showDoc
(
activity
:
Activity
,
mDocContainer
:
ViewGroup
?,
url
:
String
?,
docSourceType
:
Int
,
fileType
:
Int
)
{
Log
.
e
(
TAG
,
"showDoc()......"
)
Log
.
e
(
TAG
,
"showDoc()......"
)
val
iOffice
:
IOffice
=
object
:
IOffice
()
{
val
iOffice
:
IOffice
=
object
:
IOffice
()
{
override
fun
onEventMethod
(
v
:
View
?,
e1
:
MotionEvent
?,
e2
:
MotionEvent
?,
xValue
:
Float
,
yValue
:
Float
,
eventMethodType
:
Byte
):
Boolean
{
Log
.
e
(
TAG
,
"onEventMethod ${e1?.action} ${MotionEvent.ACTION_DOWN}"
)
return
super
.
onEventMethod
(
v
,
e1
,
e2
,
xValue
,
yValue
,
eventMethodType
)
}
override
fun
singleTap
()
{
Log
.
e
(
TAG
,
"singleTap"
)
singleTapAction
?.
invoke
()
}
override
fun
getPageNumber
(
current
:
Int
,
total
:
Int
)
{
getPageNumberAction
?.
invoke
(
current
,
total
)
}
override
fun
getActivity
():
Activity
{
override
fun
getActivity
():
Activity
{
return
activity
return
activity
}
}
...
@@ -269,52 +281,10 @@ class DocView : FrameLayout {
...
@@ -269,52 +281,10 @@ class DocView : FrameLayout {
}
}
}
}
//是否绘制页码
iOffice
.
isDrawPageNumber
iOffice
.
openFile
(
url
,
docSourceType
,
fileType
.
toString
())
iOffice
.
openFile
(
url
,
docSourceType
,
fileType
.
toString
())
}
}
private
val
scrollListener
=
object
:
RecyclerView
.
OnScrollListener
()
{
override
fun
onScrolled
(
recyclerView
:
RecyclerView
,
dx
:
Int
,
dy
:
Int
)
{
super
.
onScrolled
(
recyclerView
,
dx
,
dy
)
(
recyclerView
.
layoutManager
as
LinearLayoutManager
).
run
{
var
foundPosition
:
Int
=
findLastCompletelyVisibleItemPosition
()
if
(
foundPosition
!=
RecyclerView
.
NO_POSITION
)
binding
.
mPdfPageNo
.
text
=
context
.
getString
(
R
.
string
.
pdfView_page_no
,
foundPosition
+
1
,
totalPageCount
)
if
(
showPageNum
)
{
binding
.
mPdfPageNo
.
visibility
=
View
.
VISIBLE
}
if
(
foundPosition
==
0
&&
!
mViewPdfInPage
)
binding
.
mPdfPageNo
.
postDelayed
({
binding
.
mPdfPageNo
.
visibility
=
GONE
},
3000
)
if
(
foundPosition
!=
RecyclerView
.
NO_POSITION
)
{
mOnDocPageChangeListener
?.
OnPageChanged
(
foundPosition
,
totalPageCount
)
return
@run
}
foundPosition
=
findFirstVisibleItemPosition
()
if
(
foundPosition
!=
RecyclerView
.
NO_POSITION
)
{
mOnDocPageChangeListener
?.
OnPageChanged
(
foundPosition
,
totalPageCount
)
return
@run
}
}
}
override
fun
onScrollStateChanged
(
recyclerView
:
RecyclerView
,
newState
:
Int
)
{
super
.
onScrollStateChanged
(
recyclerView
,
newState
)
if
(
newState
==
RecyclerView
.
SCROLL_STATE_IDLE
&&
!
mViewPdfInPage
)
{
binding
.
mPdfPageNo
.
postDelayed
(
runnable
,
3000
)
}
else
{
binding
.
mPdfPageNo
.
removeCallbacks
(
runnable
)
}
}
}
override
fun
onDetachedFromWindow
()
{
override
fun
onDetachedFromWindow
()
{
super
.
onDetachedFromWindow
()
super
.
onDetachedFromWindow
()
onDestroy
()
onDestroy
()
...
...
library/src/main/res/layout/doc_view.xml
View file @
7096a17f
...
@@ -4,38 +4,6 @@
...
@@ -4,38 +4,6 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
>
<FrameLayout
android:id=
"@+id/mLlBigPdfImage"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/white"
android:visibility=
"gone"
>
<com.cherry.lib.doc.widget.PinchImageView
android:id=
"@+id/mIvPdf"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<ProgressBar
android:id=
"@+id/mPbBigLoading"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_gravity=
"center"
android:visibility=
"gone"
tools:visibility=
"visible"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"end"
android:layout_marginTop=
"50dp"
android:layout_marginEnd=
"30dp"
android:scaleType=
"fitCenter"
android:src=
"@mipmap/ic_big_close"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<FrameLayout
<FrameLayout
android:id=
"@+id/mFlDocContainer"
android:id=
"@+id/mFlDocContainer"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -55,17 +23,5 @@
...
@@ -55,17 +23,5 @@
android:progressDrawable=
"@drawable/pb_webview_layer"
android:progressDrawable=
"@drawable/pb_webview_layer"
android:visibility=
"visible"
/>
android:visibility=
"visible"
/>
<TextView
android:id=
"@+id/mPdfPageNo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"18dp"
android:background=
"@drawable/page_counter"
android:paddingStart=
"12dp"
android:paddingTop=
"4dp"
android:paddingEnd=
"12dp"
android:paddingBottom=
"4dp"
android:textColor=
"#A19D9D"
android:textSize=
"16sp"
/>
</FrameLayout>
</FrameLayout>
\ No newline at end of file
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