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
8217742d
Commit
8217742d
authored
Sep 26, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
8c245b6a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
207 additions
and
258 deletions
+207
-258
ExcelActivity.kt
.../pdfviewerscannerwhite/ui/document/excel/ExcelActivity.kt
+11
-1
MainActivity.kt
...va/com/base/pdfviewerscannerwhite/ui/main/MainActivity.kt
+0
-1
ExcelView.java
.../java/com/cherry/lib/doc/office/ss/control/ExcelView.java
+1
-1
SSControl.java
.../java/com/cherry/lib/doc/office/ss/control/SSControl.java
+188
-255
AEventManage.java
.../com/cherry/lib/doc/office/system/beans/AEventManage.java
+1
-0
bg_test_ss_sheetbar_bg.xml
library/src/main/res/drawable/bg_test_ss_sheetbar_bg.xml
+6
-0
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/excel/ExcelActivity.kt
View file @
8217742d
...
...
@@ -10,6 +10,7 @@ import android.view.animation.TranslateAnimation
import
android.view.inputmethod.EditorInfo
import
androidx.activity.addCallback
import
androidx.core.widget.addTextChangedListener
import
androidx.lifecycle.lifecycleScope
import
com.base.pdfviewerscannerwhite.bean.DocumentBean
import
com.base.pdfviewerscannerwhite.databinding.ActivityExcelBinding
import
com.base.pdfviewerscannerwhite.helper.BaseActivity
...
...
@@ -18,9 +19,13 @@ import com.base.pdfviewerscannerwhite.utils.KeyBoardUtils.hideKeyboard
import
com.base.pdfviewerscannerwhite.utils.KeyBoardUtils.showKeyBoard
import
com.base.pdfviewerscannerwhite.utils.LogEx
import
com.cherry.lib.doc.bean.DocEngine
import
com.cherry.lib.doc.office.constant.EventConstant
import
com.cherry.lib.doc.office.ss.control.SSControl
import
com.cherry.lib.doc.office.ss.control.Spreadsheet
import
com.cherry.lib.doc.office.ss.sheetbar.SheetBar
import
com.cherry.lib.doc.util.Constant
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
import
java.io.File
class
ExcelActivity
:
BaseActivity
<
ActivityExcelBinding
>()
{
...
...
@@ -114,7 +119,12 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
binding
.
flNext
.
setOnClickListener
{
getSpreadsheet
().
findForward
()
}
lifecycleScope
.
launch
{
delay
(
3000
)
val
ssControl
:
SSControl
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
SSControl
)
val
sheetBar
:
SheetBar
=
ssControl
.
excelView
.
bar
ssControl
.
actionEvent
(
EventConstant
.
SS_SHOW_SHEET
,
0
)
}
}
private
fun
getSpreadsheet
():
Spreadsheet
{
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/MainActivity.kt
View file @
8217742d
...
...
@@ -93,7 +93,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), MainView {
showStoragePermission
(
launcher
)
updateMediaStore
()
}
}
private
fun
initTabLayout
()
{
...
...
library/src/main/java/com/cherry/lib/doc/office/ss/control/ExcelView.java
View file @
8217742d
...
...
@@ -185,7 +185,7 @@ public class ExcelView extends RelativeLayout
//
private
Spreadsheet
ss
;
//
p
rivate
SheetBar
bar
;
p
ublic
SheetBar
bar
;
//
private
IControl
control
;
...
...
library/src/main/java/com/cherry/lib/doc/office/ss/control/SSControl.java
View file @
8217742d
...
...
@@ -50,15 +50,12 @@ import org.jetbrains.annotations.Nullable;
* <p>
* <p>
*/
public
class
SSControl
extends
AbstractControl
{
public
class
SSControl
extends
AbstractControl
{
/**
*
* @param
* @param filepath
*/
public
SSControl
(
IControl
mainControl
,
Workbook
book
,
String
filepath
)
{
public
SSControl
(
IControl
mainControl
,
Workbook
book
,
String
filepath
)
{
this
.
mainControl
=
mainControl
;
this
.
excelView
=
new
ExcelView
(
getMainFrame
().
getActivity
(),
filepath
,
book
,
this
);
this
.
spreadSheet
=
excelView
.
getSpreadsheet
();
...
...
@@ -66,39 +63,34 @@ public class SSControl extends AbstractControl
/**
* 布局视图
*
* @param x
* @param y
* @param w
* @param h
*/
public
void
layoutView
(
int
x
,
int
y
,
int
w
,
int
h
)
{
public
void
layoutView
(
int
x
,
int
y
,
int
w
,
int
h
)
{
}
/**
* action派发
*
* @param actionID 动作ID
* @param obj 动作ID的Value
*/
public
void
actionEvent
(
int
actionID
,
final
@Nullable
Object
obj
)
{
public
void
actionEvent
(
int
actionID
,
final
@Nullable
Object
obj
)
{
Intent
intent
;
switch
(
actionID
)
{
switch
(
actionID
)
{
case
EventConstant
.
SYS_SET_PROGRESS_BAR_ID
:
if
(
spreadSheet
.
getParent
()
!=
null
)
{
spreadSheet
.
post
(
new
Runnable
()
{
if
(
spreadSheet
.
getParent
()
!=
null
)
{
spreadSheet
.
post
(
new
Runnable
()
{
/**
*
*/
public
void
run
()
{
if
(!
isDispose
)
{
public
void
run
()
{
if
(!
isDispose
)
{
//getActivity().setProgressBarIndeterminateVisibility((Boolean)obj);
mainControl
.
getMainFrame
().
showProgressBar
((
Boolean
)
obj
);
mainControl
.
getMainFrame
().
showProgressBar
((
Boolean
)
obj
);
}
}
});
...
...
@@ -106,34 +98,25 @@ public class SSControl extends AbstractControl
break
;
case
EventConstant
.
SYS_VECTORGRAPH_PROGRESS
:
if
(
spreadSheet
.
getParent
()
!=
null
)
{
spreadSheet
.
post
(
new
Runnable
()
{
if
(
spreadSheet
.
getParent
()
!=
null
)
{
spreadSheet
.
post
(
new
Runnable
()
{
/**
*
*/
public
void
run
()
{
if
(!
isDispose
)
{
mainControl
.
getMainFrame
().
updateViewImages
((
List
<
Integer
>)
obj
);
public
void
run
()
{
if
(!
isDispose
)
{
mainControl
.
getMainFrame
().
updateViewImages
((
List
<
Integer
>)
obj
);
}
}
});
}
else
{
new
Thread
()
{
}
else
{
new
Thread
()
{
/**
*
*/
public
void
run
()
{
if
(!
isDispose
)
{
mainControl
.
getMainFrame
().
updateViewImages
((
List
<
Integer
>)
obj
);
public
void
run
()
{
if
(!
isDispose
)
{
mainControl
.
getMainFrame
().
updateViewImages
((
List
<
Integer
>)
obj
);
}
}
}.
start
();
...
...
@@ -145,7 +128,7 @@ public class SSControl extends AbstractControl
break
;
case
EventConstant
.
SS_SHOW_SHEET
:
excelView
.
showSheet
((
Integer
)
obj
);
excelView
.
showSheet
((
Integer
)
obj
);
break
;
case
EventConstant
.
TEST_REPAINT_ID
:
...
...
@@ -157,15 +140,12 @@ public class SSControl extends AbstractControl
break
;
case
EventConstant
.
APP_ZOOM_ID
:
int
[]
params
=
(
int
[])
obj
;
spreadSheet
.
setZoom
(
params
[
0
]
/
(
float
)
MainConstant
.
STANDARD_RATE
);
//zoom
spreadSheet
.
post
(
new
Runnable
()
{
@
Override
public
void
run
()
{
if
(!
isDispose
)
{
int
[]
params
=
(
int
[])
obj
;
spreadSheet
.
setZoom
(
params
[
0
]
/
(
float
)
MainConstant
.
STANDARD_RATE
);
//zoom
spreadSheet
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(!
isDispose
)
{
getMainFrame
().
changeZoom
();
updateStatus
();
}
...
...
@@ -178,18 +158,15 @@ public class SSControl extends AbstractControl
break
;
case
EventConstant
.
FILE_COPY_ID
:
//copy
ClipboardManager
clip
=
(
ClipboardManager
)
getMainFrame
().
getActivity
().
getSystemService
(
Context
.
CLIPBOARD_SERVICE
);
ClipboardManager
clip
=
(
ClipboardManager
)
getMainFrame
().
getActivity
().
getSystemService
(
Context
.
CLIPBOARD_SERVICE
);
clip
.
setText
(
spreadSheet
.
getActiveCellContent
());
break
;
case
EventConstant
.
APP_HYPERLINK
:
//hyperlink
Hyperlink
hyperlink
=
spreadSheet
.
getActiveCellHyperlink
();
if
(
hyperlink
!=
null
)
{
try
{
if
(
hyperlink
.
getLinkType
()
==
Hyperlink
.
LINK_DOCUMENT
)
{
if
(
hyperlink
!=
null
)
{
try
{
if
(
hyperlink
.
getLinkType
()
==
Hyperlink
.
LINK_DOCUMENT
)
{
String
addr
=
hyperlink
.
getAddress
();
int
index
=
addr
.
indexOf
(
"!"
);
String
sheetName
=
addr
.
substring
(
0
,
index
).
replace
(
"'"
,
""
);
...
...
@@ -211,23 +188,17 @@ public class SSControl extends AbstractControl
spreadSheet
.
postInvalidate
();
}
else
if
(
hyperlink
.
getLinkType
()
==
Hyperlink
.
LINK_EMAIL
||
hyperlink
.
getLinkType
()
==
Hyperlink
.
LINK_URL
)
{
}
else
if
(
hyperlink
.
getLinkType
()
==
Hyperlink
.
LINK_EMAIL
||
hyperlink
.
getLinkType
()
==
Hyperlink
.
LINK_URL
)
{
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
hyperlink
.
getAddress
()));
getMainFrame
().
getActivity
().
startActivity
(
intent
);
}
else
{
}
else
{
//file hyperlink
mainControl
.
actionEvent
(
EventConstant
.
SYS_SHOW_TOOLTIP
,
"not supported hyperlink!"
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
...
...
@@ -238,8 +209,7 @@ public class SSControl extends AbstractControl
break
;
case
EventConstant
.
SYS_AUTO_TEST_FINISH_ID
:
// 布局完成
if
(
mainControl
.
isAutoTest
())
{
if
(
mainControl
.
isAutoTest
())
{
getMainFrame
().
getActivity
().
onBackPressed
();
}
break
;
...
...
@@ -249,25 +219,20 @@ public class SSControl extends AbstractControl
break
;
case
EventConstant
.
APP_ABORTREADING
:
if
(
mainControl
.
getReader
()
!=
null
)
{
if
(
mainControl
.
getReader
()
!=
null
)
{
mainControl
.
getReader
().
abortReader
();
}
break
;
case
EventConstant
.
APP_PAGE_UP_ID
:
if
(
spreadSheet
.
getEventManage
()
!=
null
)
{
if
(
spreadSheet
.
getEventManage
()
!=
null
)
{
spreadSheet
.
getEventManage
().
onScroll
(
null
,
null
,
0
,
-
spreadSheet
.
getHeight
()
+
10
);
exportImage
();
spreadSheet
.
post
(
new
Runnable
()
{
@
Override
public
void
run
()
{
if
(!
isDispose
)
{
spreadSheet
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(!
isDispose
)
{
updateStatus
();
}
}
...
...
@@ -276,18 +241,14 @@ public class SSControl extends AbstractControl
break
;
case
EventConstant
.
APP_PAGE_DOWN_ID
:
if
(
spreadSheet
.
getEventManage
()
!=
null
)
{
if
(
spreadSheet
.
getEventManage
()
!=
null
)
{
spreadSheet
.
getEventManage
().
onScroll
(
null
,
null
,
0
,
spreadSheet
.
getHeight
()
-
10
);
exportImage
();
spreadSheet
.
post
(
new
Runnable
()
{
@
Override
public
void
run
()
{
if
(!
isDispose
)
{
spreadSheet
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(!
isDispose
)
{
updateStatus
();
}
}
...
...
@@ -314,10 +275,8 @@ public class SSControl extends AbstractControl
*
* @return obj
*/
public
@Nullable
Object
getActionValue
(
int
actionID
,
@Nullable
Object
obj
)
{
switch
(
actionID
)
{
public
@Nullable
Object
getActionValue
(
int
actionID
,
@Nullable
Object
obj
)
{
switch
(
actionID
)
{
case
EventConstant
.
APP_ZOOM_ID
:
return
spreadSheet
.
getZoom
();
...
...
@@ -334,39 +293,33 @@ public class SSControl extends AbstractControl
Vector
<
String
>
vec
=
new
Vector
<
String
>();
Workbook
book
=
spreadSheet
.
getWorkbook
();
int
cnt
=
book
.
getSheetCount
();
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
{
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
{
vec
.
add
(
book
.
getSheet
(
i
).
getSheetName
());
}
return
vec
;
case
EventConstant
.
SS_GET_SHEET_NAME
:
int
number
=
(
Integer
)
obj
;
if
(
number
==
-
1
)
{
int
number
=
(
Integer
)
obj
;
if
(
number
==
-
1
)
{
return
null
;
}
Sheet
sheet
=
spreadSheet
.
getWorkbook
().
getSheet
(
number
-
1
);
if
(
sheet
!=
null
)
{
if
(
sheet
!=
null
)
{
return
sheet
.
getSheetName
();
}
return
null
;
case
EventConstant
.
APP_THUMBNAIL_ID
:
if
(
obj
instanceof
int
[])
{
int
[]
paraArr
=
(
int
[])
obj
;
if
(
paraArr
!=
null
&&
paraArr
.
length
==
3
)
{
return
spreadSheet
.
getThumbnail
(
paraArr
[
0
],
paraArr
[
1
],
paraArr
[
2
]
/
(
float
)
MainConstant
.
STANDARD_RATE
);
if
(
obj
instanceof
int
[])
{
int
[]
paraArr
=
(
int
[])
obj
;
if
(
paraArr
!=
null
&&
paraArr
.
length
==
3
)
{
return
spreadSheet
.
getThumbnail
(
paraArr
[
0
],
paraArr
[
1
],
paraArr
[
2
]
/
(
float
)
MainConstant
.
STANDARD_RATE
);
}
}
case
EventConstant
.
APP_GET_SNAPSHOT_ID
:
if
(
spreadSheet
!=
null
)
{
return
spreadSheet
.
getSnapshot
((
Bitmap
)
obj
);
if
(
spreadSheet
!=
null
)
{
return
spreadSheet
.
getSnapshot
((
Bitmap
)
obj
);
}
break
;
...
...
@@ -380,14 +333,10 @@ public class SSControl extends AbstractControl
/**
*
*/
private
void
updateStatus
()
{
spreadSheet
.
post
(
new
Runnable
()
{
public
void
run
()
{
if
(!
isDispose
)
{
private
void
updateStatus
()
{
spreadSheet
.
post
(
new
Runnable
()
{
public
void
run
()
{
if
(!
isDispose
)
{
getMainFrame
().
updateToolsbarStatus
();
}
}
...
...
@@ -398,16 +347,12 @@ public class SSControl extends AbstractControl
/**
*
*/
private
void
exportImage
()
{
spreadSheet
.
post
(
new
Runnable
()
{
private
void
exportImage
()
{
spreadSheet
.
post
(
new
Runnable
()
{
@
Override
public
void
run
()
{
if
(!
isDispose
)
{
@Override
public
void
run
()
{
if
(!
isDispose
)
{
spreadSheet
.
createPicture
();
}
}
...
...
@@ -416,100 +361,89 @@ public class SSControl extends AbstractControl
/**
* current view index
*
* @return
*/
public
int
getCurrentViewIndex
()
{
public
int
getCurrentViewIndex
()
{
return
excelView
.
getCurrentViewIndex
();
}
/**
* 获取应用组件
*/
public
View
getView
()
{
public
View
getView
()
{
return
excelView
;
}
/**
*
*/
public
Dialog
getDialog
(
Activity
activity
,
int
id
)
{
public
Dialog
getDialog
(
Activity
activity
,
int
id
)
{
return
null
;
}
/**
*
*/
public
IMainFrame
getMainFrame
()
{
public
IMainFrame
getMainFrame
()
{
return
mainControl
.
getMainFrame
();
}
/**
* (non-Javadoc)
*
*(non-Javadoc)
* @see com.cherry.lib.doc.office.system.AbstractControl#getActivity()
*
*/
public
Activity
getActivity
()
{
public
Activity
getActivity
()
{
return
mainControl
.
getMainFrame
().
getActivity
();
}
/**
*
*/
public
IFind
getFind
()
{
public
IFind
getFind
()
{
return
spreadSheet
;
}
/**
*
*/
public
boolean
isAutoTest
()
{
public
boolean
isAutoTest
()
{
return
mainControl
.
isAutoTest
();
}
/**
*
*/
public
IOfficeToPicture
getOfficeToPicture
()
{
public
IOfficeToPicture
getOfficeToPicture
()
{
return
mainControl
.
getOfficeToPicture
();
}
/**
*
*/
public
ICustomDialog
getCustomDialog
()
{
public
ICustomDialog
getCustomDialog
()
{
return
mainControl
.
getCustomDialog
();
}
/**
*
*
*/
public
int
getApplicationType
()
{
public
int
getApplicationType
()
{
return
MainConstant
.
APPLICATION_TYPE_SS
;
}
/**
*
*/
public
SysKit
getSysKit
()
{
public
SysKit
getSysKit
()
{
return
mainControl
.
getSysKit
();
}
/**
* 释放内存
*/
public
void
dispose
()
{
public
void
dispose
()
{
isDispose
=
true
;
mainControl
=
null
;
...
...
@@ -519,8 +453,7 @@ public class SSControl extends AbstractControl
spreadSheet.dispose();
spreadSheet = null;
}*/
if
(
excelView
==
null
)
{
if
(
excelView
==
null
)
{
excelView
.
dispose
();
excelView
=
null
;
}
...
...
@@ -532,7 +465,7 @@ public class SSControl extends AbstractControl
//
private
boolean
isDispose
;
//
p
rivate
Spreadsheet
spreadSheet
;
p
ublic
Spreadsheet
spreadSheet
;
//
p
rivate
ExcelView
excelView
;
p
ublic
ExcelView
excelView
;
}
library/src/main/java/com/cherry/lib/doc/office/system/beans/AEventManage.java
View file @
8217742d
...
...
@@ -10,6 +10,7 @@ import com.cherry.lib.doc.office.constant.EventConstant;
import
com.cherry.lib.doc.office.constant.MainConstant
;
import
com.cherry.lib.doc.office.system.IControl
;
import
com.cherry.lib.doc.office.system.IMainFrame
;
import
android.content.Context
;
import
android.util.Log
;
import
android.view.GestureDetector
;
...
...
library/src/main/res/drawable/bg_test_ss_sheetbar_bg.xml
0 → 100644
View file @
8217742d
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#FAA9A7"
/>
<corners
android:radius=
"15dp"
/>
</shape>
\ 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