Commit d6f01a25 by Lee Jaebin

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

parent abf5752a
......@@ -155,14 +155,14 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (!isLinkedContent) {
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) {
if (isNormalSize()) {
mProjectType = projectDto.projectType;
if (mProjectType != ProjectType.PDF && isNormalSize()) {
// 縦画面固定
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
mProjectType = projectDto.projectType;
new Thread(new Runnable() {
@Override
......@@ -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) {
if (isNormalSize()) {
if (mProjectType != ProjectType.PDF && isNormalSize()) {
// 縦画面固定
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
......
......@@ -1823,16 +1823,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
Logger.d(TAG, "[singleTapMotion]:isOnClick=false");
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 {
if (!mPageScrollView.isZooming()) {
TranslateAnimation toolBarAnimation;
if (mToolBar.getVisibility() == View.GONE) {
setToolbarVisable(true);
......
......@@ -214,7 +214,7 @@ public class ProjectTaskLayout extends RelativeLayout {
taskView.setOnTouchListener(new View.OnTouchListener() {
@Override
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("", "");
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
view.startDrag(data, shadowBuilder, view, 0);
......@@ -230,7 +230,7 @@ public class ProjectTaskLayout extends RelativeLayout {
@Override
public void onClick(View view) {
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());
}
}
......
......@@ -5,6 +5,7 @@ import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.PointF;
import android.view.DragEvent;
import android.view.GestureDetector;
import android.view.GestureDetector.OnDoubleTapListener;
......@@ -598,27 +599,49 @@ public class ZoomRelativeLayout extends RelativeLayout {
for (int i = 0; i < listMemo.size(); 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.viewY = point.y;
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));
// 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) {
float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
float pdfScale = pdfMatrix[0];
float matrixX = pdfMatrix[Matrix.MTRANS_X];
float matrixY = pdfMatrix[Matrix.MTRANS_Y];
float scaleX = (float)mAuthoringPageSize.width / getScaledPDFWidth(pdfScale);
float scaleY = (float)mAuthoringPageSize.height / getScaledPDFHeight(pdfScale);
float pdfX = (x * scaleX) - (matrixX * scaleX);
float pdfY = (y * scaleY) - (matrixY * scaleY);
Point point = new Point((int)pdfX, (int)pdfY);
return point;
}
......@@ -629,7 +652,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
float pdfX = x * scale;
float pdfY = y * scale;
Logger.d(TAG, "convertToViewPoint:scale=%s scaledWidth=%s, scaledHeight=%s pdfX=%s, pdfY=%s", scale, getDefaultPDFWidth(), getDefaultPDFHeight(), pdfX, pdfY);
// PDF座標からタッチ座標に変換
float viewX = pdfX + margin.left;
float viewY = pdfY + margin.top;
......@@ -837,14 +860,14 @@ public class ZoomRelativeLayout extends RelativeLayout {
return true;
}
if (!isEnableProjectTaskNewOrMove()) {
if (((ContentViewActivity)mContext).isDirector()) {
ABookAlertDialog dialog = AlertDialogUtil.createAlertDialog(getContext(), " ", getResources().getString(R.string.msg_task_doubletap_failed));
dialog.setPositiveButton(R.string.ok, null);
dialog.show();
}
return true;
}
// if (!isEnableProjectTaskNewOrMove()) {
// if (((ContentViewActivity)mContext).isDirector()) {
// ABookAlertDialog dialog = AlertDialogUtil.createAlertDialog(getContext(), " ", getResources().getString(R.string.msg_task_doubletap_failed));
// dialog.setPositiveButton(R.string.ok, null);
// dialog.show();
// }
// return true;
// }
final float x = e.getX();
final float y = e.getY();
......@@ -857,14 +880,14 @@ public class ZoomRelativeLayout extends RelativeLayout {
float pdfY = pdfMatrix[Matrix.MTRANS_Y]/2;
// If left-out or right-out of PDF
if ((x-(margin.left+pdfX)) < 0 || (((margin.left+pdfX)+scaledWidth)-x)<0) {
return true;
}
// If top-out or bottom-out of PDF
if ((y-(margin.top+pdfY)) < 0 || (((margin.top+pdfY)+scaledHeight)-y)<0) {
return true;
}
// if ((x-(margin.left+pdfX)) < 0 || (((margin.left+pdfX)+scaledWidth)-x)<0) {
// return true;
// }
//
// // If top-out or bottom-out of PDF
// if ((y-(margin.top+pdfY)) < 0 || (((margin.top+pdfY)+scaledHeight)-y)<0) {
// return true;
// }
Point pointPdf = convertToAuthoringPoint(x, y);
......@@ -918,14 +941,9 @@ public class ZoomRelativeLayout extends RelativeLayout {
};
public boolean isEnableProjectTaskNewOrMove() {
return mScaleFactor == 1.0f && ((ContentViewActivity)mContext).isDirector();
//return !mScaleDetector.isInProgress() && mPageScrollView.isMemocheck();
return ((ContentViewActivity)mContext).isDirector();
}
public boolean isEnableProjectTaskClickOrMove() {
return mScaleFactor == 1.0f;
}
public boolean isZooming() {
return mScaleFactor > 1.0f;
}
......
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