Commit b112ebc7 by Lee Jaebin

MRレビュー後、修正

parent 0c3fb0ba
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
android:background="@color/transparent"> android:background="@color/transparent">
<ImageButton <ImageButton
android:id="@+id/btn_pin" android:id="@+id/btn_pin_toggle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="2px" android:layout_margin="2px"
......
...@@ -264,7 +264,8 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -264,7 +264,8 @@ 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 btnChangeIcon; // ピンと作業コードの切替ボタン
protected ImageButton btnPinToggleIcon;
protected ImageButton btnHideTaskDirectBtn; protected ImageButton btnHideTaskDirectBtn;
protected ImageButton btnScaleZoomPlus; protected ImageButton btnScaleZoomPlus;
protected ImageButton btnScaleZoom03; protected ImageButton btnScaleZoom03;
...@@ -5034,8 +5035,9 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5034,8 +5035,9 @@ public class ContentViewActivity extends ABVContentViewActivity {
mScaleZoomLayout.setVisibility(View.VISIBLE); mScaleZoomLayout.setVisibility(View.VISIBLE);
mMainLayout.addView(mScaleZoomLayout, params); mMainLayout.addView(mScaleZoomLayout, params);
btnChangeIcon = (ImageButton) mScaleZoomLayout.findViewById(id.btn_pin); // ピンと作業コードの切替ボタン
btnChangeIcon.setOnClickListener(new View.OnClickListener() { btnPinToggleIcon = (ImageButton) mScaleZoomLayout.findViewById(id.btn_pin_toggle);
btnPinToggleIcon.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
mShowPinFlg = !mShowPinFlg; mShowPinFlg = !mShowPinFlg;
...@@ -5043,7 +5045,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5043,7 +5045,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
} }
}); });
btnChangeIcon.setVisibility(View.VISIBLE); btnPinToggleIcon.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
...@@ -5096,12 +5098,11 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5096,12 +5098,11 @@ public class ContentViewActivity extends ABVContentViewActivity {
mMainLayout.addView(projectTaskLayout); mMainLayout.addView(projectTaskLayout);
List<ProjectTaskDto> tasks = mTaskHotspotJSON.getPageTasks(pageNumber); List<ProjectTaskDto> tasks = mTaskHotspotJSON.getPageTasks(pageNumber);
projectTaskLayout.addAllProjectTaskIcon(this, rootLayout, tasks); projectTaskLayout.addAllProjectTaskIcon(rootLayout, tasks);
//画面回転の時 //画面回転の時
if (configChangedFlg && !isNormalSize()) { if (configChangedFlg && !isNormalSize()) {
projectTaskLayout.currentLayout = rootLayout; projectTaskLayout.currentLayout = rootLayout;
//setProjectCurrentLayout(mCurrentPageNumber);
RelativeLayout.LayoutParams params; RelativeLayout.LayoutParams params;
DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
int halfWidth = (int) (displayMetrics.density * ProjectTaskLayout.HALF_WIDTH); int halfWidth = (int) (displayMetrics.density * ProjectTaskLayout.HALF_WIDTH);
...@@ -5120,7 +5121,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5120,7 +5121,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
public void showProjectTaskLayout(ZoomRelativeLayout layout, ProjectTaskDto projectTaskDto, float clickX) { public void showProjectTaskLayout(ZoomRelativeLayout layout, ProjectTaskDto projectTaskDto, float clickX) {
//setCurrentProjectTask(layout, currentTaskDto); //setCurrentProjectTask(layout, currentTaskDto);
projectTaskLayout.showTaskForm(this, layout, mXWalkOpenType, projectTaskDto, isNormalSize(), clickX); projectTaskLayout.showTaskForm(layout, mXWalkOpenType, projectTaskDto, isNormalSize(), clickX);
isOpenedProjectTask = true; isOpenedProjectTask = true;
} }
...@@ -5141,7 +5142,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5141,7 +5142,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
projectTaskLayout.setIconStatus(taskKey, true); projectTaskLayout.setIconStatus(taskKey, true);
projectTaskLayout.currentTaskDto.taskKey = taskKey; projectTaskLayout.currentTaskDto.taskKey = taskKey;
projectTaskLayout.currentTaskDto.taskCode = taskCode; projectTaskLayout.currentTaskDto.taskCode = taskCode;
projectTaskLayout.addProjectTaskIcon(this, projectTaskLayout.currentLayout, projectTaskLayout.currentTaskDto, mShowPinFlg); projectTaskLayout.addProjectTaskIcon(projectTaskLayout.currentLayout, projectTaskLayout.currentTaskDto);
//hideProjectTaskLayout(); //hideProjectTaskLayout();
break; break;
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS: case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
...@@ -5207,24 +5208,21 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5207,24 +5208,21 @@ public class ContentViewActivity extends ABVContentViewActivity {
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 = zoomRelativeLayout.getChildCount() - 1; j >= 0; j--) {
for (int j = 0; j < zoomRelativeLayout.getChildCount(); j++) { View view = zoomRelativeLayout.getChildAt(j);
View view = zoomRelativeLayout.getChildAt(j); if (view instanceof ActionProjectTaskCode) {
if (view instanceof ActionProjectTaskCode) { ((ActionProjectTaskCode) view).stopAnimation();
((ActionProjectTaskCode)view).stopAnimation(); } else if (view instanceof ActionProjectTaskPin) {
// 削除対象のビューをリストViewに追加する ((ActionProjectTaskPin) view).stopAnimation();
deleteViewList.add(view);
} else if (view instanceof ActionProjectTaskPin) {
((ActionProjectTaskPin)view).stopAnimation();
// 削除対象のビューをリストViewに追加する
deleteViewList.add(view);
} }
}
for (View view : deleteViewList) { if (view instanceof ActionProjectTaskCode || view instanceof ActionProjectTaskPin) {
zoomRelativeLayout.removeView(view); // ピン、作業コードのビューを削除
} zoomRelativeLayout.removeView(view);
List<ProjectTaskDto> tasks = mTaskHotspotJSON.getPageTasks(i); }
projectTaskLayout.addAllProjectTaskIcon(this, zoomRelativeLayout, tasks); }
List<ProjectTaskDto> tasks = mTaskHotspotJSON.getPageTasks(i);
projectTaskLayout.addAllProjectTaskIcon(zoomRelativeLayout, tasks);
} }
} }
......
...@@ -26,7 +26,7 @@ public class ActionProjectTaskCode extends TextView { ...@@ -26,7 +26,7 @@ public class ActionProjectTaskCode extends TextView {
private Context mContext; private Context mContext;
public ProjectTaskDto mProjectTaskDto; public ProjectTaskDto mProjectTaskDto;
public ActionProjectTaskCode(final Context context, final ProjectTaskDto dto) { public ActionProjectTaskCode(Context context, ProjectTaskDto dto) {
super(context); super(context);
mContext = context; mContext = context;
mProjectTaskDto = dto; mProjectTaskDto = dto;
......
...@@ -164,17 +164,16 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -164,17 +164,16 @@ public class ProjectTaskLayout extends RelativeLayout {
}); });
} }
public void addProjectTaskIcon(final Context context, final ZoomRelativeLayout rootLayout, final ProjectTaskDto dto, boolean isShowPin) { public void addProjectTaskIcon(final ZoomRelativeLayout rootLayout, final ProjectTaskDto dto) {
mContext = (ContentViewActivity)context;
RelativeLayout.LayoutParams params; RelativeLayout.LayoutParams params;
final float density = context.getResources().getDisplayMetrics().density; final float density = mContext.getResources().getDisplayMetrics().density;
View taskView; View taskView;
int width; int width;
int height; int height;
if(dto.taskCode == null || dto.taskCode.isEmpty()) { if(dto.taskCode == null || dto.taskCode.isEmpty()) {
// ホットスポットアイコンで表示 // ホットスポットアイコンで表示
Logger.d(TAG, String.format("[ActionProjectTaskIcon] : taskCode=%s, dto.pdfX:%f, dto.pdfY=%f", dto.taskCode, dto.pdfX, dto.pdfY)); Logger.d(TAG, String.format("[ActionProjectTaskIcon] : taskCode=%s, dto.pdfX:%f, dto.pdfY=%f", dto.taskCode, dto.pdfX, dto.pdfY));
final ActionProjectTaskIcon taskIcon = new ActionProjectTaskIcon(context); final ActionProjectTaskIcon taskIcon = new ActionProjectTaskIcon(mContext);
taskIcon.startBlinkAnimation(); taskIcon.startBlinkAnimation();
taskIcon.taskKey = dto.taskKey; taskIcon.taskKey = dto.taskKey;
...@@ -191,9 +190,9 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -191,9 +190,9 @@ public class ProjectTaskLayout extends RelativeLayout {
taskView = taskIcon; taskView = taskIcon;
} else { } else {
final PointF pointView = rootLayout.convertToViewPoint(dto.pdfX, dto.pdfY); final PointF pointView = rootLayout.convertToViewPoint(dto.pdfX, dto.pdfY);
if (isShowPin) { if (mContext.mShowPinFlg) {
// ピンで表示 // ピンで表示
final ActionProjectTaskPin taskPin = new ActionProjectTaskPin(context, dto); final ActionProjectTaskPin taskPin = new ActionProjectTaskPin(mContext, dto);
taskPin.taskKey = dto.taskKey; taskPin.taskKey = dto.taskKey;
if (dto.isFinished) { if (dto.isFinished) {
width = (int) (PIN_FINISHED_ICON_WIDTH * density); width = (int) (PIN_FINISHED_ICON_WIDTH * density);
...@@ -218,7 +217,7 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -218,7 +217,7 @@ public class ProjectTaskLayout extends RelativeLayout {
taskView = taskPin; taskView = taskPin;
} else { } else {
// 作業コードで表示 // 作業コードで表示
final ActionProjectTaskCode taskCode = new ActionProjectTaskCode(context, dto); final ActionProjectTaskCode taskCode = new ActionProjectTaskCode(mContext, dto);
//taskCode.startBlinkAnimation(); //taskCode.startBlinkAnimation();
taskCode.taskKey = dto.taskKey; taskCode.taskKey = dto.taskKey;
...@@ -259,7 +258,7 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -259,7 +258,7 @@ public class ProjectTaskLayout extends RelativeLayout {
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);
((ContentViewActivity) context).setCurrentProjectTask(dto); mContext.setCurrentProjectTask(dto);
} }
//rootLayout.invalidate(); //rootLayout.invalidate();
return true; return true;
...@@ -271,17 +270,17 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -271,17 +270,17 @@ 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()) { if (!mContext.getOpenedProjestTask()) {
((ContentViewActivity)context).showProjectTaskLayout(rootLayout, dto, view.getX()); mContext.showProjectTaskLayout(rootLayout, dto, view.getX());
} }
} }
}); });
} }
public void addAllProjectTaskIcon(Context context, final ZoomRelativeLayout rootLayout, final List<ProjectTaskDto> dto) { public void addAllProjectTaskIcon(final ZoomRelativeLayout rootLayout, final List<ProjectTaskDto> dto) {
for (ProjectTaskDto task : dto) { for (ProjectTaskDto task : dto) {
task.isFinished = isTaskFinished(task.taskKey); task.isFinished = isTaskFinished(task.taskKey);
addProjectTaskIcon(context, rootLayout, task, ((ContentViewActivity)context).mShowPinFlg); addProjectTaskIcon(rootLayout, task);
} }
} }
...@@ -317,9 +316,9 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -317,9 +316,9 @@ public class ProjectTaskLayout extends RelativeLayout {
}); });
} }
public void showTaskForm(final Context context, ZoomRelativeLayout layout, int mXWalkOpenType, ProjectTaskDto projectTaskDto, boolean isNormalSize, float clickX) { public void showTaskForm(ZoomRelativeLayout layout, int mXWalkOpenType, ProjectTaskDto projectTaskDto, boolean isNormalSize, float clickX) {
if (projectTaskDto.taskKey.equals(TEMP_TASK_KEY)) { if (projectTaskDto.taskKey.equals(TEMP_TASK_KEY)) {
addProjectTaskIcon(context, layout, projectTaskDto, ((ContentViewActivity)context).mShowPinFlg); addProjectTaskIcon(layout, projectTaskDto);
setTaskFormPosition(clickX, isNormalSize); setTaskFormPosition(clickX, isNormalSize);
} }
...@@ -442,7 +441,7 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -442,7 +441,7 @@ public class ProjectTaskLayout extends RelativeLayout {
if (currentTaskDto != null && !StringUtil.isNullOrEmpty(currentTaskDto.taskKey)) { if (currentTaskDto != null && !StringUtil.isNullOrEmpty(currentTaskDto.taskKey)) {
if (currentTaskDto.taskKey.equals(TEMP_TASK_KEY)) { if (currentTaskDto.taskKey.equals(TEMP_TASK_KEY)) {
addProjectTaskIcon(mContext, currentLayout, currentTaskDto, ((ContentViewActivity) mContext).mShowPinFlg); addProjectTaskIcon(currentLayout, currentTaskDto);
} else { } else {
if (mContext.getOpenedProjestTask()) { if (mContext.getOpenedProjestTask()) {
setTaskCodeBlinkAnimation(currentTaskDto.taskKey, true); setTaskCodeBlinkAnimation(currentTaskDto.taskKey, true);
...@@ -541,18 +540,6 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -541,18 +540,6 @@ public class ProjectTaskLayout extends RelativeLayout {
} }
} }
public PointF convertToAuthoringPoint(float x, float y) {
return currentLayout.convertToAuthoringPoint(x, y);
}
public static int getIconWidth() {
return ICON_WIDTH;
}
public static int getIconHeight() {
return ICON_HEIGHT;
}
public static String getTempTaskKey() { public static String getTempTaskKey() {
return TEMP_TASK_KEY; return TEMP_TASK_KEY;
} }
......
...@@ -92,8 +92,6 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -92,8 +92,6 @@ 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) {
View view = (View) event.getLocalState();
switch (event.getAction()) { switch (event.getAction()) {
case DragEvent.ACTION_DRAG_STARTED: case DragEvent.ACTION_DRAG_STARTED:
//理由不明、イベントが二回くる、二回目でgetX()だけがマイナス //理由不明、イベントが二回くる、二回目でgetX()だけがマイナス
...@@ -107,10 +105,11 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -107,10 +105,11 @@ public class ZoomRelativeLayout extends RelativeLayout {
case DragEvent.ACTION_DRAG_EXITED: case DragEvent.ACTION_DRAG_EXITED:
break; break;
case DragEvent.ACTION_DROP: case DragEvent.ACTION_DROP:
View view = (View) event.getLocalState();
float mX = event.getX(); float mX = event.getX();
float mY = event.getY(); float mY = event.getY();
// 作業コード、ピンの動きが上下左右10pxの差分がなければ、クリックイベントとして見做す。
if (Math.abs(mX - fX) < view.getWidth() / 2 && Math.abs(mY - fY) < view.getHeight() / 2) { if (Math.abs(mX - fX) < 10 && Math.abs(mY - fY) < 10) {
view.performClick(); view.performClick();
return true; return true;
} }
...@@ -143,7 +142,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -143,7 +142,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
// 作業のy座標をセット(作業アイコンがピンで且つ、PDF範囲を超えたフラグ(isOutTranslation)がtrueの場合、(mY - アイコンの縦サイズ)で縦をセットする) // 作業のy座標をセット(作業アイコンがピンで且つ、PDF範囲を超えたフラグ(isOutTranslation)がtrueの場合、(mY - アイコンの縦サイズ)で縦をセットする)
view.setTranslationY(mY - (isOutTranslation && view instanceof ActionProjectTaskPin ? view.getHeight() : view.getHeight() / 2)); view.setTranslationY(mY - (isOutTranslation && view instanceof ActionProjectTaskPin ? view.getHeight() : view.getHeight() / 2));
// タップした座標をPDF用の座標に変換する // タップした座標をPDF用の座標に変換する
PointF pdfPoint = tapConvertToAuthoringPoint(mX, view instanceof ActionProjectTaskPin && !isOutTranslation ? mY + view.getHeight() / 2 : mY); PointF pdfPoint = convertToTapPoint(mX, view instanceof ActionProjectTaskPin && !isOutTranslation ? mY + view.getHeight() / 2 : mY);
// 座標を更新する // 座標を更新する
((ContentViewActivity) mContext).updateProjectTaskPosition(pdfPoint.x, pdfPoint.y); ((ContentViewActivity) mContext).updateProjectTaskPosition(pdfPoint.x, pdfPoint.y);
...@@ -356,7 +355,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -356,7 +355,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
*/ */
private void setTaskTranslationCode(ActionProjectTaskCode view) { private void setTaskTranslationCode(ActionProjectTaskCode view) {
ProjectTaskDto dto = view.mProjectTaskDto; ProjectTaskDto dto = view.mProjectTaskDto;
PointF point = convertToAuthoringPoint(dto.pdfX, dto.pdfY); PointF point = convertToScalePoint(dto.pdfX, dto.pdfY);
view.setTranslationX(point.x - (view.getWidth() / 2)); view.setTranslationX(point.x - (view.getWidth() / 2));
view.setTranslationY(point.y - (view.getHeight() / 2)); view.setTranslationY(point.y - (view.getHeight() / 2));
} }
...@@ -367,7 +366,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -367,7 +366,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
*/ */
private void setTaskTranslationPin(ActionProjectTaskPin view) { private void setTaskTranslationPin(ActionProjectTaskPin view) {
ProjectTaskDto dto = view.mProjectTaskDto; ProjectTaskDto dto = view.mProjectTaskDto;
PointF point = convertToAuthoringPoint(dto.pdfX, dto.pdfY); PointF point = convertToScalePoint(dto.pdfX, dto.pdfY);
view.setTranslationX(point.x - (view.getWidth() / 2)); view.setTranslationX(point.x - (view.getWidth() / 2));
view.setTranslationY(point.y - view.getHeight()); view.setTranslationY(point.y - view.getHeight());
} }
...@@ -645,12 +644,12 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -645,12 +644,12 @@ public class ZoomRelativeLayout extends RelativeLayout {
} }
/** /**
* タップのx,y座標をPDFに合わせて変換 * ドロップ&ドラッグ・ダブルタップ時のx,y座標をPDFに合わせて変換
* @param x * @param x
* @param y * @param y
* @return * @return
*/ */
public PointF tapConvertToAuthoringPoint(float x, float y) { public PointF convertToTapPoint(float x, float y) {
float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix); float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
float scaleX = (float)mAuthoringPageSize.width / getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]); float scaleX = (float)mAuthoringPageSize.width / getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]);
...@@ -662,12 +661,12 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -662,12 +661,12 @@ public class ZoomRelativeLayout extends RelativeLayout {
} }
/** /**
* オブジェクトの位置調整 * 作業の位置調整
* @param x * @param x
* @param y * @param y
* @return * @return
*/ */
public PointF convertToAuthoringPoint(float x, float y) { public PointF convertToScalePoint(float x, float y) {
float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix); float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
float scaleX = getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]) / (float)mAuthoringPageSize.width; float scaleX = getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]) / (float)mAuthoringPageSize.width;
...@@ -686,20 +685,20 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -686,20 +685,20 @@ public class ZoomRelativeLayout extends RelativeLayout {
*/ */
public PointF convertToViewPoint(float x, float y) { public PointF convertToViewPoint(float x, float y) {
Logger.d(TAG, "convertToViewPoint:x=%s, y=%s", x, y); Logger.d(TAG, "convertToViewPoint:x=%s, y=%s", x, y);
// 初期表示時、getPageView()がnullの場合があるので、初期情報を元にx, y座標を変換する
if (getPageView() != null) { if (getPageView() != null) {
return convertToAuthoringPoint(x, y); return convertToScalePoint(x, y);
} else {
// 初期表示の場合は、PDFPageビューが存在しないので、初期表示のみ以下の処理で行われる
// オーサリング基準座標から変換PDF基準座標に変換
float scaleX = getDefaultPDFWidth() / (float)mAuthoringPageSize.width;
float scaleY = getDefaultPDFHeight() / (float)mAuthoringPageSize.height;
// PDF座標からタッチ座標に変換
float viewX = (x * scaleX) + margin.left;
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);
return new PointF(viewX, viewY);
} }
// 初期表示の場合は、PDFPageビューが存在しないので、初期表示のみ以下の処理で行われる
// オーサリング基準座標から変換PDF基準座標に変換
float scaleX = getDefaultPDFWidth() / (float) mAuthoringPageSize.width;
float scaleY = getDefaultPDFHeight() / (float) mAuthoringPageSize.height;
// PDF座標からタッチ座標に変換
float viewX = (x * scaleX) + margin.left;
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);
return new PointF(viewX, viewY);
} }
public Point convertToMemoViewPoint(float x, float y) { public Point convertToMemoViewPoint(float x, float y) {
...@@ -731,7 +730,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -731,7 +730,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
// 変換PDF基準座標からオーサリング基準座標に変換 // 変換PDF基準座標からオーサリング基準座標に変換
float scale = Math.min((float)mAuthoringPageSize.width / getDefaultPDFWidth(), (float)mAuthoringPageSize.height / getDefaultPDFHeight()); 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 * 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)); Logger.d(TAG, "convertToScalePoint:scale=%s scaledWidth=%s, scaledHeight=%s authX=%s, auyhY=%s", scale, getDefaultPDFWidth(), getDefaultPDFHeight(), (pdfX * scale), (pdfY * scale));
return point; return point;
} }
...@@ -775,8 +774,8 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -775,8 +774,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
} }
dto.contentId = mContentDto.contentId; dto.contentId = mContentDto.contentId;
dto.pageNum = mPageNumber; dto.pageNum = mPageNumber;
dto.axisX = (int) convertedPoint.x; dto.axisX = convertedPoint.x;
dto.axisY = (int) convertedPoint.y; dto.axisY = convertedPoint.y;
dto.viewX = (int)x; dto.viewX = (int)x;
dto.viewY = (int)y; dto.viewY = (int)y;
dto.copyFlg = false; dto.copyFlg = false;
...@@ -814,8 +813,8 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -814,8 +813,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
} else { } else {
ContentMemoDto dto = new ContentMemoDto(); ContentMemoDto dto = new ContentMemoDto();
dto.axisX = (int) convertedPoint.x; dto.axisX = convertedPoint.x;
dto.axisY = (int) convertedPoint.y; dto.axisY = convertedPoint.y;
dto.viewX = (int)x; dto.viewX = (int)x;
dto.viewY = (int)y; dto.viewY = (int)y;
dto.pageNum = mPageNumber; dto.pageNum = mPageNumber;
...@@ -953,7 +952,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -953,7 +952,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
} }
// タップしたx, yをPDF用の座標に変換 // タップしたx, yをPDF用の座標に変換
PointF pointPdf = tapConvertToAuthoringPoint(x, y); PointF pointPdf = convertToTapPoint(x, y);
ProjectTaskDto dto = new ProjectTaskDto(); ProjectTaskDto dto = new ProjectTaskDto();
dto.projectId = ((ContentViewActivity) mContext).getProjectId(); dto.projectId = ((ContentViewActivity) mContext).getProjectId();
......
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