Commit d6f01a25 by Lee Jaebin

PDFプロジェクトの拡大時、ダブルタップで作業指示を追加

parent abf5752a
...@@ -155,14 +155,14 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -155,14 +155,14 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (!isLinkedContent) { if (!isLinkedContent) {
projectDto = AbstractLogic.getLogic(ProjectLogic.class).getProject(mProjectId); projectDto = AbstractLogic.getLogic(ProjectLogic.class).getProject(mProjectId);
mXWalkOpenType = intent.getIntExtra(Constant.ABookCheck.XWALK_OPEN_TYPE, -1); mXWalkOpenType = intent.getIntExtra(Constant.ABookCheck.XWALK_OPEN_TYPE, Constant.XWalkOpenType.DEFAULT);
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT || mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION || mXWalkOpenType == Constant.XWalkOpenType.PANO_EDIT) { if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT || mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION || mXWalkOpenType == Constant.XWalkOpenType.PANO_EDIT) {
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT || mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION) { if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT || mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION) {
if (isNormalSize()) { mProjectType = projectDto.projectType;
if (mProjectType != ProjectType.PDF && isNormalSize()) {
// 縦画面固定 // 縦画面固定
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} }
mProjectType = projectDto.projectType;
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
...@@ -693,7 +693,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -693,7 +693,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT || mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION || mXWalkOpenType == Constant.XWalkOpenType.PANO_EDIT) { if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT || mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION || mXWalkOpenType == Constant.XWalkOpenType.PANO_EDIT) {
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT || mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION) { if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT || mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION) {
if (isNormalSize()) { if (mProjectType != ProjectType.PDF && isNormalSize()) {
// 縦画面固定 // 縦画面固定
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} }
......
...@@ -1823,16 +1823,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -1823,16 +1823,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
} }
Logger.d(TAG, "[singleTapMotion]:isOnClick=false"); Logger.d(TAG, "[singleTapMotion]:isOnClick=false");
if (mPageScrollView.isZooming()) { if (!mPageScrollView.isZooming()) {
ZoomRelativeLayout zoomRelativeLayout = mShowPageLayout.get(mCurrentPageNumber);
if (zoomRelativeLayout == null) {
Logger.e(TAG, "zoomRelativeLayout is null");
return;
}
// 拡大中は拡大率を表示
int scale = (int) (mShowPageLayout.get(mCurrentPageNumber).getScaleFactor() * 100f);
Toast.makeText(getApplicationContext(), String.format("%d%%", scale), Toast.LENGTH_SHORT).show();
} else {
TranslateAnimation toolBarAnimation; TranslateAnimation toolBarAnimation;
if (mToolBar.getVisibility() == View.GONE) { if (mToolBar.getVisibility() == View.GONE) {
setToolbarVisable(true); setToolbarVisable(true);
......
...@@ -214,7 +214,7 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -214,7 +214,7 @@ public class ProjectTaskLayout extends RelativeLayout {
taskView.setOnTouchListener(new View.OnTouchListener() { taskView.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View view, MotionEvent event) { public boolean onTouch(View view, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN && rootLayout.isEnableProjectTaskClickOrMove()) { if (event.getAction() == MotionEvent.ACTION_DOWN) {
ClipData data = ClipData.newPlainText("", ""); ClipData data = ClipData.newPlainText("", "");
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view); View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
view.startDrag(data, shadowBuilder, view, 0); view.startDrag(data, shadowBuilder, view, 0);
...@@ -230,7 +230,7 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -230,7 +230,7 @@ public class ProjectTaskLayout extends RelativeLayout {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Logger.d(TAG, "[taskView.setOnClickListener]:taskCode=" + dto.taskCode); Logger.d(TAG, "[taskView.setOnClickListener]:taskCode=" + dto.taskCode);
if (!((ContentViewActivity)context).getOpenedProjestTask() && rootLayout.isEnableProjectTaskClickOrMove()) { if (!((ContentViewActivity)context).getOpenedProjestTask()) {
((ContentViewActivity)context).showProjectTaskLayout(rootLayout, dto, view.getX()); ((ContentViewActivity)context).showProjectTaskLayout(rootLayout, dto, view.getX());
} }
} }
......
...@@ -5,6 +5,7 @@ import android.content.res.Configuration; ...@@ -5,6 +5,7 @@ import android.content.res.Configuration;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.PointF;
import android.view.DragEvent; import android.view.DragEvent;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.GestureDetector.OnDoubleTapListener; import android.view.GestureDetector.OnDoubleTapListener;
...@@ -598,27 +599,49 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -598,27 +599,49 @@ public class ZoomRelativeLayout extends RelativeLayout {
for (int i = 0; i < listMemo.size(); i++) { for (int i = 0; i < listMemo.size(); i++) {
// アイコン追加 // アイコン追加
ContentMemoDto dto = listMemo.get(i); ContentMemoDto dto = listMemo.get(i);
Point point = convertToViewPoint(dto.axisX, dto.axisY); Point point = convertToAuthoringPoint(dto.axisX, dto.axisY);
dto.viewX = point.x; dto.viewX = point.x;
dto.viewY = point.y; dto.viewY = point.y;
MemoManager.addMemoIcon(this, dto); MemoManager.addMemoIcon(this, dto);
} }
} }
// public Point convertToAuthoringPoint(float x, float y) {
// Logger.d(TAG, "convertToAuthoringPoint:x=%s, y=%s", x, y);
// // タッチ座標からPDF座標に変換
// mPdfScale = Math.min(getWidth() / (float)mPdfSize.width, getHeight() / (float)mPdfSize.height);
// float marginX = getMarginX(mPdfScale);
// float marginY = getMarginY(mPdfScale);
// float pdfX = x - marginX;
// float pdfY = y - marginY;
// Logger.d(TAG, "convertToAuthoringPoint:marginX=%s, marginY=%s, mPdfScale=%s pdfX=%s, pdfY=%s", margin.left, margin.top, mPdfScale, pdfX, pdfY);
//
// // 変換PDF基準座標からオーサリング基準座標に変換
// float scale = Math.min((float)mAuthoringPageSize.width / getDefaultPDFWidth(), (float)mAuthoringPageSize.height / getDefaultPDFHeight());
// Point point = new Point((int)(pdfX * scale), (int)(pdfY * scale));
// Logger.d(TAG, "convertToAuthoringPoint:scale=%s scaledWidth=%s, scaledHeight=%s authX=%s, auyhY=%s", scale, getDefaultPDFWidth(), getDefaultPDFHeight(), (pdfX * scale), (pdfY * scale));
// return point;
// }
/**
* オブジェクトの位置調整
* @param x
* @param y
* @return
*/
public Point convertToAuthoringPoint(float x, float y) { public Point convertToAuthoringPoint(float x, float y) {
Logger.d(TAG, "convertToAuthoringPoint:x=%s, y=%s", x, y); float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
// タッチ座標からPDF座標に変換 float pdfScale = pdfMatrix[0];
mPdfScale = Math.min(getWidth() / (float)mPdfSize.width, getHeight() / (float)mPdfSize.height);
float marginX = getMarginX(mPdfScale); float matrixX = pdfMatrix[Matrix.MTRANS_X];
float marginY = getMarginY(mPdfScale); float matrixY = pdfMatrix[Matrix.MTRANS_Y];
float pdfX = x - marginX;
float pdfY = y - marginY; float scaleX = (float)mAuthoringPageSize.width / getScaledPDFWidth(pdfScale);
Logger.d(TAG, "convertToAuthoringPoint:marginX=%s, marginY=%s, mPdfScale=%s pdfX=%s, pdfY=%s", margin.left, margin.top, mPdfScale, pdfX, pdfY); float scaleY = (float)mAuthoringPageSize.height / getScaledPDFHeight(pdfScale);
float pdfX = (x * scaleX) - (matrixX * scaleX);
// 変換PDF基準座標からオーサリング基準座標に変換 float pdfY = (y * scaleY) - (matrixY * scaleY);
float scale = Math.min((float)mAuthoringPageSize.width / getDefaultPDFWidth(), (float)mAuthoringPageSize.height / getDefaultPDFHeight());
Point point = new Point((int)(pdfX * scale), (int)(pdfY * scale)); Point point = new Point((int)pdfX, (int)pdfY);
Logger.d(TAG, "convertToAuthoringPoint:scale=%s scaledWidth=%s, scaledHeight=%s authX=%s, auyhY=%s", scale, getDefaultPDFWidth(), getDefaultPDFHeight(), (pdfX * scale), (pdfY * scale));
return point; return point;
} }
...@@ -837,14 +860,14 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -837,14 +860,14 @@ public class ZoomRelativeLayout extends RelativeLayout {
return true; return true;
} }
if (!isEnableProjectTaskNewOrMove()) { // if (!isEnableProjectTaskNewOrMove()) {
if (((ContentViewActivity)mContext).isDirector()) { // if (((ContentViewActivity)mContext).isDirector()) {
ABookAlertDialog dialog = AlertDialogUtil.createAlertDialog(getContext(), " ", getResources().getString(R.string.msg_task_doubletap_failed)); // ABookAlertDialog dialog = AlertDialogUtil.createAlertDialog(getContext(), " ", getResources().getString(R.string.msg_task_doubletap_failed));
dialog.setPositiveButton(R.string.ok, null); // dialog.setPositiveButton(R.string.ok, null);
dialog.show(); // dialog.show();
} // }
return true; // return true;
} // }
final float x = e.getX(); final float x = e.getX();
final float y = e.getY(); final float y = e.getY();
...@@ -857,14 +880,14 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -857,14 +880,14 @@ public class ZoomRelativeLayout extends RelativeLayout {
float pdfY = pdfMatrix[Matrix.MTRANS_Y]/2; float pdfY = pdfMatrix[Matrix.MTRANS_Y]/2;
// If left-out or right-out of PDF // If left-out or right-out of PDF
if ((x-(margin.left+pdfX)) < 0 || (((margin.left+pdfX)+scaledWidth)-x)<0) { // if ((x-(margin.left+pdfX)) < 0 || (((margin.left+pdfX)+scaledWidth)-x)<0) {
return true; // return true;
} // }
//
// If top-out or bottom-out of PDF // // If top-out or bottom-out of PDF
if ((y-(margin.top+pdfY)) < 0 || (((margin.top+pdfY)+scaledHeight)-y)<0) { // if ((y-(margin.top+pdfY)) < 0 || (((margin.top+pdfY)+scaledHeight)-y)<0) {
return true; // return true;
} // }
Point pointPdf = convertToAuthoringPoint(x, y); Point pointPdf = convertToAuthoringPoint(x, y);
...@@ -918,12 +941,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -918,12 +941,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
}; };
public boolean isEnableProjectTaskNewOrMove() { public boolean isEnableProjectTaskNewOrMove() {
return mScaleFactor == 1.0f && ((ContentViewActivity)mContext).isDirector(); return ((ContentViewActivity)mContext).isDirector();
//return !mScaleDetector.isInProgress() && mPageScrollView.isMemocheck();
}
public boolean isEnableProjectTaskClickOrMove() {
return mScaleFactor == 1.0f;
} }
public boolean isZooming() { public boolean isZooming() {
......
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