Commit fd158993 by Lee Jaebin

#32576 作業指示ボタンの改善(ピン表示)

#32574 拡大状態でも作業指示・報告画面表示
parent d6f01a25
...@@ -7,6 +7,16 @@ ...@@ -7,6 +7,16 @@
android:background="@color/transparent"> android:background="@color/transparent">
<ImageButton <ImageButton
android:id="@+id/btn_pin"
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:id="@+id/btn_hide_task_direct"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
...@@ -775,11 +775,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -775,11 +775,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
*/ */
protected void onActionProjectPdfWebView(Map<String, String> checkParam, ProjectTaskDto projectTaskDto) {} 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) { public void onClickShowHelpView(View v) {
int helpViewType = 0; int helpViewType = 0;
switch (mStatusCode) { switch (mStatusCode) {
......
...@@ -20,6 +20,7 @@ import android.graphics.Matrix; ...@@ -20,6 +20,7 @@ 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.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;
...@@ -156,6 +157,8 @@ import jp.agentec.abook.abv.ui.viewer.view.ABVMediaPlayer; ...@@ -156,6 +157,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.Action3DImageView;
import jp.agentec.abook.abv.ui.viewer.view.ActionButton; 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.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.EnqueteLayout;
import jp.agentec.abook.abv.ui.viewer.view.EnqueteWebView; import jp.agentec.abook.abv.ui.viewer.view.EnqueteWebView;
import jp.agentec.abook.abv.ui.viewer.view.FullVideoView; import jp.agentec.abook.abv.ui.viewer.view.FullVideoView;
...@@ -271,6 +274,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -271,6 +274,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 btnHideTaskDirectBtn; protected ImageButton btnHideTaskDirectBtn;
protected ImageButton btnScaleZoomPlus; protected ImageButton btnScaleZoomPlus;
protected ImageButton btnScaleZoom03; protected ImageButton btnScaleZoom03;
...@@ -329,6 +333,8 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -329,6 +333,8 @@ public class ContentViewActivity extends ABVContentViewActivity {
private ProgressBar m_progress; private ProgressBar m_progress;
public ValueCallback<Uri[]> mUploadMessage; public ValueCallback<Uri[]> mUploadMessage;
public boolean mShowPinFlg = true;
/** /**
* スクロールステータス * スクロールステータス
*/ */
...@@ -4995,11 +5001,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -4995,11 +5001,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
projectTaskLayout.currentLayout = mShowPageLayout.get(currentPageNum); projectTaskLayout.currentLayout = mShowPageLayout.get(currentPageNum);
} }
@Override
public Point convertToAuthoringPoint(float x, float y) {
return projectTaskLayout.convertToAuthoringPoint(x, y);
}
// 作業のホットスポットJSONを取得 // 作業のホットスポットJSONを取得
private void getTaskHotspotJSON() { private void getTaskHotspotJSON() {
try { try {
...@@ -5032,7 +5033,16 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5032,7 +5033,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);
btnChangePin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mShowPinFlg = !mShowPinFlg;
changeTaskPinOrCode(mShowPinFlg);
}
});
btnChangePin.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
...@@ -5127,7 +5137,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5127,7 +5137,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); projectTaskLayout.addProjectTaskIcon(this, projectTaskLayout.currentLayout, projectTaskLayout.currentTaskDto, mShowPinFlg);
//hideProjectTaskLayout(); //hideProjectTaskLayout();
break; break;
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS: case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
...@@ -5184,6 +5194,25 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5184,6 +5194,25 @@ public class ContentViewActivity extends ABVContentViewActivity {
isOpenedProjectTask = isHide; isOpenedProjectTask = isHide;
} }
/**
* 作業のアイコンをピン・作業コードに切替
* @param isShowPin
*/
public void changeTaskPinOrCode(boolean isShowPin) {
for (int i = 0; i < mShowPageLayout.size(); i++) {
int key = mShowPageLayout.keyAt(i);
ZoomRelativeLayout zoomRelativeLayout = mShowPageLayout.get(key);
for (int j = 0; j < zoomRelativeLayout.getChildCount(); j++) {
View view = zoomRelativeLayout.getChildAt(j);
if (view instanceof ActionProjectTaskCode || view instanceof ActionProjectTaskPin) {
zoomRelativeLayout.removeView(view);
}
}
List<ProjectTaskDto> tasks = mTaskHotspotJSON.getPageTasks(i);
projectTaskLayout.addAllProjectTaskIcon(this, zoomRelativeLayout, tasks);
}
}
@Override @Override
public void showTaskList() { public void showTaskList() {
projectTaskLayout.showTaskList(mCurrentPageNumber, isNormalSize()); projectTaskLayout.showTaskList(mCurrentPageNumber, isNormalSize());
...@@ -5236,7 +5265,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5236,7 +5265,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
int centerX = displayMetrics.widthPixels / 2; int centerX = displayMetrics.widthPixels / 2;
int centerY = displayMetrics.widthPixels / 2; int centerY = displayMetrics.heightPixels / 2;
ViewMargin margin = zoomLayout.getContentPageMargin(); ViewMargin margin = zoomLayout.getContentPageMargin();
Matrix matrix = new Matrix(); Matrix matrix = new Matrix();
......
...@@ -10,7 +10,10 @@ import android.view.animation.Animation; ...@@ -10,7 +10,10 @@ import android.view.animation.Animation;
import android.view.animation.LinearInterpolator; import android.view.animation.LinearInterpolator;
import android.widget.TextView; 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.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
/** /**
* Created by seo-y on 2018/11/15. * Created by seo-y on 2018/11/15.
...@@ -20,20 +23,22 @@ public class ActionProjectTaskCode extends TextView { ...@@ -20,20 +23,22 @@ public class ActionProjectTaskCode extends TextView {
public String taskKey; public String taskKey;
private boolean isAnimated = false; private boolean isAnimated = false;
private Animation animation; private Animation animation;
private Context mContext;
public ProjectTaskDto mProjectTaskDto;
public ActionProjectTaskCode(final Context context, final String text, boolean isFinished) { public ActionProjectTaskCode(final Context context, final ProjectTaskDto dto) {
super(context); super(context);
mContext = context;
mProjectTaskDto = dto;
setSingleLine(true); setSingleLine(true);
setEllipsize(TextUtils.TruncateAt.END); setEllipsize(TextUtils.TruncateAt.END);
setText(text); setText(dto.taskCode);
setTextColor(Color.WHITE); setTextColor(Color.WHITE);
setTypeface(null, Typeface.BOLD); setTypeface(null, Typeface.BOLD);
setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
setBackgroundResource(R.drawable.shape_hotspot);
setPadding(15,5,15,5); setPadding(15,5,15,5);
setBackgroundResource(R.drawable.shape_hotspot);
if (isFinished) { if (dto.isFinished) {
setBackgroundColor(ProjectTaskLayout.COLOR_BLUE); setBackgroundColor(ProjectTaskLayout.COLOR_BLUE);
} else { } else {
setBackgroundColor(ProjectTaskLayout.COLOR_ORANGE); 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);
setAdjustViewBounds(true);
setScaleType(ScaleType.FIT_START);
}
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;
}
}
...@@ -4,6 +4,7 @@ import android.content.ClipData; ...@@ -4,6 +4,7 @@ import android.content.ClipData;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.PointF;
import android.net.Uri; import android.net.Uri;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.MotionEvent; import android.view.MotionEvent;
...@@ -28,8 +29,11 @@ import jp.agentec.abook.abv.bl.data.dao.AbstractDao; ...@@ -28,8 +29,11 @@ import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDao; import jp.agentec.abook.abv.bl.data.dao.TaskDao;
import jp.agentec.abook.abv.bl.dto.ProjectTaskDto; import jp.agentec.abook.abv.bl.dto.ProjectTaskDto;
import jp.agentec.abook.abv.bl.dto.TaskDto; import jp.agentec.abook.abv.bl.dto.TaskDto;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
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.ABVActivity;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity; import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.viewer.activity.ContentViewActivity; import jp.agentec.abook.abv.ui.viewer.activity.ContentViewActivity;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
...@@ -49,6 +53,13 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -49,6 +53,13 @@ public class ProjectTaskLayout extends RelativeLayout {
private static final int ICON_WIDTH = 32; private static final int ICON_WIDTH = 32;
private static final int ICON_HEIGHT = 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_WIDTH = 46;
private static final int CODE_HEIGHT = 26; private static final int CODE_HEIGHT = 26;
...@@ -156,40 +167,59 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -156,40 +167,59 @@ public class ProjectTaskLayout extends RelativeLayout {
}); });
} }
public void addProjectTaskIcon(final Context context, final ZoomRelativeLayout rootLayout, final ProjectTaskDto dto) { public void addProjectTaskIcon(final Context context, final ZoomRelativeLayout rootLayout, final ProjectTaskDto dto, boolean isShowPin) {
RelativeLayout.LayoutParams params; RelativeLayout.LayoutParams params;
final float density = context.getResources().getDisplayMetrics().density; final float density = context.getResources().getDisplayMetrics().density;
View taskView; View taskView;
int width;
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(context);
taskIcon.startBlinkAnimation(); taskIcon.startBlinkAnimation();
taskIcon.taskKey = dto.taskKey; 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); width = (int) (ICON_WIDTH * density);
int height = (int) (ICON_HEIGHT * density); height = (int) (ICON_HEIGHT * density);
int marginLeft = (int)(pointView.x - (width / 2));
int marginTop = (int)(pointView.y - (height / 2));
params = new RelativeLayout.LayoutParams(width, height); 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); rootLayout.addView(taskIcon, params);
taskView = taskIcon; taskView = taskIcon;
} else { } else {
final ActionProjectTaskCode taskCode = new ActionProjectTaskCode(context, dto.taskCode, dto.isFinished); final PointF pointView = rootLayout.convertToViewPoint(dto.pdfX, dto.pdfY);
if (isShowPin) {
final ActionProjectTaskPin taskPin = new ActionProjectTaskPin(context, 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);
}
params = new RelativeLayout.LayoutParams(width, height);
taskPin.setVisibility(View.INVISIBLE);
rootLayout.addView(taskPin, params);
taskPin.setTranslationX(pointView.x - (width / 2));
taskPin.setTranslationY(pointView.y - height);
taskPin.setVisibility(View.VISIBLE);
taskView = taskPin;
} else {
final ActionProjectTaskCode taskCode = new ActionProjectTaskCode(context, dto);
//taskCode.startBlinkAnimation(); //taskCode.startBlinkAnimation();
taskCode.taskKey = dto.taskKey; taskCode.taskKey = dto.taskKey;
final Point pointView = rootLayout.convertToViewPoint(dto.pdfX, dto.pdfY); final int postWidth = (int) (CODE_WIDTH * density);
final int postHeight = (int) (CODE_HEIGHT * density);
final int width = (int) (CODE_WIDTH * density);
final int height = (int) (CODE_HEIGHT * density);
params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, height); params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, postHeight);
taskCode.setLayoutParams(params); taskCode.setLayoutParams(params);
taskCode.setVisibility(View.INVISIBLE); taskCode.setVisibility(View.INVISIBLE);
rootLayout.addView(taskCode, params); rootLayout.addView(taskCode, params);
...@@ -199,16 +229,15 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -199,16 +229,15 @@ public class ProjectTaskLayout extends RelativeLayout {
taskCode.post(new Runnable() { taskCode.post(new Runnable() {
@Override @Override
public void run() { 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)); 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 int realWidth = taskCode.getWidth(); //height is ready, sometimes realWidth = 0
ViewGroup.MarginLayoutParams margin = (ViewGroup.MarginLayoutParams)taskCode.getLayoutParams(); taskCode.setTranslationX(pointView.x - ((realWidth > 0 ? realWidth : postWidth) / 2));
margin.leftMargin = (int)(pointView.x - ((realWidth > 0 ? realWidth : width) / 2)); taskCode.setTranslationY(pointView.y - (postHeight / 2));
margin.topMargin = (int)(pointView.y - (height / 2));
taskCode.setLayoutParams(new RelativeLayout.LayoutParams(margin));
taskCode.setVisibility(View.VISIBLE); taskCode.setVisibility(View.VISIBLE);
} }
}); });
} }
}
if (rootLayout.isEnableProjectTaskNewOrMove()) { if (rootLayout.isEnableProjectTaskNewOrMove()) {
taskView.setOnTouchListener(new View.OnTouchListener() { taskView.setOnTouchListener(new View.OnTouchListener() {
...@@ -240,7 +269,7 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -240,7 +269,7 @@ public class ProjectTaskLayout extends RelativeLayout {
public void addAllProjectTaskIcon(Context context, final ZoomRelativeLayout rootLayout, final List<ProjectTaskDto> dto) { public void addAllProjectTaskIcon(Context context, 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); addProjectTaskIcon(context, rootLayout, task, ((ContentViewActivity)context).mShowPinFlg);
} }
} }
...@@ -278,7 +307,7 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -278,7 +307,7 @@ public class ProjectTaskLayout extends RelativeLayout {
public void showTaskForm(final Context context, ZoomRelativeLayout layout, int mXWalkOpenType, ProjectTaskDto projectTaskDto, boolean isNormalSize, float clickX) { public void showTaskForm(final Context context, 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); addProjectTaskIcon(context, layout, projectTaskDto, ((ContentViewActivity)context).mShowPinFlg);
setTaskFormPosition(clickX, isNormalSize); setTaskFormPosition(clickX, isNormalSize);
} }
...@@ -401,7 +430,7 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -401,7 +430,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(context, currentLayout, currentTaskDto); addProjectTaskIcon(context, currentLayout, currentTaskDto, ((ContentViewActivity)context).mShowPinFlg);
} else { } else {
if (context.getOpenedProjestTask()) { if (context.getOpenedProjestTask()) {
setTaskCodeBlinkAnimation(currentTaskDto.taskKey, true); setTaskCodeBlinkAnimation(currentTaskDto.taskKey, true);
...@@ -423,6 +452,16 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -423,6 +452,16 @@ public class ProjectTaskLayout extends RelativeLayout {
} }
break; 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 +492,20 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -453,6 +492,20 @@ public class ProjectTaskLayout extends RelativeLayout {
} }
break; 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.setBackgroundColor(ProjectTaskLayout.COLOR_BLUE);
} else {
icon.setBackgroundColor(ProjectTaskLayout.COLOR_ORANGE);
}
if (isDelete || icon.taskKey.equals(TEMP_TASK_KEY)) {
currentLayout.removeView(v);
}
break;
}
} }
} }
} }
...@@ -466,11 +519,17 @@ public class ProjectTaskLayout extends RelativeLayout { ...@@ -466,11 +519,17 @@ public class ProjectTaskLayout extends RelativeLayout {
} else { } else {
view.setVisibility(View.VISIBLE); 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) { public PointF convertToAuthoringPoint(float x, float y) {
return currentLayout.convertToAuthoringPoint(x, y); return currentLayout.convertToAuthoringPoint(x, y);
} }
......
...@@ -139,15 +139,17 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -139,15 +139,17 @@ public class ZoomRelativeLayout extends RelativeLayout {
mY = margin.top + getDefaultPDFHeight(); mY = margin.top + getDefaultPDFHeight();
} }
ViewGroup.MarginLayoutParams marginDrop = (ViewGroup.MarginLayoutParams)view.getLayoutParams(); // ViewGroup.MarginLayoutParams marginDrop = (ViewGroup.MarginLayoutParams)view.getLayoutParams();
marginDrop.leftMargin = (int) (mX - width / 2); // marginDrop.leftMargin = (int) (mX - width / 2);
marginDrop.topMargin = (int) (mY - height / 2); // marginDrop.topMargin = (int) (mY - height / 2);
view.setLayoutParams(marginDrop); // view.setLayoutParams(marginDrop);
view.setTranslationX(mX - width / 2);
Point pdfPoint = convertToAuthoringPoint(mX, mY); view.setTranslationY(mY - height / 2);
// ピンの場合、Yをピンの先に合わせるため、mY + height / 2で座標をセットする
PointF pdfPoint = tapConvertToAuthoringPoint(mX, ((ContentViewActivity) mContext).mShowPinFlg ? mY + height / 2 : mY);
((ContentViewActivity) mContext).updateProjectTaskPosition(pdfPoint.x, pdfPoint.y); ((ContentViewActivity) mContext).updateProjectTaskPosition(pdfPoint.x, pdfPoint.y);
if (view instanceof ActionProjectTaskCode) { if (view instanceof ActionProjectTaskCode || view instanceof ActionProjectTaskPin) {
((ContentViewActivity) mContext).updateProjectTaskPosition(); ((ContentViewActivity) mContext).updateProjectTaskPosition();
} }
...@@ -185,7 +187,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -185,7 +187,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
@Override @Override
protected void dispatchDraw(Canvas canvas) { protected void dispatchDraw(Canvas canvas) {
canvas.save(Canvas.MATRIX_SAVE_FLAG); canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.concat(imgMatrix); // canvas.concat(imgMatrix);
super.dispatchDraw(canvas); super.dispatchDraw(canvas);
canvas.restore(); canvas.restore();
} }
...@@ -272,7 +274,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -272,7 +274,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
mLastTouchX = x; mLastTouchX = x;
mLastTouchY = y; mLastTouchY = y;
changeTaskChildView();
break; break;
} }
...@@ -317,7 +319,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -317,7 +319,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
private PageView getPageView() { private PageView getPageView() {
ViewGroup parenGroup = (ViewGroup) getParent(); ViewGroup parenGroup = (ViewGroup) getParent();
if (mPageView == null) { if (mPageView == null && parenGroup != null) {
for (int i = 0; i < parenGroup.getChildCount(); i++) { for (int i = 0; i < parenGroup.getChildCount(); i++) {
View view = parenGroup.getChildAt(i); View view = parenGroup.getChildAt(i);
if (!view.equals(this) && view instanceof PageView) { if (!view.equals(this) && view instanceof PageView) {
...@@ -328,7 +330,41 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -328,7 +330,41 @@ public class ZoomRelativeLayout extends RelativeLayout {
} }
} }
return mPageView; return mPageView;
}
private void changeTaskChildView() {
if (getChildCount() > 0) {
for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i);
if (view instanceof ActionProjectTaskCode) {
setTaskTranslation((ActionProjectTaskCode) view);
} else if (view instanceof ActionProjectTaskPin) {
setTaskTranslation((ActionProjectTaskPin) view);
}
}
}
}
/**
* ActionProjectTaskCodeのx,y座標をセット
* @param view
*/
private void setTaskTranslation(ActionProjectTaskCode view) {
ProjectTaskDto dto = view.mProjectTaskDto;
PointF point = convertToAuthoringPoint(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 setTaskTranslation(ActionProjectTaskPin view) {
ProjectTaskDto dto = view.mProjectTaskDto;
PointF point = convertToAuthoringPoint(dto.pdfX, dto.pdfY);
view.setTranslationX(point.x - (view.getWidth() / 2));
view.setTranslationY(point.y - view.getHeight());
} }
@Override @Override
...@@ -456,6 +492,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -456,6 +492,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
mScaleFactor = matrixScale; mScaleFactor = matrixScale;
invalidate(); invalidate();
} }
changeTaskChildView();
Logger.v(TAG, "SimpleOnScaleGestureListener:[onScale]:scaleFactor=%s", mScaleFactor); Logger.v(TAG, "SimpleOnScaleGestureListener:[onScale]:scaleFactor=%s", mScaleFactor);
return super.onScale(detector); return super.onScale(detector);
...@@ -580,6 +617,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -580,6 +617,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
matrixValue[Matrix.MTRANS_Y] = matrixY; matrixValue[Matrix.MTRANS_Y] = matrixY;
imgMatrix.setValues(matrixValue); imgMatrix.setValues(matrixValue);
invalidate(); invalidate();
changeTaskChildView();
Logger.v(TAG, "[fixPosition]invalidate"); Logger.v(TAG, "[fixPosition]invalidate");
} }
Logger.v(TAG, "[fixPosition][after]x=%s, y=%s", matrixValue[Matrix.MTRANS_X], matrixValue[Matrix.MTRANS_Y]); Logger.v(TAG, "[fixPosition][after]x=%s, y=%s", matrixValue[Matrix.MTRANS_X], matrixValue[Matrix.MTRANS_Y]);
...@@ -599,9 +637,9 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -599,9 +637,9 @@ public class ZoomRelativeLayout extends RelativeLayout {
for (int i = 0; i < listMemo.size(); i++) { for (int i = 0; i < listMemo.size(); i++) {
// アイコン追加 // アイコン追加
ContentMemoDto dto = listMemo.get(i); ContentMemoDto dto = listMemo.get(i);
Point point = convertToAuthoringPoint(dto.axisX, dto.axisY); PointF point = convertToAuthoringPoint(dto.axisX, dto.axisY);
dto.viewX = point.x; dto.viewX = (int) point.x;
dto.viewY = point.y; dto.viewY = (int) point.y;
MemoManager.addMemoIcon(this, dto); MemoManager.addMemoIcon(this, dto);
} }
} }
...@@ -624,12 +662,12 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -624,12 +662,12 @@ public class ZoomRelativeLayout extends RelativeLayout {
// } // }
/** /**
* オブジェクトの位置調整 * タップのx,y座標をPDFに合わせて変換
* @param x * @param x
* @param y * @param y
* @return * @return
*/ */
public Point convertToAuthoringPoint(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 pdfScale = pdfMatrix[0];
...@@ -641,11 +679,31 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -641,11 +679,31 @@ public class ZoomRelativeLayout extends RelativeLayout {
float pdfX = (x * scaleX) - (matrixX * scaleX); float pdfX = (x * scaleX) - (matrixX * scaleX);
float pdfY = (y * scaleY) - (matrixY * scaleY); float pdfY = (y * scaleY) - (matrixY * scaleY);
Point point = new Point((int)pdfX, (int)pdfY); return new PointF((int)pdfX, (int)pdfY);
return point;
} }
public Point convertToViewPoint(float x, float y) { /**
* オブジェクトの位置調整
* @param x
* @param y
* @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 pdfX = (x * scale) + matrixX;
float pdfY = (y * scale) + matrixY;
return new PointF((int)pdfX, (int)pdfY);
}
public PointF convertToViewPoint(float x, float y) {
if (getPageView() != null) {
return convertToAuthoringPoint(x, y);
} else {
Logger.d(TAG, "convertToViewPoint:x=%s, y=%s", x, y); Logger.d(TAG, "convertToViewPoint:x=%s, y=%s", x, y);
// オーサリング基準座標から変換PDF基準座標に変換 // オーサリング基準座標から変換PDF基準座標に変換
float scale = Math.min(getDefaultPDFWidth() / (float)mAuthoringPageSize.width, getDefaultPDFHeight() / (float)mAuthoringPageSize.height); float scale = Math.min(getDefaultPDFWidth() / (float)mAuthoringPageSize.width, getDefaultPDFHeight() / (float)mAuthoringPageSize.height);
...@@ -657,8 +715,8 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -657,8 +715,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
float viewX = pdfX + margin.left; float viewX = pdfX + margin.left;
float viewY = pdfY + margin.top; 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, "convertToViewPoint: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 new PointF(viewX, viewY);
return point; }
} }
public boolean isLeftSideOfPdf(int x) { public boolean isLeftSideOfPdf(int x) {
...@@ -666,7 +724,7 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -666,7 +724,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
} }
private void showMemoMenu(final float x, final float y) { private void showMemoMenu(final float x, final float y) {
final Point convertedPoint = convertToAuthoringPoint(x, y); final PointF convertedPoint = convertToAuthoringPoint(x, y);
if (contentMemoDao.getCopiedMemo() != null) { if (contentMemoDao.getCopiedMemo() != null) {
// メモのコピーまたは切り取り中 // メモのコピーまたは切り取り中
final ABVPopupListWindow memoPopupWindow = createSimplePopupWindow(); final ABVPopupListWindow memoPopupWindow = createSimplePopupWindow();
...@@ -681,8 +739,8 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -681,8 +739,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
if (position == 0) { if (position == 0) {
// 新規 // 新規
ContentMemoDto dto = new ContentMemoDto(); ContentMemoDto dto = new ContentMemoDto();
dto.axisX = convertedPoint.x; dto.axisX = (int) convertedPoint.x;
dto.axisY = convertedPoint.y; dto.axisY = (int) convertedPoint.y;
dto.viewX = (int)x; dto.viewX = (int)x;
dto.viewY = (int)y; dto.viewY = (int)y;
dto.contentId = mContentDto.contentId; dto.contentId = mContentDto.contentId;
...@@ -701,8 +759,8 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -701,8 +759,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
} }
dto.contentId = mContentDto.contentId; dto.contentId = mContentDto.contentId;
dto.pageNum = mPageNumber; dto.pageNum = mPageNumber;
dto.axisX = convertedPoint.x; dto.axisX = (int) convertedPoint.x;
dto.axisY = convertedPoint.y; dto.axisY = (int) convertedPoint.y;
dto.viewX = (int)x; dto.viewX = (int)x;
dto.viewY = (int)y; dto.viewY = (int)y;
dto.copyFlg = false; dto.copyFlg = false;
...@@ -740,8 +798,8 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -740,8 +798,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
} else { } else {
ContentMemoDto dto = new ContentMemoDto(); ContentMemoDto dto = new ContentMemoDto();
dto.axisX = convertedPoint.x; dto.axisX = (int) convertedPoint.x;
dto.axisY = convertedPoint.y; dto.axisY = (int) convertedPoint.y;
dto.viewX = (int)x; dto.viewX = (int)x;
dto.viewY = (int)y; dto.viewY = (int)y;
dto.pageNum = mPageNumber; dto.pageNum = mPageNumber;
...@@ -835,7 +893,6 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -835,7 +893,6 @@ public class ZoomRelativeLayout extends RelativeLayout {
} else { } else {
((GuideViewActivity) mContext).singleTapMotion(); ((GuideViewActivity) mContext).singleTapMotion();
} }
return false; return false;
} }
...@@ -880,16 +937,12 @@ public class ZoomRelativeLayout extends RelativeLayout { ...@@ -880,16 +937,12 @@ public class ZoomRelativeLayout extends RelativeLayout {
float pdfY = pdfMatrix[Matrix.MTRANS_Y]/2; float pdfY = pdfMatrix[Matrix.MTRANS_Y]/2;
// If left-out or right-out of PDF // If left-out or right-out of PDF
// if ((x-(margin.left+pdfX)) < 0 || (((margin.left+pdfX)+scaledWidth)-x)<0) { Logger.i("heigth");
// return true; // if (getHeight()) {
// }
// //
// // If top-out or bottom-out of PDF
// if ((y-(margin.top+pdfY)) < 0 || (((margin.top+pdfY)+scaledHeight)-y)<0) {
// return true;
// } // }
Point pointPdf = convertToAuthoringPoint(x, y); PointF pointPdf = tapConvertToAuthoringPoint(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