Commit ff95d636 by Lee Jaebin

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

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