Commit ff95d636 by Lee Jaebin

#32576 作業指示ボタンの改善(ピン表示)バリデーション処理

parent a0a9c467
...@@ -19,8 +19,6 @@ import android.graphics.Color; ...@@ -19,8 +19,6 @@ import android.graphics.Color;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Path; import android.graphics.Path;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.RectF; import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
...@@ -73,10 +71,8 @@ import org.json.adf.JSONArray; ...@@ -73,10 +71,8 @@ import org.json.adf.JSONArray;
import org.json.adf.JSONException; import org.json.adf.JSONException;
import org.json.adf.JSONObject; import org.json.adf.JSONObject;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -117,11 +113,9 @@ import jp.agentec.abook.abv.bl.logic.EnqueteLogic; ...@@ -117,11 +113,9 @@ import jp.agentec.abook.abv.bl.logic.EnqueteLogic;
import jp.agentec.abook.abv.bl.websocket.MeetingManager; import jp.agentec.abook.abv.bl.websocket.MeetingManager;
import jp.agentec.abook.abv.cl.environment.DeviceInfo; import jp.agentec.abook.abv.cl.environment.DeviceInfo;
import jp.agentec.abook.abv.cl.helper.ContentMarkingFileHelper; import jp.agentec.abook.abv.cl.helper.ContentMarkingFileHelper;
import jp.agentec.abook.abv.cl.util.AndroidStringUtil;
import jp.agentec.abook.abv.cl.util.BitmapUtil; import jp.agentec.abook.abv.cl.util.BitmapUtil;
import jp.agentec.abook.abv.cl.util.ContentLogUtil; import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.PDFFileProvider;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.launcher.android.R.id; import jp.agentec.abook.abv.launcher.android.R.id;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity; import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
...@@ -141,8 +135,6 @@ import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow; ...@@ -141,8 +135,6 @@ import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.common.vo.Size; import jp.agentec.abook.abv.ui.common.vo.Size;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper; import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper.LinkContentStatus;
import jp.agentec.abook.abv.ui.Interface.MovePageInterface; import jp.agentec.abook.abv.ui.Interface.MovePageInterface;
import jp.agentec.abook.abv.ui.Interface.UnAuthorizedContentListener; import jp.agentec.abook.abv.ui.Interface.UnAuthorizedContentListener;
import jp.agentec.abook.abv.ui.viewer.adapter.ContentBookmarkAdapter; import jp.agentec.abook.abv.ui.viewer.adapter.ContentBookmarkAdapter;
...@@ -177,8 +169,6 @@ import jp.agentec.abook.abv.ui.viewer.view.action.TapMediaPlayer; ...@@ -177,8 +169,6 @@ import jp.agentec.abook.abv.ui.viewer.view.action.TapMediaPlayer;
import jp.agentec.abook.abv.ui.viewer.view.action.VideoMountAction; import jp.agentec.abook.abv.ui.viewer.view.action.VideoMountAction;
import jp.agentec.adf.net.http.HttpDownloadSimpleNotification; import jp.agentec.adf.net.http.HttpDownloadSimpleNotification;
import jp.agentec.adf.net.http.HttpDownloadState; import jp.agentec.adf.net.http.HttpDownloadState;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.DateTimeUtil.DateUnit;
import jp.agentec.adf.util.FileUtil; import jp.agentec.adf.util.FileUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
...@@ -274,7 +264,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -274,7 +264,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
private LinearLayout mScaleZoomLayout; private LinearLayout mScaleZoomLayout;
private boolean isOpenedProjectTask = false; private boolean isOpenedProjectTask = false;
private TaskHotspotJSON mTaskHotspotJSON; private TaskHotspotJSON mTaskHotspotJSON;
protected ImageButton btnChangePin; protected ImageButton btnChangeIcon;
protected ImageButton btnHideTaskDirectBtn; protected ImageButton btnHideTaskDirectBtn;
protected ImageButton btnScaleZoomPlus; protected ImageButton btnScaleZoomPlus;
protected ImageButton btnScaleZoom03; protected ImageButton btnScaleZoom03;
...@@ -5033,16 +5023,16 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5033,16 +5023,16 @@ public class ContentViewActivity extends ABVContentViewActivity {
mScaleZoomLayout.setVisibility(View.VISIBLE); mScaleZoomLayout.setVisibility(View.VISIBLE);
mMainLayout.addView(mScaleZoomLayout, params); mMainLayout.addView(mScaleZoomLayout, params);
btnChangePin = (ImageButton) mScaleZoomLayout.findViewById(id.btn_pin); btnChangeIcon = (ImageButton) mScaleZoomLayout.findViewById(id.btn_pin);
btnChangePin.setOnClickListener(new View.OnClickListener() { btnChangeIcon.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
mShowPinFlg = !mShowPinFlg; mShowPinFlg = !mShowPinFlg;
changeTaskPinOrCode(mShowPinFlg); changeTaskMainIcon(mShowPinFlg);
} }
}); });
btnChangePin.setVisibility(View.VISIBLE); btnChangeIcon.setVisibility(View.VISIBLE);
btnHideTaskDirectBtn = (ImageButton) mScaleZoomLayout.findViewById(R.id.btn_hide_task_direct); btnHideTaskDirectBtn = (ImageButton) mScaleZoomLayout.findViewById(R.id.btn_hide_task_direct);
btnHideTaskDirectBtn.setOnTouchListener(new View.OnTouchListener() { btnHideTaskDirectBtn.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
...@@ -5198,16 +5188,22 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5198,16 +5188,22 @@ public class ContentViewActivity extends ABVContentViewActivity {
* 作業のアイコンをピン・作業コードに切替 * 作業のアイコンをピン・作業コードに切替
* @param isShowPin * @param isShowPin
*/ */
public void changeTaskPinOrCode(boolean isShowPin) { public void changeTaskMainIcon(boolean isShowPin) {
// mShowPageLayoutに存在するzoomLayoutの子ビューであるActionProjectTaskPin、ActionProjectTaskCodeを全て削除して、新たにアイコンを再描画する
for (int i = 0; i < mShowPageLayout.size(); i++) { for (int i = 0; i < mShowPageLayout.size(); i++) {
int key = mShowPageLayout.keyAt(i); int key = mShowPageLayout.keyAt(i);
ZoomRelativeLayout zoomRelativeLayout = mShowPageLayout.get(key); ZoomRelativeLayout zoomRelativeLayout = mShowPageLayout.get(key);
List<View> deleteViewList = new ArrayList<View>();
for (int j = 0; j < zoomRelativeLayout.getChildCount(); j++) { for (int j = 0; j < zoomRelativeLayout.getChildCount(); j++) {
View view = zoomRelativeLayout.getChildAt(j); View view = zoomRelativeLayout.getChildAt(j);
if (view instanceof ActionProjectTaskCode || view instanceof ActionProjectTaskPin) { if (view instanceof ActionProjectTaskCode || view instanceof ActionProjectTaskPin) {
zoomRelativeLayout.removeView(view); // 削除対象のビューをリストViewに追加する
deleteViewList.add(view);
} }
} }
for (View view : deleteViewList) {
zoomRelativeLayout.removeView(view);
}
List<ProjectTaskDto> tasks = mTaskHotspotJSON.getPageTasks(i); List<ProjectTaskDto> tasks = mTaskHotspotJSON.getPageTasks(i);
projectTaskLayout.addAllProjectTaskIcon(this, zoomRelativeLayout, tasks); projectTaskLayout.addAllProjectTaskIcon(this, zoomRelativeLayout, tasks);
} }
...@@ -5271,6 +5267,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5271,6 +5267,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
Matrix matrix = new Matrix(); Matrix matrix = new Matrix();
matrix.postScale(scaleFactor, scaleFactor, centerX, centerY); matrix.postScale(scaleFactor, scaleFactor, centerX, centerY);
zoomLayout.setZoomMatrix(matrix); zoomLayout.setZoomMatrix(matrix);
zoomLayout.changeTaskChildView();
setToolbarVisable(false); setToolbarVisable(false);
mShowPageLayout.get(mCurrentPageNumber).setScaleFactorAndMatrix(scaleFactor); mShowPageLayout.get(mCurrentPageNumber).setScaleFactorAndMatrix(scaleFactor);
......
...@@ -37,8 +37,6 @@ public class ActionProjectTaskPin extends ImageView { ...@@ -37,8 +37,6 @@ public class ActionProjectTaskPin extends ImageView {
setImageResource(R.drawable.s_pin1); setImageResource(R.drawable.s_pin1);
} }
setBackgroundColor(Color.TRANSPARENT); setBackgroundColor(Color.TRANSPARENT);
setAdjustViewBounds(true);
setScaleType(ScaleType.FIT_START);
} }
public void stopAnimation() { public void stopAnimation() {
......
...@@ -4,7 +4,6 @@ import android.content.Context; ...@@ -4,7 +4,6 @@ import android.content.Context;
import android.content.res.Configuration; 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.PointF; import android.graphics.PointF;
import android.view.DragEvent; import android.view.DragEvent;
import android.view.GestureDetector; import android.view.GestureDetector;
...@@ -31,10 +30,7 @@ import jp.agentec.abook.abv.bl.dto.ProjectTaskDto; ...@@ -31,10 +30,7 @@ import jp.agentec.abook.abv.bl.dto.ProjectTaskDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic; import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.MemoLogic; import jp.agentec.abook.abv.bl.logic.MemoLogic;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.options.Options;
import jp.agentec.abook.abv.ui.common.constant.IFPDFConst; import jp.agentec.abook.abv.ui.common.constant.IFPDFConst;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.ClipboardUtil; import jp.agentec.abook.abv.ui.common.util.ClipboardUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow; import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.common.vo.Size; import jp.agentec.abook.abv.ui.common.vo.Size;
...@@ -95,73 +91,73 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -95,73 +91,73 @@ public class ZoomRelativeLayout extends RelativeLayout {
class MyDragListener implements OnDragListener { class MyDragListener implements OnDragListener {
@Override @Override
public boolean onDrag(View v, DragEvent event) { public boolean onDrag(View v, DragEvent event) {
switch (event.getAction()) { View view = (View) event.getLocalState();
case DragEvent.ACTION_DRAG_STARTED: if (view instanceof ActionProjectTaskCode || view instanceof ActionProjectTaskPin) {
//理由不明、イベントが二回くる、二回目でgetX()だけがマイナス switch (event.getAction()) {
if (event.getX() > 0) { case DragEvent.ACTION_DRAG_STARTED:
fX = event.getX(); //理由不明、イベントが二回くる、二回目でgetX()だけがマイナス
fY = event.getY(); if (event.getX() > 0) {
} fX = event.getX();
break; fY = event.getY();
case DragEvent.ACTION_DRAG_ENTERED: }
break; break;
case DragEvent.ACTION_DRAG_EXITED: case DragEvent.ACTION_DRAG_ENTERED:
break; break;
case DragEvent.ACTION_DROP: case DragEvent.ACTION_DRAG_EXITED:
View view = (View) event.getLocalState(); break;
float mX = event.getX(); case DragEvent.ACTION_DROP:
float mY = event.getY(); float mX = event.getX();
int width = view.getWidth(); float mY = event.getY();
int height = view.getHeight();
if (Math.abs(mX - fX) < view.getWidth() / 2 && Math.abs(mY - fY) < view.getHeight() / 2) {
if (Math.abs(mX - fX) < ProjectTaskLayout.getIconWidth() / 2 && Math.abs(mY - fY) < ProjectTaskLayout.getIconHeight() / 2) { view.performClick();
view.performClick(); return true;
return true; }
} float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
float scaledWidth = getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]);
float[] pdfMatrix = getMatrixValue(imgMatrix); float scaledHeight = getScaledPDFHeight(pdfMatrix[Matrix.MSCALE_Y]);
float scaledWidth = getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]); float pdfX = pdfMatrix[Matrix.MTRANS_X];
float scaledHeight = getScaledPDFHeight(pdfMatrix[Matrix.MSCALE_Y]); float pdfY = pdfMatrix[Matrix.MTRANS_Y];
float pdfX = pdfMatrix[Matrix.MTRANS_X]/2;
float pdfY = pdfMatrix[Matrix.MTRANS_Y]/2; // If left-out or right-out of PDF
if ((mX - pdfX) < 0) {
// If left-out or right-out of PDF mX = pdfX;
if ((mX-(margin.left+pdfX)) < 0) { } else if (((pdfX + scaledWidth) - mX) < 0) {
mX = margin.left; mX = pdfX + scaledWidth;
} else if ((((margin.left+pdfX)+scaledWidth)-mX)<0) { }
mX = margin.left + getDefaultPDFWidth(); // Yの座標がPDF範囲を超えたか判定フラグ
} boolean isOutTranslation = false;
// If top-out or bottom-out of PDF
// If top-out or bottom-out of PDF // PDFの端上の基準値をピンとコードで分ける
if ((mY-(margin.top+pdfY)) < 0) { float checkTopY = (view instanceof ActionProjectTaskPin ? (mY + view.getHeight() / 2) : mY);
mY = margin.top; if (checkTopY - pdfY < 0) {
} else if ((((margin.top+pdfY)+scaledHeight)-mY)<0) { isOutTranslation = true;
mY = margin.top + getDefaultPDFHeight(); mY = pdfY;
} } else if (((pdfY + scaledHeight) - mY) < 0) {
isOutTranslation = true;
// ViewGroup.MarginLayoutParams marginDrop = (ViewGroup.MarginLayoutParams)view.getLayoutParams(); mY = pdfY + scaledHeight;
// marginDrop.leftMargin = (int) (mX - width / 2); }
// marginDrop.topMargin = (int) (mY - height / 2); // 作業のx座標をセット
// view.setLayoutParams(marginDrop); view.setTranslationX(mX - view.getWidth() / 2);
view.setTranslationX(mX - width / 2); // 作業のy座標をセット(作業アイコンがピンで且つ、PDF範囲を超えたフラグ(isOutTranslation)がtrueの場合、(mY - アイコンの縦サイズ)で縦をセットする)
view.setTranslationY(mY - height / 2); view.setTranslationY(mY - (isOutTranslation && view instanceof ActionProjectTaskPin ? view.getHeight() : view.getHeight() / 2));
// ピンの場合、Yをピンの先に合わせるため、mY + height / 2で座標をセットする // タップした座標をPDF用の座標に変換する
PointF pdfPoint = tapConvertToAuthoringPoint(mX, ((ContentViewActivity) mContext).mShowPinFlg ? mY + height / 2 : mY); PointF pdfPoint = tapConvertToAuthoringPoint(mX, view instanceof ActionProjectTaskPin && !isOutTranslation ? mY + view.getHeight() / 2 : mY);
((ContentViewActivity) mContext).updateProjectTaskPosition(pdfPoint.x, pdfPoint.y);
// 座標を更新する
if (view instanceof ActionProjectTaskCode || view instanceof ActionProjectTaskPin) { ((ContentViewActivity) mContext).updateProjectTaskPosition(pdfPoint.x, pdfPoint.y);
((ContentViewActivity) mContext).updateProjectTaskPosition(); ((ContentViewActivity) mContext).updateProjectTaskPosition();
}
if (view.getVisibility() == View.INVISIBLE) {
if (view.getVisibility() == View.INVISIBLE) { view.setVisibility(View.VISIBLE);
view.setVisibility(View.VISIBLE); }
}
break; break;
case DragEvent.ACTION_DRAG_ENDED: case DragEvent.ACTION_DRAG_ENDED:
default: default:
break; break;
} }
}
return true; return true;
} }
} }
...@@ -336,7 +332,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -336,7 +332,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
/** /**
* 作業の座標をすべて調整する * 作業の座標をすべて調整する
*/ */
private void changeTaskChildView() { public void changeTaskChildView() {
if (getChildCount() > 0) { if (getChildCount() > 0) {
for (int i = 0; i < getChildCount(); i++) { for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i); View view = getChildAt(i);
...@@ -495,7 +491,8 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -495,7 +491,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
imgMatrix.postScale(detector.getScaleFactor(), detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY()); imgMatrix.postScale(detector.getScaleFactor(), detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY());
mScaleFactor = matrixScale; mScaleFactor = matrixScale;
invalidate(); invalidate();
}// 作業の座標をすべて調整する }
// 作業の座標をすべて調整する
changeTaskChildView(); changeTaskChildView();
Logger.v(TAG, "SimpleOnScaleGestureListener:[onScale]:scaleFactor=%s", mScaleFactor); Logger.v(TAG, "SimpleOnScaleGestureListener:[onScale]:scaleFactor=%s", mScaleFactor);
...@@ -523,10 +520,6 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -523,10 +520,6 @@ public class ZoomRelativeLayout extends RelativeLayout {
@Override @Override
public void onScaleEnd(ScaleGestureDetector detector) { public void onScaleEnd(ScaleGestureDetector detector) {
fixPosition(); fixPosition();
// if (mScaleFactor == 1.0f) {
// // 通常はonTouchUpのMotionEvent.ACTION_UPからCallする
// callZoomAction(imgMatrix);
// }
mPageScrollView.requestDisallowInterceptTouchEvent(false); mPageScrollView.requestDisallowInterceptTouchEvent(false);
if (isProjectPdf) { if (isProjectPdf) {
...@@ -535,12 +528,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -535,12 +528,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
} }
}; };
// private void callZoomAction(Matrix matrix) {
// float[] matrixValue = getMatrixValue(matrix);
// ((ContentViewActivity)mContext).callZoomAction(matrixValue[Matrix.MTRANS_X], matrixValue[Matrix.MTRANS_Y], matrixValue[Matrix.MSCALE_X]);
// }
/** /**
* 指を離したあとの座標を補正する * 指を離したあとの座標を補正する
*/ */
...@@ -651,23 +639,6 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -651,23 +639,6 @@ public class ZoomRelativeLayout extends RelativeLayout {
} }
} }
// 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;
// }
/** /**
* タップのx,y座標をPDFに合わせて変換 * タップのx,y座標をPDFに合わせて変換
* @param x * @param x
...@@ -676,15 +647,11 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -676,15 +647,11 @@ public class ZoomRelativeLayout extends RelativeLayout {
*/ */
public PointF tapConvertToAuthoringPoint(float x, float y) { public PointF tapConvertToAuthoringPoint(float x, float y) {
float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix); float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
float pdfScale = pdfMatrix[0];
float matrixX = pdfMatrix[Matrix.MTRANS_X]; float scaleX = (float)mAuthoringPageSize.width / getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]);
float matrixY = pdfMatrix[Matrix.MTRANS_Y]; float scaleY = (float)mAuthoringPageSize.height / getScaledPDFHeight(pdfMatrix[Matrix.MSCALE_Y]);
float pdfX = (x * scaleX) - (pdfMatrix[Matrix.MTRANS_X] * scaleX);
float scaleX = (float)mAuthoringPageSize.width / getScaledPDFWidth(pdfScale); float pdfY = (y * scaleY) - (pdfMatrix[Matrix.MTRANS_Y] * scaleY);
float scaleY = (float)mAuthoringPageSize.height / getScaledPDFHeight(pdfScale);
float pdfX = (x * scaleX) - (matrixX * scaleX);
float pdfY = (y * scaleY) - (matrixY * scaleY);
return new PointF(pdfX, pdfY); return new PointF(pdfX, pdfY);
} }
...@@ -696,31 +663,35 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -696,31 +663,35 @@ public class ZoomRelativeLayout extends RelativeLayout {
* @return * @return
*/ */
public PointF convertToAuthoringPoint(float x, float y) { public PointF convertToAuthoringPoint(float x, float y) {
float[] testMatrix = getMatrixValue(getPageView().imgMatrix); float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
float matrixX = testMatrix[Matrix.MTRANS_X];
float matrixY = testMatrix[Matrix.MTRANS_Y];
float scale = Math.min(getScaledPDFWidth(mScaleFactor) / (float)mAuthoringPageSize.width, getScaledPDFHeight(mScaleFactor) / (float)mAuthoringPageSize.height);
float pdfX = (x * scale) + matrixX; float scaleX = getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]) / (float)mAuthoringPageSize.width;
float pdfY = (y * scale) + matrixY; float scaleY = getScaledPDFHeight(pdfMatrix[Matrix.MSCALE_Y]) / (float)mAuthoringPageSize.height;
float pdfX = (x * scaleX) + pdfMatrix[Matrix.MTRANS_X];
float pdfY = (y * scaleY) + pdfMatrix[Matrix.MTRANS_Y];
return new PointF(pdfX, pdfY); return new PointF(pdfX, pdfY);
} }
/**
* 作業の生成時、座標をPDFサイズによる変換処理
* @param x
* @param y
* @return
*/
public PointF convertToViewPoint(float x, float y) { public PointF convertToViewPoint(float x, float y) {
Logger.d(TAG, "convertToViewPoint:x=%s, y=%s", x, y);
if (getPageView() != null) { if (getPageView() != null) {
return convertToAuthoringPoint(x, y); return convertToAuthoringPoint(x, y);
} else { } else {
Logger.d(TAG, "convertToViewPoint:x=%s, y=%s", x, y); // 初期表示の場合は、PDFPageビューが存在しないので、初期表示のみ以下の処理で行われる
// オーサリング基準座標から変換PDF基準座標に変換 // オーサリング基準座標から変換PDF基準座標に変換
float scale = Math.min(getDefaultPDFWidth() / (float)mAuthoringPageSize.width, getDefaultPDFHeight() / (float)mAuthoringPageSize.height); float scaleX = getDefaultPDFWidth() / (float)mAuthoringPageSize.width;
float pdfX = x * scale; float scaleY = getDefaultPDFHeight() / (float)mAuthoringPageSize.height;
float pdfY = y * scale;
Logger.d(TAG, "convertToViewPoint:scale=%s scaledWidth=%s, scaledHeight=%s pdfX=%s, pdfY=%s", scale, getDefaultPDFWidth(), getDefaultPDFHeight(), pdfX, pdfY);
// PDF座標からタッチ座標に変換 // PDF座標からタッチ座標に変換
float viewX = pdfX + margin.left; float viewX = (x * scaleX) + margin.left;
float viewY = pdfY + margin.top; float viewY = (y * scaleY) + margin.top;
Logger.d(TAG, "convertToViewPoint:marginX=%s, marginY=%s, mPdfScale=%s viewX=%s, viewY=%s", margin.left, margin.top, mPdfScale, viewX, viewY); Logger.d(TAG, "convertToViewPoint:marginX=%s, marginY=%s, mPdfScale=%s viewX=%s, viewY=%s", margin.left, margin.top, mPdfScale, viewX, viewY);
return new PointF(viewX, viewY); return new PointF(viewX, viewY);
} }
...@@ -924,31 +895,26 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -924,31 +895,26 @@ public class ZoomRelativeLayout extends RelativeLayout {
return true; 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 x = e.getX();
final float y = e.getY(); final float y = e.getY();
// PDF画面外側をタッチしているかチェック float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
float[] pdfMatrix = getMatrixValue(imgMatrix); float scaledWidth = getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]);
float scaledWidth = getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]); float scaledHeight = getScaledPDFHeight(pdfMatrix[Matrix.MSCALE_Y]);
float scaledHeight = getScaledPDFHeight(pdfMatrix[Matrix.MSCALE_Y]); float pdfX = pdfMatrix[Matrix.MTRANS_X];
float pdfX = pdfMatrix[Matrix.MTRANS_X]/2; float pdfY = pdfMatrix[Matrix.MTRANS_Y];
float pdfY = pdfMatrix[Matrix.MTRANS_Y]/2;
// ダブルタップがPDF表示の横領域を超えた場合は、以下の処理を行わない
if ((x - pdfX) < 0 || ((pdfX + scaledWidth) - x) < 0) {
return true;
}
// If left-out or right-out of PDF // ダブルタップがPDF表示の縦領域を超えた場合は、以下の処理を行わない
Logger.i("heigth"); if ((y - pdfY) < 0 || ((pdfY + scaledHeight) - y) < 0) {
// if (getHeight()) { return true;
// }
// }
// タップしたx, yをPDF用の座標に変換
PointF pointPdf = tapConvertToAuthoringPoint(x, y); PointF pointPdf = tapConvertToAuthoringPoint(x, y);
ProjectTaskDto dto = new ProjectTaskDto(); ProjectTaskDto dto = new ProjectTaskDto();
...@@ -957,7 +923,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -957,7 +923,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
dto.pdfX = pointPdf.x; dto.pdfX = pointPdf.x;
dto.pdfY = pointPdf.y; dto.pdfY = pointPdf.y;
dto.pageNum = mPageNumber; dto.pageNum = mPageNumber;
//dto.contentId = mContentDto.contentId; // 作業登録画面の表示
((ContentViewActivity) mContext).showProjectTaskLayout(ZoomRelativeLayout.this, dto, x); ((ContentViewActivity) mContext).showProjectTaskLayout(ZoomRelativeLayout.this, dto, x);
} else { } else {
float[] matrixValue = getMatrixValue(imgMatrix); float[] matrixValue = getMatrixValue(imgMatrix);
......
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