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
2327df15
Commit
2327df15
authored
Sep 29, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
9e47eb95
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
356 additions
and
442 deletions
+356
-442
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-0
ExcelActivity.kt
.../pdfviewerscannerwhite/ui/document/excel/ExcelActivity.kt
+1
-2
PptActivity.kt
...base/pdfviewerscannerwhite/ui/document/ppt/PptActivity.kt
+1
-2
WordActivity.kt
...se/pdfviewerscannerwhite/ui/document/word/WordActivity.kt
+23
-20
MainActivity.kt
...va/com/base/pdfviewerscannerwhite/ui/main/MainActivity.kt
+10
-0
DocViewerActivity.kt
...ary/src/main/java/com/cherry/lib/doc/DocViewerActivity.kt
+1
-4
IOffice.java
library/src/main/java/com/cherry/lib/doc/office/IOffice.java
+5
-3
APageListView.java
...y/lib/doc/office/system/beans/pagelist/APageListView.java
+2
-1
PrintWord.java
.../java/com/cherry/lib/doc/office/wp/control/PrintWord.java
+2
-0
WPControl.java
.../java/com/cherry/lib/doc/office/wp/control/WPControl.java
+194
-279
Word.java
.../main/java/com/cherry/lib/doc/office/wp/control/Word.java
+17
-3
LayoutKit.java
...ain/java/com/cherry/lib/doc/office/wp/view/LayoutKit.java
+11
-2
PageRoot.java
...main/java/com/cherry/lib/doc/office/wp/view/PageRoot.java
+86
-122
WPLayouter.java
...in/java/com/cherry/lib/doc/office/wp/view/WPLayouter.java
+1
-1
DocView.kt
library/src/main/java/com/cherry/lib/doc/widget/DocView.kt
+1
-3
No files found.
app/src/main/AndroidManifest.xml
View file @
2327df15
...
...
@@ -61,6 +61,7 @@
<activity
android:name=
".ui.document.word.WordActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
android:theme=
"@style/Theme.PDFViewerScannerWhite"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/excel/ExcelActivity.kt
View file @
2327df15
...
...
@@ -261,11 +261,10 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
fileType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_TYPE_KEY
,
-
1
)
?:
-
1
engine
=
intent
?.
getIntExtra
(
Constant
.
INTENT_ENGINE_KEY
,
DocEngine
.
INTERNAL
.
value
)
?:
DocEngine
.
INTERNAL
.
value
binding
.
mDocView
.
openDoc
(
this
,
pathOrUri
,
docSourceType
,
fileType
,
false
,
DocEngine
.
values
().
first
{
it
.
value
==
engine
}
)
binding
.
mDocView
.
openDoc
(
this
,
pathOrUri
,
docSourceType
,
fileType
,
false
)
LogEx
.
logDebug
(
TAG
,
"initData-pathOrUri = $pathOrUri"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
LogEx
.
logDebug
(
TAG
,
"initData-engine = $engine"
)
}
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/ppt/PptActivity.kt
View file @
2327df15
...
...
@@ -107,11 +107,10 @@ class PptActivity : BaseActivity<ActivityPptBinding>() {
fileType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_TYPE_KEY
,
-
1
)
?:
-
1
engine
=
intent
?.
getIntExtra
(
Constant
.
INTENT_ENGINE_KEY
,
DocEngine
.
INTERNAL
.
value
)
?:
DocEngine
.
INTERNAL
.
value
binding
.
mDocView
.
openDoc
(
this
,
pathOrUri
,
docSourceType
,
fileType
,
false
,
DocEngine
.
values
().
first
{
it
.
value
==
engine
}
)
binding
.
mDocView
.
openDoc
(
this
,
pathOrUri
,
docSourceType
,
fileType
,
false
)
LogEx
.
logDebug
(
TAG
,
"initData-docUrl = $pathOrUri"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
LogEx
.
logDebug
(
TAG
,
"initData-engine = $engine"
)
}
private
fun
showTopLayout
()
{
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/word/WordActivity.kt
View file @
2327df15
...
...
@@ -69,13 +69,11 @@ class WordActivity : BaseActivity<ActivityWordBinding>() {
LogEx
.
logDebug
(
TAG
,
"show"
)
}
}
}
private
fun
setVerticalSeekbar
(
current
:
Int
,
max
:
Int
)
{
binding
.
verticalSeekbar
.
showThumb
=
true
binding
.
verticalSeekbar
.
thumbContainerColor
=
Color
.
TRANSPARENT
binding
.
verticalSeekbar
.
thumbContainerColor
=
Color
.
TRANSPARENT
binding
.
verticalSeekbar
.
thumbPlaceholderDrawable
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
fanye
)
if
(
binding
.
verticalSeekbar
.
maxValue
!=
max
-
1
)
{
...
...
@@ -93,6 +91,7 @@ class WordActivity : BaseActivity<ActivityWordBinding>() {
cancelSearchUI
()
return
@addCallback
}
LogEx
.
logDebug
(
TAG
,
"finishToMain"
)
finishToMain
()
}
binding
.
flFanhui
.
setOnClickListener
{
...
...
@@ -103,11 +102,11 @@ class WordActivity : BaseActivity<ActivityWordBinding>() {
}
binding
.
ivMore
.
setOnClickListener
{
showDocumentMore
(
wordDocumentBean
,
totalPageNumber
-
1
)
{
pageIndex
->
val
wpControl
:
WPControl
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
)
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?
)
if
(
pageIndex
>
currentPageNumber
)
{
wpControl
.
wpView
.
showPage
(
pageIndex
,
APP_PAGE_DOWN_ID
)
wpControl
?.
wpView
?
.
showPage
(
pageIndex
,
APP_PAGE_DOWN_ID
)
}
else
{
wpControl
.
wpView
.
showPage
(
pageIndex
,
APP_PAGE_UP_ID
)
wpControl
?.
wpView
?
.
showPage
(
pageIndex
,
APP_PAGE_UP_ID
)
}
// wpControl.actionEvent(APP_PAGE_UP_ID, null)
}
...
...
@@ -120,8 +119,8 @@ class WordActivity : BaseActivity<ActivityWordBinding>() {
binding
.
tvPageCount
.
visibility
=
View
.
VISIBLE
haveSearchResult
=
false
hideBottomLayout
()
val
wpControl
:
WPControl
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
)
(
wpControl
.
find
as
WPFind
)
.
resetSearchResult
()
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?
)
(
wpControl
?.
find
as
WPFind
?)
?
.
resetSearchResult
()
}
binding
.
editSearch
.
setOnEditorActionListener
{
v
,
actionId
,
event
->
...
...
@@ -133,23 +132,23 @@ class WordActivity : BaseActivity<ActivityWordBinding>() {
false
}
binding
.
flPre
.
setOnClickListener
{
val
wpControl
:
WPControl
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
)
(
wpControl
.
find
as
WPFind
)
.
findBackward
()
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?
)
(
wpControl
?.
find
as
WPFind
?)
?
.
findBackward
()
}
binding
.
flNext
.
setOnClickListener
{
val
wpControl
:
WPControl
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
)
(
wpControl
.
find
as
WPFind
).
findForward
()
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?
)
(
wpControl
?
.
find
as
WPFind
).
findForward
()
}
binding
.
verticalSeekbar
.
setOnReleaseListener
{
progress
->
val
wpControl
:
WPControl
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
)
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?
)
LogEx
.
logDebug
(
TAG
,
"progress=$progress"
)
val
pageIndex
=
totalPageNumber
-
1
-
progress
if
(
progress
>
currentPageNumber
)
{
wpControl
.
wpView
.
showPage
(
pageIndex
,
APP_PAGE_DOWN_ID
)
wpControl
?.
wpView
?
.
showPage
(
pageIndex
,
APP_PAGE_DOWN_ID
)
}
else
{
wpControl
.
wpView
.
showPage
(
pageIndex
,
APP_PAGE_UP_ID
)
wpControl
?.
wpView
?
.
showPage
(
pageIndex
,
APP_PAGE_UP_ID
)
}
}
}
...
...
@@ -160,10 +159,10 @@ class WordActivity : BaseActivity<ActivityWordBinding>() {
if
(
text
.
isNullOrEmpty
())
{
return
}
val
wpControl
:
WPControl
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
)
val
flag
=
(
wpControl
.
find
as
WPFind
)
.
find
(
text
.
toString
())
haveSearchResult
=
flag
if
(
flag
)
{
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?
)
val
flag
=
(
wpControl
?.
find
as
WPFind
?)
?
.
find
(
text
.
toString
())
haveSearchResult
=
flag
?:
false
if
(
flag
==
true
)
{
hideKeyboard
(
binding
.
editSearch
)
showBottomLayout
()
}
else
{
...
...
@@ -291,7 +290,7 @@ class WordActivity : BaseActivity<ActivityWordBinding>() {
fileType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_TYPE_KEY
,
-
1
)
?:
-
1
engine
=
intent
?.
getIntExtra
(
Constant
.
INTENT_ENGINE_KEY
,
DocEngine
.
INTERNAL
.
value
)
?:
DocEngine
.
INTERNAL
.
value
binding
.
mDocView
.
openDoc
(
this
,
pathOrUri
,
docSourceType
,
fileType
,
false
,
DocEngine
.
values
().
first
{
it
.
value
==
engine
}
)
binding
.
mDocView
.
openDoc
(
this
,
pathOrUri
,
docSourceType
,
fileType
,
false
)
LogEx
.
logDebug
(
TAG
,
"initData-docUrl = $pathOrUri"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
...
...
@@ -317,4 +316,8 @@ class WordActivity : BaseActivity<ActivityWordBinding>() {
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/MainActivity.kt
View file @
2327df15
...
...
@@ -3,6 +3,7 @@ package com.base.pdfviewerscannerwhite.ui.main
import
android.app.Activity
import
android.content.Intent
import
android.net.Uri
import
android.os.Bundle
import
android.view.View
import
androidx.activity.OnBackPressedCallback
import
androidx.fragment.app.Fragment
...
...
@@ -23,10 +24,12 @@ import com.base.pdfviewerscannerwhite.ui.view.DialogView.showDeleteDialog
import
com.base.pdfviewerscannerwhite.ui.view.DialogView.showStoragePermission
import
com.base.pdfviewerscannerwhite.ui.view.PdfDialog.showPdfPwdDialog
import
com.base.pdfviewerscannerwhite.utils.IntentShareUtils.shareMutDocuments
import
com.base.pdfviewerscannerwhite.utils.LogEx
import
com.base.pdfviewerscannerwhite.utils.PermissionUtils.checkStorePermission
class
MainActivity
:
BaseActivity
<
ActivityMain2Binding
>(),
MainView
{
private
val
TAG
=
"MainActivity"
lateinit
var
mainPresenter
:
MainPresenter
override
val
binding
:
ActivityMain2Binding
by
lazy
{
ActivityMain2Binding
.
inflate
(
layoutInflater
)
...
...
@@ -46,6 +49,7 @@ class MainActivity : BaseActivity<ActivityMain2Binding>(), MainView {
private
var
currentFragment
:
Fragment
=
documentFragment
override
fun
initView
()
{
LogEx
.
logDebug
(
TAG
,
"initView"
)
mainPresenter
=
MainPresenter
(
this
,
this
,
lifecycleScope
)
}
...
...
@@ -61,6 +65,11 @@ class MainActivity : BaseActivity<ActivityMain2Binding>(), MainView {
}
}
override
fun
onSaveInstanceState
(
outState
:
Bundle
)
{
super
.
onSaveInstanceState
(
outState
)
LogEx
.
logDebug
(
TAG
,
"onSaveInstanceState"
)
}
var
isDocumentAdd
:
Boolean
=
false
var
isRecentAdd
:
Boolean
=
false
var
isBookmarkAdd
:
Boolean
=
false
...
...
@@ -92,6 +101,7 @@ class MainActivity : BaseActivity<ActivityMain2Binding>(), MainView {
changeTabSelect
(
it
)
supportFragmentManager
.
beginTransaction
().
apply
{
if
(!
isDocumentAdd
)
{
add
(
R
.
id
.
fl_container
,
documentFragment
)
}
...
...
library/src/main/java/com/cherry/lib/doc/DocViewerActivity.kt
View file @
2327df15
...
...
@@ -53,13 +53,10 @@ open class DocViewerActivity : AppCompatActivity() {
this
,
docUrl
,
docSourceType
,
fileType
,
false
,
DocEngine
.
values
().
first
{
it
.
value
==
engine
})
fileType
,
false
)
Log
.
e
(
TAG
,
"initData-docUrl = $docUrl"
)
Log
.
e
(
TAG
,
"initData-docSourceType = $docSourceType"
)
Log
.
e
(
TAG
,
"initData-fileType = $fileType"
)
Log
.
e
(
TAG
,
"initData-engine = $engine"
)
}
}
\ No newline at end of file
library/src/main/java/com/cherry/lib/doc/office/IOffice.java
View file @
2327df15
...
...
@@ -43,9 +43,7 @@ public abstract class IOffice implements IMainFrame {
if
(
componentWidth
==
0
||
componentHeight
==
0
)
{
return
null
;
}
if
(
bitmap
==
null
||
bitmap
.
getWidth
()
!=
componentWidth
||
bitmap
.
getHeight
()
!=
componentHeight
)
{
if
(
bitmap
==
null
||
bitmap
.
getWidth
()
!=
componentWidth
||
bitmap
.
getHeight
()
!=
componentHeight
)
{
// custom picture size
if
(
bitmap
!=
null
)
{
bitmap
.
recycle
();
...
...
@@ -82,10 +80,13 @@ public abstract class IOffice implements IMainFrame {
}
private
void
saveBitmapToFile
(
Bitmap
bitmap
)
{
Log
.
e
(
TAG
,
"saveBitmapToFile1"
);
if
(
bitmap
==
null
)
{
Log
.
e
(
TAG
,
"saveBitmapToFile2"
);
return
;
}
if
(
tempFilePath
==
null
)
{
Log
.
e
(
TAG
,
"saveBitmapToFile3"
);
// 存在外部目录相册中会显示
// String state = Environment.getExternalStorageState();
// if (Environment.MEDIA_MOUNTED.equals(state)) {
...
...
@@ -101,6 +102,7 @@ public abstract class IOffice implements IMainFrame {
File
file
=
new
File
(
tempFilePath
+
File
.
separatorChar
+
"export_image.jpg"
);
try
{
if
(
file
.
exists
())
{
Log
.
e
(
TAG
,
"saveBitmapToFile4"
);
file
.
delete
();
}
file
.
createNewFile
();
...
...
library/src/main/java/com/cherry/lib/doc/office/system/beans/pagelist/APageListView.java
View file @
2327df15
...
...
@@ -38,7 +38,6 @@ public class APageListView extends AdapterView<Adapter> {
}
/**
*
*/
...
...
@@ -721,6 +720,7 @@ public class APageListView extends AdapterView<Adapter> {
*
*/
public
float
getZoom
()
{
Log
.
e
(
"APageListView"
,
"getZoom"
);
return
zoom
;
}
...
...
@@ -728,6 +728,7 @@ public class APageListView extends AdapterView<Adapter> {
*
*/
public
float
getFitZoom
()
{
Log
.
e
(
"APageListView"
,
"getFitZoom"
);
return
getFitZoom
(
0
);
}
...
...
library/src/main/java/com/cherry/lib/doc/office/wp/control/PrintWord.java
View file @
2327df15
...
...
@@ -174,6 +174,7 @@ public class PrintWord extends FrameLayout implements IPageListViewListener {
*
*/
public
float
getZoom
()
{
Log
.
e
(
"PrintWord"
,
"getZoom"
);
return
listView
.
getZoom
();
}
...
...
@@ -181,6 +182,7 @@ public class PrintWord extends FrameLayout implements IPageListViewListener {
*
*/
public
float
getFitZoom
()
{
Log
.
e
(
"PrintWord"
,
"getFitZoom"
);
return
listView
.
getFitZoom
();
}
...
...
library/src/main/java/com/cherry/lib/doc/office/wp/control/WPControl.java
View file @
2327df15
This diff is collapsed.
Click to expand it.
library/src/main/java/com/cherry/lib/doc/office/wp/control/Word.java
View file @
2327df15
...
...
@@ -40,6 +40,7 @@ import com.cherry.lib.doc.office.system.IControl;
import
com.cherry.lib.doc.office.system.IDialogAction
;
import
com.cherry.lib.doc.office.system.SysKit
;
import
com.cherry.lib.doc.office.system.beans.pagelist.APageListView
;
import
com.cherry.lib.doc.office.thirdpart.emf.io.Tag
;
import
com.cherry.lib.doc.office.wp.view.LayoutKit
;
import
com.cherry.lib.doc.office.wp.view.NormalRoot
;
import
com.cherry.lib.doc.office.wp.view.PageRoot
;
...
...
@@ -112,6 +113,7 @@ public class Word extends LinearLayout implements IWord {
if
(
normalRoot
!=
null
)
{
normalRoot
.
doLayout
(
0
,
0
,
mWidth
,
mHeight
,
Integer
.
MAX_VALUE
,
0
);
}
else
{
Log
.
e
(
"Word"
,
"init"
);
pageRoot
.
doLayout
(
0
,
0
,
mWidth
,
mHeight
,
Integer
.
MAX_VALUE
,
0
);
}
initFinish
=
true
;
...
...
@@ -140,6 +142,7 @@ public class Word extends LinearLayout implements IWord {
}
try
{
if
(
getCurrentRootType
()
==
WPViewConstant
.
PAGE_ROOT
)
{
Log
.
e
(
"Wod"
,
"onDraw zoom="
+
zoom
);
pageRoot
.
draw
(
canvas
,
0
,
0
,
zoom
);
drawPageNubmer
(
canvas
,
zoom
);
}
else
if
(
getCurrentRootType
()
==
WPViewConstant
.
NORMAL_ROOT
)
{
...
...
@@ -172,7 +175,9 @@ public class Word extends LinearLayout implements IWord {
*
*/
private
void
toPicture
(
IOfficeToPicture
otp
)
{
Log
.
e
(
"Word"
,
"toPicture1"
);
if
(
getCurrentRootType
()
==
WPViewConstant
.
PRINT_ROOT
)
{
Log
.
e
(
"Word"
,
"toPicture2"
);
WPPageListItem
item
=
(
WPPageListItem
)
printWord
.
getListView
().
getCurrentPageView
();
item
.
addRepaintImageView
(
null
);
return
;
...
...
@@ -181,12 +186,15 @@ public class Word extends LinearLayout implements IWord {
PictureKit
.
instance
().
setDrawPictrue
(
true
);
Bitmap
bitmap
=
otp
.
getBitmap
(
getWidth
(),
getHeight
());
if
(
bitmap
==
null
)
{
Log
.
e
(
"Word"
,
"toPicture3"
);
return
;
}
float
paintZoom
=
getZoom
();
Log
.
e
(
"Word"
,
"paintZoom="
+
paintZoom
);
float
tX
=
-
getScrollX
();
float
tY
=
-
getScrollY
();
if
(
bitmap
.
getWidth
()
!=
getWidth
()
||
bitmap
.
getHeight
()
!=
getHeight
())
{
Log
.
e
(
"Word"
,
"toPicture4"
);
float
newZoom
=
Math
.
min
((
float
)
bitmap
.
getWidth
()
/
getWidth
(),
(
float
)
bitmap
.
getHeight
()
/
getHeight
())
*
getZoom
();
...
...
@@ -275,7 +283,7 @@ public class Word extends LinearLayout implements IWord {
return
;
}
eventManage
.
stopFling
();
LayoutKit
.
instance
().
layoutAllPage
(
pageRoot
,
zoom
);
LayoutKit
.
instance
().
layoutAllPage
(
pageRoot
,
zoom
,
1
);
if
(
currentRootType
==
WPViewConstant
.
PAGE_ROOT
)
{
Rectangle
r
=
getVisibleRect
();
int
sX
=
r
.
x
;
...
...
@@ -374,9 +382,10 @@ public class Word extends LinearLayout implements IWord {
}
else
if
(
getCurrentRootType
()
==
WPViewConstant
.
PAGE_ROOT
)
{
if
(
pageRoot
==
null
)
{
pageRoot
=
new
PageRoot
(
this
);
Log
.
e
(
"Word"
,
"switchView1"
);
pageRoot
.
doLayout
(
0
,
0
,
mWidth
,
mHeight
,
Integer
.
MAX_VALUE
,
0
);
}
else
{
LayoutKit
.
instance
().
layoutAllPage
(
pageRoot
,
zoom
);
LayoutKit
.
instance
().
layoutAllPage
(
pageRoot
,
zoom
,
2
);
}
setOnTouchListener
(
eventManage
);
if
(
printWord
!=
null
)
{
...
...
@@ -385,6 +394,7 @@ public class Word extends LinearLayout implements IWord {
}
else
if
(
getCurrentRootType
()
==
WPViewConstant
.
PRINT_ROOT
)
{
if
(
pageRoot
==
null
)
{
pageRoot
=
new
PageRoot
(
this
);
Log
.
e
(
"Word"
,
"switchView2"
);
pageRoot
.
doLayout
(
0
,
0
,
mWidth
,
mHeight
,
Integer
.
MAX_VALUE
,
0
);
}
if
(
printWord
==
null
)
{
...
...
@@ -438,11 +448,13 @@ public class Word extends LinearLayout implements IWord {
* @param zoom The zoom to set.
*/
public
void
setZoom
(
float
zoom
,
int
pointX
,
int
pointY
)
{
Log
.
e
(
"Word"
,
"setZoom "
+
"zoom="
+
zoom
+
" pointX="
+
pointX
+
" pointY="
+
pointY
);
float
oldZoom
=
1.0f
;
if
(
currentRootType
==
WPViewConstant
.
PAGE_ROOT
)
{
oldZoom
=
this
.
zoom
;
this
.
zoom
=
zoom
;
LayoutKit
.
instance
().
layoutAllPage
(
pageRoot
,
zoom
);
Log
.
e
(
"Word"
,
"setZoom zoom="
+
this
.
zoom
);
LayoutKit
.
instance
().
layoutAllPage
(
pageRoot
,
zoom
,
3
);
}
else
if
(
currentRootType
==
WPViewConstant
.
PRINT_ROOT
)
{
printWord
.
setZoom
(
zoom
,
pointX
,
pointY
);
return
;
...
...
@@ -889,9 +901,11 @@ public class Word extends LinearLayout implements IWord {
* @return Returns the zoom.
*/
public
float
getZoom
()
{
Log
.
e
(
"Word"
,
"getZoom currentRootType="
+
currentRootType
);
if
(
currentRootType
==
WPViewConstant
.
NORMAL_ROOT
)
{
return
normalZoom
;
}
else
if
(
currentRootType
==
WPViewConstant
.
PAGE_ROOT
)
{
Log
.
e
(
"Word"
,
"getZoom zoom="
+
zoom
);
return
zoom
;
}
else
if
(
currentRootType
==
WPViewConstant
.
PRINT_ROOT
)
{
if
(
printWord
!=
null
)
{
...
...
library/src/main/java/com/cherry/lib/doc/office/wp/view/LayoutKit.java
View file @
2327df15
...
...
@@ -64,12 +64,18 @@ public class LayoutKit {
* @param root
* @param zoom
*/
public
void
layoutAllPage
(
PageRoot
root
,
float
zoom
)
{
public
void
layoutAllPage
(
PageRoot
root
,
float
zoom
,
int
where
)
{
Log
.
e
(
"LayoutKit"
,
"layoutAllPage zoom="
+
zoom
+
" where="
+
where
);
if
(
root
==
null
||
root
.
getChildView
()
==
null
)
{
Log
.
e
(
"LayoutKit"
,
"中断1"
);
return
;
}
Word
word
=
(
Word
)
root
.
getContainer
();
if
(
word
.
getContext
()
!=
null
&&
(
screenWidthPixels
==
0
||
screenHeightPixels
==
0
))
{
// if (word.getContext() != null && (screenWidthPixels == 0 || screenHeightPixels == 0)) {
if
(
screenWidthPixels
==
0
)
{
}
if
(
word
.
getContext
()
!=
null
)
{
// 获取资源对象
Resources
resources
=
word
.
getContext
().
getResources
();
boolean
isLandscape
=
resources
.
getConfiguration
().
orientation
==
Configuration
.
ORIENTATION_LANDSCAPE
;
...
...
@@ -89,14 +95,17 @@ public class LayoutKit {
IView
pv
=
root
.
getChildView
();
int
pvWidth
=
pv
.
getWidth
();
float
scale
=
1
;
Log
.
e
(
TAG
,
"layoutAllPage screenWidthPixels="
+
screenWidthPixels
+
" pvWidth"
+
pvWidth
);
if
(
screenWidthPixels
!=
0
&&
pvWidth
!=
0
)
{
scale
=
screenWidthPixels
*
1
f
/
pvWidth
;
if
(
zoom
==
1
f
)
{
Log
.
e
(
TAG
,
"layoutAllPage scale="
+
scale
);
word
.
setZoom
(
scale
,
0
,
0
);
}
}
Log
.
d
(
TAG
,
"layoutAllPage screenWidthPixels = "
+
screenWidthPixels
+
"; isLandscape "
+
isLandscape
+
", pvWidth = "
+
pvWidth
+
"; scale = "
+
scale
);
}
Log
.
e
(
"LayoutKit"
,
"中断2"
);
int
dx
=
WPViewConstant
.
PAGE_SPACE
;
int
dy
=
WPViewConstant
.
PAGE_SPACE
;
IView
pv
=
root
.
getChildView
();
...
...
library/src/main/java/com/cherry/lib/doc/office/wp/view/PageRoot.java
View file @
2327df15
This diff is collapsed.
Click to expand it.
library/src/main/java/com/cherry/lib/doc/office/wp/view/WPLayouter.java
View file @
2327df15
...
...
@@ -72,7 +72,7 @@ public class WPLayouter
PageView
pv
=
(
PageView
)
ViewFactory
.
createView
(
root
.
getControl
(),
section
,
null
,
WPViewConstant
.
PAGE_VIEW
);
root
.
appendChlidView
(
pv
);
layoutPage
(
pv
);
LayoutKit
.
instance
().
layoutAllPage
(
root
,
1.0f
);
LayoutKit
.
instance
().
layoutAllPage
(
root
,
1.0f
,
5
);
}
/**
...
...
library/src/main/java/com/cherry/lib/doc/widget/DocView.kt
View file @
2327df15
...
...
@@ -113,10 +113,9 @@ class DocView : FrameLayout {
fun
openDoc
(
activity
:
Activity
,
docUrl
:
String
?,
docSourceType
:
Int
,
engine
:
DocEngine
=
this
.
engine
)
{
mActivity
=
activity
openDoc
(
activity
,
docUrl
,
docSourceType
,
-
1
,
false
,
engine
)
openDoc
(
activity
,
docUrl
,
docSourceType
,
-
1
,
false
)
}
@SuppressLint
(
"ObsoleteSdkInt"
)
...
...
@@ -126,7 +125,6 @@ class DocView : FrameLayout {
docSourceType
:
Int
,
fileType
:
Int
,
viewPdfInPage
:
Boolean
=
false
,
engine
:
DocEngine
=
this
.
engine
)
{
var
fileType
=
fileType
var
docUrl
=
docUrl
...
...
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