Commit fd158993 by Lee Jaebin

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

#32574 拡大状態でも作業指示・報告画面表示
parent d6f01a25
......@@ -7,6 +7,16 @@
android:background="@color/transparent">
<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:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -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) {
......
......@@ -20,6 +20,7 @@ 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;
......@@ -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.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;
......@@ -271,6 +274,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
private LinearLayout mScaleZoomLayout;
private boolean isOpenedProjectTask = false;
private TaskHotspotJSON mTaskHotspotJSON;
protected ImageButton btnChangePin;
protected ImageButton btnHideTaskDirectBtn;
protected ImageButton btnScaleZoomPlus;
protected ImageButton btnScaleZoom03;
......@@ -329,6 +333,8 @@ public class ContentViewActivity extends ABVContentViewActivity {
private ProgressBar m_progress;
public ValueCallback<Uri[]> mUploadMessage;
public boolean mShowPinFlg = true;
/**
* スクロールステータス
*/
......@@ -4995,11 +5001,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 {
......@@ -5032,7 +5033,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() {
@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.setOnTouchListener(new View.OnTouchListener() {
@Override
......@@ -5127,7 +5137,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(this, projectTaskLayout.currentLayout, projectTaskLayout.currentTaskDto, mShowPinFlg);
//hideProjectTaskLayout();
break;
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
......@@ -5184,6 +5194,25 @@ public class ContentViewActivity extends ABVContentViewActivity {
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
public void showTaskList() {
projectTaskLayout.showTaskList(mCurrentPageNumber, isNormalSize());
......@@ -5236,7 +5265,7 @@ 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();
......
......@@ -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(final Context context, final 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);
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;
}
}
......@@ -139,15 +139,17 @@ public class ZoomRelativeLayout extends RelativeLayout {
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);
Point pdfPoint = convertToAuthoringPoint(mX, mY);
// 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);
((ContentViewActivity) mContext).updateProjectTaskPosition(pdfPoint.x, pdfPoint.y);
if (view instanceof ActionProjectTaskCode) {
if (view instanceof ActionProjectTaskCode || view instanceof ActionProjectTaskPin) {
((ContentViewActivity) mContext).updateProjectTaskPosition();
}
......@@ -185,7 +187,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
@Override
protected void dispatchDraw(Canvas canvas) {
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.concat(imgMatrix);
// canvas.concat(imgMatrix);
super.dispatchDraw(canvas);
canvas.restore();
}
......@@ -272,7 +274,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
mLastTouchX = x;
mLastTouchY = y;
changeTaskChildView();
break;
}
......@@ -317,7 +319,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) {
......@@ -328,7 +330,41 @@ public class ZoomRelativeLayout extends RelativeLayout {
}
}
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
......@@ -456,6 +492,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
mScaleFactor = matrixScale;
invalidate();
}
changeTaskChildView();
Logger.v(TAG, "SimpleOnScaleGestureListener:[onScale]:scaleFactor=%s", mScaleFactor);
return super.onScale(detector);
......@@ -580,6 +617,7 @@ 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]);
......@@ -599,9 +637,9 @@ public class ZoomRelativeLayout extends RelativeLayout {
for (int i = 0; i < listMemo.size(); i++) {
// アイコン追加
ContentMemoDto dto = listMemo.get(i);
Point point = convertToAuthoringPoint(dto.axisX, dto.axisY);
dto.viewX = point.x;
dto.viewY = point.y;
PointF point = convertToAuthoringPoint(dto.axisX, dto.axisY);
dto.viewX = (int) point.x;
dto.viewY = (int) point.y;
MemoManager.addMemoIcon(this, dto);
}
}
......@@ -624,12 +662,12 @@ public class ZoomRelativeLayout extends RelativeLayout {
// }
/**
* オブジェクトの位置調整
* タップのx,y座標をPDFに合わせて変換
* @param x
* @param y
* @return
*/
public Point convertToAuthoringPoint(float x, float y) {
public PointF tapConvertToAuthoringPoint(float x, float y) {
float[] pdfMatrix = getMatrixValue(getPageView().imgMatrix);
float pdfScale = pdfMatrix[0];
......@@ -641,11 +679,31 @@ public class ZoomRelativeLayout extends RelativeLayout {
float pdfX = (x * scaleX) - (matrixX * scaleX);
float pdfY = (y * scaleY) - (matrixY * scaleY);
Point point = new Point((int)pdfX, (int)pdfY);
return point;
return new PointF((int)pdfX, (int)pdfY);
}
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);
// オーサリング基準座標から変換PDF基準座標に変換
float scale = Math.min(getDefaultPDFWidth() / (float)mAuthoringPageSize.width, getDefaultPDFHeight() / (float)mAuthoringPageSize.height);
......@@ -657,8 +715,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
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);
Point point = new Point((int)viewX, (int)viewY);
return point;
return new PointF(viewX, viewY);
}
}
public boolean isLeftSideOfPdf(int x) {
......@@ -666,7 +724,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
}
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) {
// メモのコピーまたは切り取り中
final ABVPopupListWindow memoPopupWindow = createSimplePopupWindow();
......@@ -681,8 +739,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
if (position == 0) {
// 新規
ContentMemoDto dto = new ContentMemoDto();
dto.axisX = convertedPoint.x;
dto.axisY = convertedPoint.y;
dto.axisX = (int) convertedPoint.x;
dto.axisY = (int) convertedPoint.y;
dto.viewX = (int)x;
dto.viewY = (int)y;
dto.contentId = mContentDto.contentId;
......@@ -701,8 +759,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
}
dto.contentId = mContentDto.contentId;
dto.pageNum = mPageNumber;
dto.axisX = convertedPoint.x;
dto.axisY = convertedPoint.y;
dto.axisX = (int) convertedPoint.x;
dto.axisY = (int) convertedPoint.y;
dto.viewX = (int)x;
dto.viewY = (int)y;
dto.copyFlg = false;
......@@ -740,8 +798,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
} else {
ContentMemoDto dto = new ContentMemoDto();
dto.axisX = convertedPoint.x;
dto.axisY = convertedPoint.y;
dto.axisX = (int) convertedPoint.x;
dto.axisY = (int) convertedPoint.y;
dto.viewX = (int)x;
dto.viewY = (int)y;
dto.pageNum = mPageNumber;
......@@ -835,7 +893,6 @@ public class ZoomRelativeLayout extends RelativeLayout {
} else {
((GuideViewActivity) mContext).singleTapMotion();
}
return false;
}
......@@ -880,16 +937,12 @@ public class ZoomRelativeLayout extends RelativeLayout {
float pdfY = pdfMatrix[Matrix.MTRANS_Y]/2;
// If left-out or right-out of PDF
// if ((x-(margin.left+pdfX)) < 0 || (((margin.left+pdfX)+scaledWidth)-x)<0) {
// return true;
// }
Logger.i("heigth");
// 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();
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