Commit 0a489272 by Kim Jinsung

Merge branch 'feature/1.0.1_leej' into 'feature/1.0.1'

Feature/1.0.1 leej

See merge request !1
parents a2036236 b112ebc7
......@@ -316,7 +316,7 @@ public class ProjectLogic extends AbstractLogic {
if (!newValue.equals(taskDirectionsItemsDto.inputValue)) {
// 値が異なる場合のみ、更新する
taskDirectionsItemsDto.inputValue = newValue;
if (taskDirectionsItemsDto.inputValue.startsWith("q_1_")) {
if (taskDirectionsItemsDto.itemKey.startsWith("q_1_")) {
// 値が異なるため、作業コードの入力値を変更する
taskDto.taskCode = taskDirectionsItemsDto.inputValue;
}
......
......@@ -7,6 +7,16 @@
android:background="@color/transparent">
<ImageButton
android:id="@+id/btn_pin_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2px"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_hidden_show_directions_button"
android:visibility="visible"/>
<ImageButton
android:id="@+id/btn_hide_task_direct"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -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);
}
......@@ -775,11 +775,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
*/
protected void onActionProjectPdfWebView(Map<String, String> checkParam, ProjectTaskDto projectTaskDto) {}
/**
* Be override
*/
public Point convertToAuthoringPoint(float x, float y) { return new Point((int)x, (int)y); }
public void onClickShowHelpView(View v) {
int helpViewType = 0;
switch (mStatusCode) {
......
......@@ -19,7 +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.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
......@@ -72,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;
......@@ -116,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;
......@@ -140,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;
......@@ -156,6 +149,8 @@ import jp.agentec.abook.abv.ui.viewer.view.ABVMediaPlayer;
import jp.agentec.abook.abv.ui.viewer.view.Action3DImageView;
import jp.agentec.abook.abv.ui.viewer.view.ActionButton;
import jp.agentec.abook.abv.ui.viewer.view.ActionImageView;
import jp.agentec.abook.abv.ui.viewer.view.ActionProjectTaskCode;
import jp.agentec.abook.abv.ui.viewer.view.ActionProjectTaskPin;
import jp.agentec.abook.abv.ui.viewer.view.EnqueteLayout;
import jp.agentec.abook.abv.ui.viewer.view.EnqueteWebView;
import jp.agentec.abook.abv.ui.viewer.view.FullVideoView;
......@@ -174,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;
......@@ -271,6 +264,8 @@ public class ContentViewActivity extends ABVContentViewActivity {
private LinearLayout mScaleZoomLayout;
private boolean isOpenedProjectTask = false;
private TaskHotspotJSON mTaskHotspotJSON;
// ピンと作業コードの切替ボタン
protected ImageButton btnPinToggleIcon;
protected ImageButton btnHideTaskDirectBtn;
protected ImageButton btnScaleZoomPlus;
protected ImageButton btnScaleZoom03;
......@@ -328,6 +323,8 @@ public class ContentViewActivity extends ABVContentViewActivity {
private ProgressBar m_progress;
public ValueCallback<Uri[]> mUploadMessage;
public boolean mShowPinFlg = true;
/**
* スクロールステータス
......@@ -1824,14 +1821,16 @@ 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;
if (!isProjectPdf) {
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();
}
// 拡大中は拡大率を表示
int scale = (int) (mShowPageLayout.get(mCurrentPageNumber).getScaleFactor() * 100f);
Toast.makeText(getApplicationContext(), String.format("%d%%", scale), Toast.LENGTH_SHORT).show();
} else {
TranslateAnimation toolBarAnimation;
if (mToolBar.getVisibility() == View.GONE) {
......@@ -5004,11 +5003,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
projectTaskLayout.currentLayout = mShowPageLayout.get(currentPageNum);
}
@Override
public Point convertToAuthoringPoint(float x, float y) {
return projectTaskLayout.convertToAuthoringPoint(x, y);
}
// 作業のホットスポットJSONを取得
private void getTaskHotspotJSON() {
try {
......@@ -5041,7 +5035,17 @@ public class ContentViewActivity extends ABVContentViewActivity {
mScaleZoomLayout.setVisibility(View.VISIBLE);
mMainLayout.addView(mScaleZoomLayout, params);
// ピンと作業コードの切替ボタン
btnPinToggleIcon = (ImageButton) mScaleZoomLayout.findViewById(id.btn_pin_toggle);
btnPinToggleIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mShowPinFlg = !mShowPinFlg;
changeTaskMainIcon(mShowPinFlg);
}
});
btnPinToggleIcon.setVisibility(View.VISIBLE);
btnHideTaskDirectBtn = (ImageButton) mScaleZoomLayout.findViewById(R.id.btn_hide_task_direct);
btnHideTaskDirectBtn.setOnTouchListener(new View.OnTouchListener() {
@Override
......@@ -5094,12 +5098,11 @@ public class ContentViewActivity extends ABVContentViewActivity {
mMainLayout.addView(projectTaskLayout);
List<ProjectTaskDto> tasks = mTaskHotspotJSON.getPageTasks(pageNumber);
projectTaskLayout.addAllProjectTaskIcon(this, rootLayout, tasks);
projectTaskLayout.addAllProjectTaskIcon(rootLayout, tasks);
//画面回転の時
if (configChangedFlg && !isNormalSize()) {
projectTaskLayout.currentLayout = rootLayout;
//setProjectCurrentLayout(mCurrentPageNumber);
RelativeLayout.LayoutParams params;
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
int halfWidth = (int) (displayMetrics.density * ProjectTaskLayout.HALF_WIDTH);
......@@ -5118,7 +5121,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
public void showProjectTaskLayout(ZoomRelativeLayout layout, ProjectTaskDto projectTaskDto, float clickX) {
//setCurrentProjectTask(layout, currentTaskDto);
projectTaskLayout.showTaskForm(this, layout, mXWalkOpenType, projectTaskDto, isNormalSize(), clickX);
projectTaskLayout.showTaskForm(layout, mXWalkOpenType, projectTaskDto, isNormalSize(), clickX);
isOpenedProjectTask = true;
}
......@@ -5126,6 +5129,9 @@ public class ContentViewActivity extends ABVContentViewActivity {
public void cmdProjectTaskLayout(String cmd, Map<String, String> checkParam) {
String taskKey = checkParam.get(ABookKeys.TASK_KEY);
String taskCode = "";
// フォームが閉いているフラグをfalseに設定
isOpenedProjectTask = false;
if (projectTaskLayout.currentLayout != null && !StringUtil.isNullOrEmpty(taskKey)) {
switch(cmd){
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
......@@ -5136,7 +5142,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
projectTaskLayout.setIconStatus(taskKey, true);
projectTaskLayout.currentTaskDto.taskKey = taskKey;
projectTaskLayout.currentTaskDto.taskCode = taskCode;
projectTaskLayout.addProjectTaskIcon(this, projectTaskLayout.currentLayout, projectTaskLayout.currentTaskDto);
projectTaskLayout.addProjectTaskIcon(projectTaskLayout.currentLayout, projectTaskLayout.currentTaskDto);
//hideProjectTaskLayout();
break;
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
......@@ -5193,6 +5199,33 @@ public class ContentViewActivity extends ABVContentViewActivity {
isOpenedProjectTask = isHide;
}
/**
* 作業のアイコンをピン・作業コードに切替
* @param 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);
for (int j = zoomRelativeLayout.getChildCount() - 1; j >= 0; j--) {
View view = zoomRelativeLayout.getChildAt(j);
if (view instanceof ActionProjectTaskCode) {
((ActionProjectTaskCode) view).stopAnimation();
} else if (view instanceof ActionProjectTaskPin) {
((ActionProjectTaskPin) view).stopAnimation();
}
if (view instanceof ActionProjectTaskCode || view instanceof ActionProjectTaskPin) {
// ピン、作業コードのビューを削除
zoomRelativeLayout.removeView(view);
}
}
List<ProjectTaskDto> tasks = mTaskHotspotJSON.getPageTasks(i);
projectTaskLayout.addAllProjectTaskIcon(zoomRelativeLayout, tasks);
}
}
@Override
public void showTaskList() {
projectTaskLayout.showTaskList(mCurrentPageNumber, isNormalSize());
......@@ -5245,12 +5278,13 @@ public class ContentViewActivity extends ABVContentViewActivity {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
int centerX = displayMetrics.widthPixels / 2;
int centerY = displayMetrics.widthPixels / 2;
int centerY = displayMetrics.heightPixels / 2;
ViewMargin margin = zoomLayout.getContentPageMargin();
Matrix matrix = new Matrix();
matrix.postScale(scaleFactor, scaleFactor, centerX, centerY);
zoomLayout.setZoomMatrix(matrix);
zoomLayout.changeTaskChildView();
setToolbarVisable(false);
mShowPageLayout.get(mCurrentPageNumber).setScaleFactorAndMatrix(scaleFactor);
......
......@@ -10,7 +10,10 @@ import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.widget.TextView;
import jp.agentec.abook.abv.bl.dto.ProjectTaskDto;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
/**
* Created by seo-y on 2018/11/15.
......@@ -20,20 +23,22 @@ public class ActionProjectTaskCode extends TextView {
public String taskKey;
private boolean isAnimated = false;
private Animation animation;
private Context mContext;
public ProjectTaskDto mProjectTaskDto;
public ActionProjectTaskCode(final Context context, final String text, boolean isFinished) {
public ActionProjectTaskCode(Context context, ProjectTaskDto dto) {
super(context);
mContext = context;
mProjectTaskDto = dto;
setSingleLine(true);
setEllipsize(TextUtils.TruncateAt.END);
setText(text);
setText(dto.taskCode);
setTextColor(Color.WHITE);
setTypeface(null, Typeface.BOLD);
setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
setBackgroundResource(R.drawable.shape_hotspot);
setPadding(15,5,15,5);
if (isFinished) {
setBackgroundResource(R.drawable.shape_hotspot);
if (dto.isFinished) {
setBackgroundColor(ProjectTaskLayout.COLOR_BLUE);
} else {
setBackgroundColor(ProjectTaskLayout.COLOR_ORANGE);
......
package jp.agentec.abook.abv.ui.viewer.view;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import jp.agentec.abook.abv.bl.dto.ProjectTaskDto;
import jp.agentec.abook.abv.launcher.android.R;
/**
* Created by leej on 2019/02/25.
*/
public class ActionProjectTaskPin extends ImageView {
public String taskKey;
private boolean isAnimated = false;
private Context mContext;
private Animation animation;
public ProjectTaskDto mProjectTaskDto;
public ActionProjectTaskPin(final Context context, final ProjectTaskDto dto) {
super(context);
mContext = context;
mProjectTaskDto = dto;
if (mProjectTaskDto.isFinished) {
setImageResource(R.drawable.s_pin2);
} else {
setImageResource(R.drawable.s_pin1);
}
setBackgroundColor(Color.TRANSPARENT);
}
public void stopAnimation() {
if (this.isAnimated) {
this.clearAnimation();
this.isAnimated = false;
}
}
public void startBlinkAnimation() {
if (animation == null) {
animation = new AlphaAnimation(1, 0);
animation.setDuration(1000);
animation.setInterpolator(new LinearInterpolator());
animation.setRepeatCount(Animation.INFINITE);
animation.setRepeatMode(Animation.REVERSE);
}
this.startAnimation(animation);
this.isAnimated = true;
}
}
......@@ -3,7 +3,7 @@ package jp.agentec.abook.abv.ui.viewer.view;
import android.content.ClipData;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.PointF;
import android.net.Uri;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
......@@ -28,6 +28,7 @@ import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDao;
import jp.agentec.abook.abv.bl.dto.ProjectTaskDto;
import jp.agentec.abook.abv.bl.dto.TaskDto;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVActivity;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.ContentViewActivity;
......@@ -49,6 +50,13 @@ public class ProjectTaskLayout extends RelativeLayout {
private static final int ICON_WIDTH = 32;
private static final int ICON_HEIGHT = 32;
// 仮)ピンのイメージアイコンのサイズ
private static final int PIN_ICON_WIDTH = 20;
private static final int PIN_ICON_HEIGHT = 40;
// 仮)終了のピンのイメージアイコンのサイズ
private static final int PIN_FINISHED_ICON_WIDTH = 20;
private static final int PIN_FINISHED_ICON_HEIGHT = 40;
private static final int CODE_WIDTH = 46;
private static final int CODE_HEIGHT = 26;
......@@ -63,14 +71,14 @@ public class ProjectTaskLayout extends RelativeLayout {
public ZoomRelativeLayout currentLayout;
public ProjectTaskDto currentTaskDto;
private ContentViewActivity context;
private ContentViewActivity mContext;
private JsInf jsInf = new JsInf();
private static TaskDao mTaskDao = AbstractDao.getDao(TaskDao.class);
public ProjectTaskLayout(final Context context, final long contentId, final String linkUrl, boolean isNormalSize) {
super(context);
this.context = (ContentViewActivity)context;
mContext = (ContentViewActivity)context;
if (isNormalSize) {
setPadding(0, 130, 0, 0);
......@@ -145,7 +153,7 @@ public class ProjectTaskLayout extends RelativeLayout {
final Uri uri = Uri.parse(url);
if (url.contains(ABookKeys.ABOOK_CHECK_API)) {
((ContentViewActivity)context).commonShouldOverrideUrlLoading(uri, currentTaskDto);
((ContentViewActivity)context).commonShouldOverrideUrlLoading(uri, currentTaskDto);
}
return true;
......@@ -156,69 +164,101 @@ public class ProjectTaskLayout extends RelativeLayout {
});
}
public void addProjectTaskIcon(final Context context, final ZoomRelativeLayout rootLayout, final ProjectTaskDto dto) {
public void addProjectTaskIcon(final ZoomRelativeLayout rootLayout, final ProjectTaskDto dto) {
RelativeLayout.LayoutParams params;
final float density = context.getResources().getDisplayMetrics().density;
final float density = mContext.getResources().getDisplayMetrics().density;
View taskView;
int width;
int height;
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));
final ActionProjectTaskIcon taskIcon = new ActionProjectTaskIcon(context);
final ActionProjectTaskIcon taskIcon = new ActionProjectTaskIcon(mContext);
taskIcon.startBlinkAnimation();
taskIcon.taskKey = dto.taskKey;
Point pointView = rootLayout.convertToViewPoint(dto.pdfX, dto.pdfY);
PointF pointView = rootLayout.convertToViewPoint(dto.pdfX, dto.pdfY);
int width = (int) (ICON_WIDTH * density);
int height = (int) (ICON_HEIGHT * density);
int marginLeft = (int)(pointView.x - (width / 2));
int marginTop = (int)(pointView.y - (height / 2));
width = (int) (ICON_WIDTH * density);
height = (int) (ICON_HEIGHT * density);
params = new RelativeLayout.LayoutParams(width, height);
params.setMargins(marginLeft, marginTop, 0, 0);
taskIcon.setTranslationX(pointView.x - (width / 2));
taskIcon.setTranslationY(pointView.y - (height / 2));
rootLayout.addView(taskIcon, params);
taskView = taskIcon;
} else {
final ActionProjectTaskCode taskCode = new ActionProjectTaskCode(context, dto.taskCode, dto.isFinished);
//taskCode.startBlinkAnimation();
taskCode.taskKey = dto.taskKey;
final Point pointView = rootLayout.convertToViewPoint(dto.pdfX, dto.pdfY);
final int width = (int) (CODE_WIDTH * density);
final int height = (int) (CODE_HEIGHT * density);
params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, height);
taskCode.setLayoutParams(params);
taskCode.setVisibility(View.INVISIBLE);
rootLayout.addView(taskCode, params);
taskView = taskCode;
final PointF pointView = rootLayout.convertToViewPoint(dto.pdfX, dto.pdfY);
if (mContext.mShowPinFlg) {
// ピンで表示
final ActionProjectTaskPin taskPin = new ActionProjectTaskPin(mContext, dto);
taskPin.taskKey = dto.taskKey;
if (dto.isFinished) {
width = (int) (PIN_FINISHED_ICON_WIDTH * density);
height = (int) (PIN_FINISHED_ICON_HEIGHT * density);
} else {
width = (int) (PIN_ICON_WIDTH * density);
height = (int) (PIN_ICON_HEIGHT * density);
}
taskCode.post(new Runnable() {
@Override
public void run() {
Logger.d(TAG, String.format("[ActionProjectTaskCode] : taskCode=%s, CODE_WIDTH=%d, fX=%d, fY=%d", dto.taskCode, CODE_WIDTH, pointView.x, pointView.y));
int realWidth = taskCode.getWidth(); //height is ready, sometimes realWidth = 0
ViewGroup.MarginLayoutParams margin = (ViewGroup.MarginLayoutParams)taskCode.getLayoutParams();
margin.leftMargin = (int)(pointView.x - ((realWidth > 0 ? realWidth : width) / 2));
margin.topMargin = (int)(pointView.y - (height / 2));
taskCode.setLayoutParams(new RelativeLayout.LayoutParams(margin));
taskCode.setVisibility(View.VISIBLE);
params = new RelativeLayout.LayoutParams(width, height);
taskPin.setVisibility(View.INVISIBLE);
rootLayout.addView(taskPin, params);
// 座標x,yのセット
taskPin.setTranslationX(pointView.x - (width / 2));
taskPin.setTranslationY(pointView.y - height);
if (currentTaskDto != null && currentTaskDto.taskKey.equals(taskPin.taskKey) && mContext.getOpenedProjestTask()) {
taskPin.startBlinkAnimation();
} else {
taskPin.stopAnimation();
}
});
taskPin.setVisibility(View.VISIBLE);
taskView = taskPin;
} else {
// 作業コードで表示
final ActionProjectTaskCode taskCode = new ActionProjectTaskCode(mContext, dto);
//taskCode.startBlinkAnimation();
taskCode.taskKey = dto.taskKey;
final int postWidth = (int) (CODE_WIDTH * density);
final int postHeight = (int) (CODE_HEIGHT * density);
params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, postHeight);
taskCode.setLayoutParams(params);
taskCode.setVisibility(View.INVISIBLE);
rootLayout.addView(taskCode, params);
taskView = taskCode;
taskCode.post(new Runnable() {
@Override
public void run() {
Logger.d(TAG, String.format("[ActionProjectTaskCode] : taskCode=%s, CODE_WIDTH=%d, fX=%d, fY=%d", dto.taskCode, CODE_WIDTH, (int) pointView.x, (int) pointView.y));
int realWidth = taskCode.getWidth(); //height is ready, sometimes realWidth = 0
// 座標x,yのセット
taskCode.setTranslationX(pointView.x - ((realWidth > 0 ? realWidth : postWidth) / 2));
taskCode.setTranslationY(pointView.y - (postHeight / 2));
if (currentTaskDto != null && currentTaskDto.taskKey.equals(taskCode.taskKey) && mContext.getOpenedProjestTask()) {
taskCode.startBlinkAnimation();
} else {
taskCode.stopAnimation();
}
taskCode.setVisibility(View.VISIBLE);
}
});
}
}
if (rootLayout.isEnableProjectTaskNewOrMove()) {
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);
((ContentViewActivity) context).setCurrentProjectTask(dto);
mContext.setCurrentProjectTask(dto);
}
//rootLayout.invalidate();
return true;
......@@ -230,22 +270,22 @@ 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()) {
((ContentViewActivity)context).showProjectTaskLayout(rootLayout, dto, view.getX());
if (!mContext.getOpenedProjestTask()) {
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) {
task.isFinished = isTaskFinished(task.taskKey);
addProjectTaskIcon(context, rootLayout, task);
addProjectTaskIcon(rootLayout, task);
}
}
private boolean isTaskFinished(String taskKey) {
if(context.getProjectReportUpdateType() == Constant.ProjectUpdateType.HISTORY_ADD) {
if(mContext.getProjectReportUpdateType() == Constant.ProjectUpdateType.HISTORY_ADD) {
return false;
} else {
return mTaskDao.getTaskByTaskKey(taskKey).taskStatus == FINISHED_STATUS;
......@@ -276,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)) {
addProjectTaskIcon(context, layout, projectTaskDto);
addProjectTaskIcon(layout, projectTaskDto);
setTaskFormPosition(clickX, isNormalSize);
}
......@@ -303,7 +343,7 @@ public class ProjectTaskLayout extends RelativeLayout {
public void showProjectTaskLayout() {
if (getVisibility() != View.VISIBLE) {
setVisibility(View.VISIBLE);
context.setProjectTaskViewStatus(true);
mContext.setProjectTaskViewStatus(true);
}
}
......@@ -401,9 +441,9 @@ public class ProjectTaskLayout extends RelativeLayout {
if (currentTaskDto != null && !StringUtil.isNullOrEmpty(currentTaskDto.taskKey)) {
if (currentTaskDto.taskKey.equals(TEMP_TASK_KEY)) {
addProjectTaskIcon(context, currentLayout, currentTaskDto);
addProjectTaskIcon(currentLayout, currentTaskDto);
} else {
if (context.getOpenedProjestTask()) {
if (mContext.getOpenedProjestTask()) {
setTaskCodeBlinkAnimation(currentTaskDto.taskKey, true);
}
}
......@@ -423,6 +463,16 @@ public class ProjectTaskLayout extends RelativeLayout {
}
break;
}
} else if (v instanceof ActionProjectTaskPin) {
ActionProjectTaskPin code = (ActionProjectTaskPin) v;
if (code.taskKey.equals(taskKey)) {
if (isBlink) {
code.startBlinkAnimation();
} else {
code.stopAnimation();
}
break;
}
}
}
}
......@@ -453,6 +503,20 @@ public class ProjectTaskLayout extends RelativeLayout {
}
break;
}
} else if (v instanceof ActionProjectTaskPin) {
ActionProjectTaskPin icon = (ActionProjectTaskPin) v;
if (icon.taskKey.equals(TEMP_TASK_KEY) || icon.taskKey.equals(taskKey)) {
icon.stopAnimation();
if (isTaskFinished(taskKey)) {
icon.setImageResource(R.drawable.s_pin2);
} else {
icon.setImageResource(R.drawable.s_pin1);
}
if (isDelete || icon.taskKey.equals(TEMP_TASK_KEY)) {
currentLayout.removeView(v);
}
break;
}
}
}
}
......@@ -466,22 +530,16 @@ public class ProjectTaskLayout extends RelativeLayout {
} else {
view.setVisibility(View.VISIBLE);
}
} else if (view instanceof ActionProjectTaskPin) {
if (isHide) {
view.setVisibility(View.INVISIBLE);
} else {
view.setVisibility(View.VISIBLE);
}
}
}
}
public Point 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() {
return TEMP_TASK_KEY;
}
......@@ -489,7 +547,7 @@ public class ProjectTaskLayout extends RelativeLayout {
private class JsInf {
@JavascriptInterface
public void getAttachedDataUrl(String data) {
((ABVContentViewActivity)ProjectTaskLayout.this.context).commonAttachedDataUrl(data);
((ABVContentViewActivity)ProjectTaskLayout.this.mContext).commonAttachedDataUrl(data);
}
}
}
......@@ -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;
......@@ -30,10 +31,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;
......@@ -91,77 +89,79 @@ public class ZoomRelativeLayout extends RelativeLayout {
private float fX;
private float fY;
class MyDragListener implements OnDragListener {
@Override
public boolean onDrag(View v, DragEvent event) {
switch (event.getAction()) {
case DragEvent.ACTION_DRAG_STARTED:
//理由不明、イベントが二回くる、二回目でgetX()だけがマイナス
if (event.getX() > 0) {
fX = event.getX();
fY = event.getY();
}
break;
case DragEvent.ACTION_DRAG_ENTERED:
break;
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) {
view.performClick();
return true;
}
float[] pdfMatrix = getMatrixValue(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;
// 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 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);
class MyDragListener implements OnDragListener {
@Override
public boolean onDrag(View v, DragEvent event) {
switch (event.getAction()) {
case DragEvent.ACTION_DRAG_STARTED:
//理由不明、イベントが二回くる、二回目でgetX()だけがマイナス
if (event.getX() > 0) {
fX = event.getX();
fY = event.getY();
}
break;
case DragEvent.ACTION_DRAG_ENTERED:
break;
case DragEvent.ACTION_DRAG_EXITED:
break;
case DragEvent.ACTION_DROP:
View view = (View) event.getLocalState();
float mX = event.getX();
float mY = event.getY();
// 作業コード、ピンの動きが上下左右10pxの差分がなければ、クリックイベントとして見做す。
if (Math.abs(mX - fX) < 10 && Math.abs(mY - fY) < 10) {
view.performClick();
return true;
}
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];
float pdfY = pdfMatrix[Matrix.MTRANS_Y];
Point pdfPoint = convertToAuthoringPoint(mX, mY);
((ContentViewActivity) mContext).updateProjectTaskPosition(pdfPoint.x, pdfPoint.y);
// If left-out or right-out of PDF
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
// 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 = convertToTapPoint(mX, view instanceof ActionProjectTaskPin && !isOutTranslation ? mY + view.getHeight() / 2 : mY);
if (view instanceof ActionProjectTaskCode) {
((ContentViewActivity) mContext).updateProjectTaskPosition();
}
// 座標を更新する
((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);
}
if (view.getVisibility() == View.INVISIBLE) {
view.setVisibility(View.VISIBLE);
}
break;
case DragEvent.ACTION_DRAG_ENDED:
default:
break;
}
return true;
}
}
break;
case DragEvent.ACTION_DRAG_ENDED:
default:
break;
}
return true;
}
}
public ZoomRelativeLayout(Context context) {
super(context);
......@@ -184,8 +184,11 @@ public class ZoomRelativeLayout extends RelativeLayout {
@Override
protected void dispatchDraw(Canvas canvas) {
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.concat(imgMatrix);
if (!isProjectPdf) {
canvas.concat(imgMatrix);
}
super.dispatchDraw(canvas);
invalidate();
canvas.restore();
}
......@@ -271,7 +274,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
mLastTouchX = x;
mLastTouchY = y;
// 作業の座標をすべて調整する
changeTaskChildView();
break;
}
......@@ -316,7 +320,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
private PageView getPageView() {
ViewGroup parenGroup = (ViewGroup) getParent();
if (mPageView == null) {
if (mPageView == null && parenGroup != null) {
for (int i = 0; i < parenGroup.getChildCount(); i++) {
View view = parenGroup.getChildAt(i);
if (!view.equals(this) && view instanceof PageView) {
......@@ -327,7 +331,44 @@ public class ZoomRelativeLayout extends RelativeLayout {
}
}
return mPageView;
}
/**
* 作業の座標をすべて調整する
*/
public void changeTaskChildView() {
if (getChildCount() > 0) {
for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i);
if (view instanceof ActionProjectTaskCode) {
setTaskTranslationCode((ActionProjectTaskCode) view);
} else if (view instanceof ActionProjectTaskPin) {
setTaskTranslationPin((ActionProjectTaskPin) view);
}
}
}
}
/**
* ActionProjectTaskCodeのx,y座標をセット
* @param view
*/
private void setTaskTranslationCode(ActionProjectTaskCode view) {
ProjectTaskDto dto = view.mProjectTaskDto;
PointF point = convertToScalePoint(dto.pdfX, dto.pdfY);
view.setTranslationX(point.x - (view.getWidth() / 2));
view.setTranslationY(point.y - (view.getHeight() / 2));
}
/**
* ActionProjectTaskPinのx,y座標をセット
* @param view
*/
private void setTaskTranslationPin(ActionProjectTaskPin view) {
ProjectTaskDto dto = view.mProjectTaskDto;
PointF point = convertToScalePoint(dto.pdfX, dto.pdfY);
view.setTranslationX(point.x - (view.getWidth() / 2));
view.setTranslationY(point.y - view.getHeight());
}
@Override
......@@ -455,6 +496,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
mScaleFactor = matrixScale;
invalidate();
}
// 作業の座標をすべて調整する
changeTaskChildView();
Logger.v(TAG, "SimpleOnScaleGestureListener:[onScale]:scaleFactor=%s", mScaleFactor);
return super.onScale(detector);
......@@ -481,10 +524,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) {
......@@ -493,12 +532,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]);
// }
/**
* 指を離したあとの座標を補正する
*/
......@@ -517,6 +551,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
mPageScrollView.setZoomingFlag(false);
imgMatrix.set(initMatrix);
invalidate();
// 作業の座標をすべて調整する
changeTaskChildView();
} else {
mScaleFactor = matrixScale;
......@@ -579,6 +615,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
matrixValue[Matrix.MTRANS_Y] = matrixY;
imgMatrix.setValues(matrixValue);
invalidate();
// 作業の座標をすべて調整する
changeTaskChildView();
Logger.v(TAG, "[fixPosition]invalidate");
}
Logger.v(TAG, "[fixPosition][after]x=%s, y=%s", matrixValue[Matrix.MTRANS_X], matrixValue[Matrix.MTRANS_Y]);
......@@ -598,52 +636,110 @@ 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 = convertToMemoViewPoint(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));
return point;
/**
* ドロップ&ドラッグ・ダブルタップ時のx,y座標をPDFに合わせて変換
* @param x
* @param y
* @return
*/
public PointF convertToTapPoint(float x, float y) {
float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
float scaleX = (float)mAuthoringPageSize.width / getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]);
float scaleY = (float)mAuthoringPageSize.height / getScaledPDFHeight(pdfMatrix[Matrix.MSCALE_Y]);
float pdfX = (x - pdfMatrix[Matrix.MTRANS_X]) * scaleX;
float pdfY = (y - pdfMatrix[Matrix.MTRANS_Y]) * scaleY;
return new PointF(pdfX, pdfY);
}
/**
* 作業の位置調整
* @param x
* @param y
* @return
*/
public PointF convertToScalePoint(float x, float y) {
float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
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);
// 初期表示時、getPageView()がnullの場合があるので、初期情報を元にx, y座標を変換する
if (getPageView() != null) {
return convertToScalePoint(x, y);
}
// 初期表示の場合は、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 convertToViewPoint(float x, float y) {
public Point convertToMemoViewPoint(float x, float y) {
Logger.d(TAG, "convertToViewPoint:x=%s, y=%s", x, y);
// オーサリング基準座標から変換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);
Logger.d(TAG, "convertToMemoViewPoint: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;
Logger.d(TAG, "convertToViewPoint:marginX=%s, marginY=%s, mPdfScale=%s viewX=%s, viewY=%s", margin.left, margin.top, mPdfScale, viewX, viewY);
Logger.d(TAG, "convertToMemoViewPoint:marginX=%s, marginY=%s, mPdfScale=%s viewX=%s, viewY=%s", margin.left, margin.top, mPdfScale, viewX, viewY);
Point point = new Point((int)viewX, (int)viewY);
return point;
}
public Point convertToMemoAuthoringPoint(float x, float y) {
Logger.d(TAG, "convertToMemoAuthoringPoint: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, "convertToMemoAuthoringPoint: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, "convertToScalePoint:scale=%s scaledWidth=%s, scaledHeight=%s authX=%s, auyhY=%s", scale, getDefaultPDFWidth(), getDefaultPDFHeight(), (pdfX * scale), (pdfY * scale));
return point;
}
public boolean isLeftSideOfPdf(int x) {
return x < mAuthoringPageSize.width / 2;
}
private void showMemoMenu(final float x, final float y) {
final Point convertedPoint = convertToAuthoringPoint(x, y);
final Point convertedPoint = convertToMemoAuthoringPoint(x, y);
if (contentMemoDao.getCopiedMemo() != null) {
// メモのコピーまたは切り取り中
final ABVPopupListWindow memoPopupWindow = createSimplePopupWindow();
......@@ -812,7 +908,6 @@ public class ZoomRelativeLayout extends RelativeLayout {
} else {
((GuideViewActivity) mContext).singleTapMotion();
}
return false;
}
......@@ -837,36 +932,27 @@ 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 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[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
float scaledWidth = getScaledPDFWidth(pdfMatrix[Matrix.MSCALE_X]);
float scaledHeight = getScaledPDFHeight(pdfMatrix[Matrix.MSCALE_Y]);
float pdfX = pdfMatrix[Matrix.MTRANS_X];
float pdfY = pdfMatrix[Matrix.MTRANS_Y];
// If left-out or right-out of PDF
if ((x-(margin.left+pdfX)) < 0 || (((margin.left+pdfX)+scaledWidth)-x)<0) {
return true;
}
// ダブルタップがPDF表示の横領域を超えた場合は、以下の処理を行わない
if ((x - pdfX) < 0 || ((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;
}
// ダブルタップがPDF表示の縦領域を超えた場合は、以下の処理を行わない
if ((y - pdfY) < 0 || ((pdfY + scaledHeight) - y) < 0) {
return true;
}
Point pointPdf = convertToAuthoringPoint(x, y);
// タップしたx, yをPDF用の座標に変換
PointF pointPdf = convertToTapPoint(x, y);
ProjectTaskDto dto = new ProjectTaskDto();
dto.projectId = ((ContentViewActivity) mContext).getProjectId();
......@@ -874,7 +960,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);
......@@ -918,14 +1004,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