Commit 2327df15 authored by wanglei's avatar wanglei

...

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