package epson.scan.activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.DashPathEffect; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; import android.os.Build; import android.os.Handler; import android.support.p000v4.view.ViewCompat; import android.view.MotionEvent; import android.view.View; import android.widget.EditText; import java.util.ArrayList; import java.util.Locale; import epson.common.Constants; import epson.common.Utils; import epson.print.ActivityIACommon; import epson.print.R; import epson.print.Util.EPLog; import epson.scan.lib.escanLib; public class ScanBaseView extends ActivityIACommon { public static int SCAN_AREA_HOTSPOT_SIZE = 40; private static final int SCAN_REDRAWBITMAP = -100; private static final String TAG = "ScanBaseView"; public final int LINE_AREA_BORDER = 2; public final int LINE_CORNER_BIG = 18; public final int LINE_CORNER_BIG_WIDTH = 150; public final int LINE_CORNER_SMALL = 6; public final int LINE_CORNER_SMALL_WIDTH = 60; public final int MARGIN_LEFT_RIGHT = 10; public int MARGIN_TOP_BOT = 60; final int MAX_DASHEFFECT_PHASE; public final int SCREEN_STATUS_BOTLEFT_TOPRIGHT = 2; public final int SCREEN_STATUS_BOTRIGHT_TOPLEFT = 3; public final int SCREEN_STATUS_TOPLEFT_BOTRIGHT = 1; public final int SCREEN_STATUS_TOPRIGHT_BOTLEFT = 4; private BitmapFactory.Options _bmOption; public boolean bLongTouch = false; public Bitmap bmCenter; private RectF bmRectF; Context context; int curentViewingFile; escanLib escan; private PointInfo first; private int inSampleSize; private boolean isDisplayResult; public boolean isDoctable = false; private boolean isSetSize = false; private boolean isValidArea; private ArrayList listSavedJPGFilePath; private Point mBaseBot; private Point mBaseTop; private Bitmap mBitmap; Point mBot; Point mCenter; Point mFirstTouch; private Paint mPaint; Point mTop; Point mTouch; int mWhere; private double maxScanHeightOnScreen = 0.0d; private double maxScanWidthOnScreen = 0.0d; private int maxheight = 0; private int maxwidth = 0; int phase; private PointInfo piBaseBot; private PointInfo piBaseTop; private RectF rectScanArea; private double scale; private int screenStatus = 1; private PointInfo second; int totalScanned; class PointInfo { /* access modifiers changed from: private */ /* renamed from: x */ public double f411x = 0.0d; /* access modifiers changed from: private */ /* renamed from: y */ public double f412y = 0.0d; public PointInfo(double d, double d2) { f411x = d; f412y = d2; } public double getX() { return f411x; } public void setX(double d) { f411x = d; } public double getY() { return f412y; } public void setY(double d) { f412y = d; } public String toString() { return String.format(Locale.US, "(%.2f,%.2f)", new Object[]{Double.valueOf(this.f411x), Double.valueOf(this.f412y)}); } } public PointInfo getPiBaseTop() { return piBaseTop; } public void setPiBaseTop(PointInfo pointInfo) { piBaseTop = pointInfo; } public PointInfo getPiBaseBot() { return piBaseBot; } public void setPiBaseBot(PointInfo pointInfo) { piBaseBot = pointInfo; } public Context getContext() { return context; } public void setContext(Context context2) { context = context2; } public Point getmBaseTop() { return mBaseTop; } public void setmBaseTop(Point point) { mBaseTop = point; } public Point getmBaseBot() { return mBaseBot; } public void setmBaseBot(Point point) { mBaseBot = point; } public RectF getRectScanArea() { return rectScanArea; } public void setRectScanArea(RectF rectF) { rectScanArea = rectF; } public escanLib getEscan() { return escan; } public void setEscan(escanLib escanlib) { escan = escanlib; } public double getScale() { return scale; } public void setScale(double d) { scale = d; } public int getMaxwidth() { return maxwidth; } public void setMaxwidth(int i) { maxwidth = i; } public int getMaxheight() { return maxheight; } public void setMaxheight(int i) { maxheight = i; } public Point getmTop() { return mTop; } public void setmTop(Point point) { mTop = point; } public Point getmBot() { return mBot; } public void setmBot(Point point) { mBot = point; } public Point getmCenter() { return mCenter; } public void setmCenter(Point point) { mCenter = point; } public Point getmTouch() { return mTouch; } public void setmTouch(Point point) { mTouch = point; } public Point getmFirstTouch() { return mFirstTouch; } public void setmFirstTouch(Point point) { mFirstTouch = point; } public Bitmap getBmCenter() { return bmCenter; } public void setBmCenter(Bitmap bitmap) { bmCenter = bitmap; } public int getScreenStatus() { return screenStatus; } public void setScreenStatus(int i) { screenStatus = i; } public BitmapFactory.Options get_bmOption() { return _bmOption; } public void set_bmOption(BitmapFactory.Options options) { _bmOption = options; } public int getInSampleSize() { return inSampleSize; } public void setInSampleSize(int i) { inSampleSize = i; } public boolean isSetSize() { return isSetSize; } public void setSetSize(boolean z) { isSetSize = z; } public RectF getBmRectF() { return bmRectF; } public void setBmRectF(RectF rectF) { bmRectF = rectF; } public Bitmap getBm() { return mBitmap; } public void setBm(Bitmap bitmap) { mBitmap = bitmap; } public int getmWhere() { return mWhere; } public void setmWhere(int i) { mWhere = i; } public Paint getmPaint() { return mPaint; } public void setmPaint(Paint paint) { mPaint = paint; } public void setListSavedJPGFilePath(ArrayList arrayList) { listSavedJPGFilePath = arrayList; } public ArrayList getListSavedJPGFilePath() { return listSavedJPGFilePath; } public double getMaxScanHeightOnScreen() { return maxScanHeightOnScreen; } public void setMaxScanHeightOnScreen(double d) { maxScanHeightOnScreen = d; } public double getMaxScanWidthOnScreen() { return maxScanWidthOnScreen; } public void setMaxScanWidthOnScreen(double d) { maxScanWidthOnScreen = d; } public ScanBaseView() { piBaseTop = new PointInfo(0.0d, 0.0d); piBaseBot = new PointInfo(0.0d, 0.0d); mBaseTop = new Point(); mBaseBot = new Point(); mTop = new Point(); mBot = new Point(); mCenter = new Point(); mTouch = new Point(); mFirstTouch = new Point(); curentViewingFile = 1; totalScanned = 0; mWhere = 2; first = new PointInfo(0.0d, 0.0d); second = new PointInfo(0.0d, 0.0d); isValidArea = false; isDisplayResult = false; phase = 0; mAX_DASHEFFECT_PHASE = 1000; escan = new escanLib(); escan.setJobDone(false); _bmOption = new BitmapFactory.Options(); if (mPaint == null) { mPaint = new Paint(); mPaint.setStrokeWidth(2.0f); mPaint.setColor(ViewCompat.MEASURED_STATE_MASK); } listSavedJPGFilePath = new ArrayList<>(); } public void setupScanArea() { double unused = first.f411x = Math.min(this.piBaseTop.f411x, piBaseBot.f411x); double unused2 = first.f412y = Math.min(this.piBaseTop.f412y, piBaseBot.f412y); double unused3 = second.f411x = Math.max(this.piBaseTop.f411x, piBaseBot.f411x); double unused4 = second.f412y = Math.max(this.piBaseTop.f412y, piBaseBot.f412y); if (this.first.f411x < (getmBaseTop().x)) { double unused5 = first.f411x = getmBaseTop().x; } if (this.first.f412y < (getmBaseTop().y)) { double unused6 = first.f412y = getmBaseTop().y; } if (this.second.f411x > (getmBaseBot().x)) { double unused7 = second.f411x = getmBaseBot().x; } if (this.second.f412y > (getmBaseBot().y)) { double unused8 = second.f412y = getmBaseBot().y; } if (this.second.f411x <= (getmBaseTop().x) || first.f411x >= (getmBaseBot().x) || second.f412y <= (getmBaseTop().y) || first.f412y >= (getmBaseBot().y)) { isValidArea = false; } else { isValidArea = true; } escan.setOffsetX(Math.max((Math.abs(this.first.f411x - (getmBaseTop().x)) * (getMaxwidth())) / getMaxScanWidthOnScreen(), 0.0d)); escan.setOffsetY(Math.max((Math.abs(this.first.f412y - (getmBaseTop().y)) * (getMaxheight())) / getMaxScanHeightOnScreen(), 0.0d)); int min = Math.min((Math.abs(this.first.f411x - second.f411x) * (getMaxwidth())) / getMaxScanWidthOnScreen(), (getMaxwidth() - escan.getOffsetX())); int min2 = Math.min((Math.abs(this.first.f412y - second.f412y) * (getMaxheight())) / getMaxScanHeightOnScreen(), (getMaxheight() - escan.getOffsetY())); if (min == 0) { escanLib escanlib = escan; escanlib.setOffsetX(escanlib.getOffsetX() - 1); min = 1; } if (min2 == 0) { escanLib escanlib2 = escan; escanlib2.setOffsetY(escanlib2.getOffsetY() - 1); min2 = 1; } escan.setScanAreaWidth(min); escan.setScanAreaHeight(min2); if (Utils.getPrefInt(this.context, Constants.SCAN_REFS_USED_SCANNER_PATH, Constants.SCAN_REFS_SETTINGS_2SIDED) == 1 || !this.isDoctable) { escan.setOffsetX(Utils.getPrefInt(getContext(), Constants.SCAN_REFS_SUPPORTED_OPTIONS, Constants.SCAN_REFS_MAX_WIDTH) - min); } rectScanArea = new RectF((float) (Math.max(this.first.f411x, getmBaseTop().x)), (float) (Math.max(this.first.f412y, getmBaseTop().y)), (float) (Math.min(this.second.f411x, getmBaseBot().x)), (float) (Math.min(this.second.f412y, getmBaseBot().y))); } public Point calculateTheCenterPoint(Point point, Point point2) { Point point3 = new Point(); point3.x = Math.min(point.x, point2.x) + Math.round((float) (Math.abs(point.x - point2.x) / 2)); point3.y = Math.min(point.y, point2.y) + Math.round((float) (Math.abs(point.y - point2.y) / 2)); return point3; } public boolean isValidArea() { return isValidArea; } public void setValidArea(boolean z) { isValidArea = z; } class ScanAreaSet extends View { private Point _pBaseBottomRight; private Point _pBaseCenter; private Point _pBaseTopLeft; int _touchtime = 0; public Handler redrawCBHandler = null; public ScanAreaSet(Context context) { super(context); ScanBaseView.SCAN_AREA_HOTSPOT_SIZE = ((((float) ScanBaseView.SCAN_AREA_HOTSPOT_SIZE) * getResources().getDisplayMetrics().density) + 0.5f); } protected void onSizeChanged(int i, int i2, int i3, int i4) { super.onSizeChanged(i, i2, i3, i4); } protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (ScanBaseView.this.bLongTouch && ScanBaseView.mWhere != 2) { invalidate(); ScanBaseView.this.phase += 2; if (ScanBaseView.this.phase > 1000) { ScanBaseView.this.phase = 0; } } drawScanArea(canvas); Handler handler = redrawCBHandler; if (handler != null) { handler.sendEmptyMessage(-100); } } private synchronized void drawScanArea(Canvas canvas) { _pBaseTopLeft = ScanBaseView.this.getmTop(); _pBaseBottomRight = ScanBaseView.this.getmBot(); if (!ScanBaseView.this.isDisplayResult && ScanBaseView.this.getBm() != null) { if (Build.VERSION.SDK_INT >= 14) { EPLog.m313i("drawScanArea", "14"); Bitmap bm = ScanBaseView.this.getBm(); RectF bmRectF = ScanBaseView.this.getBmRectF(); Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bm, bmRectF.width(), bmRectF.height(), true); ScanBaseView.this.setBm(createScaledBitmap); canvas.drawBitmap(createScaledBitmap, ScanBaseView.this.getBmRectF().left, ScanBaseView.this.getBmRectF().top, (Paint) null); } else { canvas.drawBitmap(ScanBaseView.this.getBm(), (Rect) null, ScanBaseView.this.getBmRectF(), ScanBaseView.this.getmPaint()); } } if (ScanBaseView.this.isDoctable) { if (ScanBaseView.this.isSetSize) { drawNormalCorner(canvas); _pBaseCenter = ScanBaseView.this.getmCenter(); } Paint paint = new Paint(); if (!ScanBaseView.this.bLongTouch || ScanBaseView.mWhere == 2) { Paint paint2 = ScanBaseView.this.getmPaint(); canvas.drawLine((float) _pBaseTopLeft.x, (float) _pBaseTopLeft.y, (float) _pBaseBottomRight.x, (float) _pBaseTopLeft.y, paint2); canvas.drawLine((float) _pBaseBottomRight.x, (float) _pBaseTopLeft.y, (float) _pBaseBottomRight.x, (float) _pBaseBottomRight.y, paint2); canvas.drawLine((float) _pBaseBottomRight.x, (float) _pBaseBottomRight.y, (float) _pBaseTopLeft.x, (float) _pBaseBottomRight.y, paint2); canvas.drawLine((float) _pBaseTopLeft.x, (float) _pBaseBottomRight.y, (float) _pBaseTopLeft.x, (float) _pBaseTopLeft.y, paint2); } else { Path path = new Path(); path.addRect((float) _pBaseTopLeft.x, (float) _pBaseTopLeft.y, (float) _pBaseBottomRight.x, (float) _pBaseBottomRight.y, Path.Direction.CW); paint.setPathEffect(new DashPathEffect(new float[]{10.0f, 2.0f}, (float) ScanBaseView.this.phase)); paint.setStrokeWidth(1.5f); paint.setStyle(Paint.Style.STROKE); canvas.drawPath(path, paint); } if (ScanBaseView.this.bLongTouch) { drawTheCornerImage(canvas, ScanBaseView.this.getmPaint()); } else { drawNormalCorner(canvas); } } if (ScanBaseView.this.isSetSize) { ScanBaseView.this.setupScanArea(); ScanBaseView.this.setSetSize(false); } } private void drawTheCornerImage(Canvas canvas, Paint paint) { switch (ScanBaseView.this.screenStatus) { case 1: int i = ScanBaseView.mWhere; if (i != -1) { if (i == 1) { drawCornerTopLeft(canvas, _pBaseTopLeft); drawCornerBotRightMoving(canvas, _pBaseBottomRight); break; } else { drawCornerTopLeft(canvas, _pBaseTopLeft); drawCornerBotRight(canvas, _pBaseBottomRight); break; } } else { drawCornerTopLeftMoving(canvas, _pBaseTopLeft); drawCornerBotRight(canvas, _pBaseBottomRight); break; } case 2: int i2 = ScanBaseView.mWhere; if (i2 != -1) { if (i2 == 1) { drawCornerBotLeft(canvas, _pBaseTopLeft); drawCornerTopRightMoving(canvas, _pBaseBottomRight); break; } else { drawCornerBotLeft(canvas, _pBaseTopLeft); drawCornerTopRight(canvas, _pBaseBottomRight); break; } } else { drawCornerBotLeftMoving(canvas, _pBaseTopLeft); drawCornerTopRight(canvas, _pBaseBottomRight); break; } case 3: int i3 = ScanBaseView.mWhere; if (i3 != -1) { if (i3 == 1) { drawCornerBotRight(canvas, _pBaseTopLeft); drawCornerTopLeftMoving(canvas, _pBaseBottomRight); break; } else { drawCornerBotRight(canvas, _pBaseTopLeft); drawCornerTopLeft(canvas, _pBaseBottomRight); break; } } else { drawCornerBotRightMoving(canvas, _pBaseTopLeft); drawCornerTopLeft(canvas, _pBaseBottomRight); break; } case 4: int i4 = ScanBaseView.mWhere; if (i4 != -1) { if (i4 == 1) { drawCornerTopRight(canvas, _pBaseTopLeft); drawCornerBotLeftMoving(canvas, _pBaseBottomRight); break; } else { drawCornerTopRight(canvas, _pBaseTopLeft); drawCornerBotLeft(canvas, _pBaseBottomRight); break; } } else { drawCornerTopRightMoving(canvas, _pBaseTopLeft); drawCornerBotLeft(canvas, _pBaseBottomRight); break; } } if (ScanBaseView.this.bLongTouch) { String localClassName = ScanBaseView.this.getLocalClassName(); EPLog.m313i(localClassName, "mWhere = " + ScanBaseView.mWhere); if (ScanBaseView.mWhere == 0 && ScanBaseView.this.bmCenter == null) { ScanBaseView.this.bmCenter = BitmapFactory.decodeResource(getResources(), R.drawable.area_center, ScanBaseView.this._bmOption); } if (ScanBaseView.this.bmCenter != null) { if (this._pBaseCenter == null) { _pBaseCenter = ScanBaseView.this.getmCenter(); } if (ScanBaseView.this.inSampleSize != 0) { canvas.drawBitmap(ScanBaseView.this.bmCenter, (float) (this._pBaseCenter.x - ((ScanBaseView.this.bmCenter.getWidth() / 2) * ScanBaseView.this.getInSampleSize())), (float) (this._pBaseCenter.y - ((ScanBaseView.this.bmCenter.getHeight() / 2) * ScanBaseView.this.getInSampleSize())), (Paint) null); } else { canvas.drawBitmap(ScanBaseView.this.bmCenter, (float) (this._pBaseCenter.x - (ScanBaseView.this.bmCenter.getWidth() / 2)), (float) (this._pBaseCenter.y - (ScanBaseView.this.bmCenter.getHeight() / 2)), (Paint) null); } } } } public boolean onTouchEvent(MotionEvent motionEvent) { if (!ScanBaseView.this.isDoctable) { return true; } Point point = new Point(motionEvent.getX(), motionEvent.getY()); ScanBaseView.this.setmTouch(point); ScanBaseView.this.detectTheScreenStatus(); switch (motionEvent.getAction()) { case 0: ScanBaseView.this.setmWhere(2); ScanBaseView.this.detectTheTouchPoint(); ScanBaseView.this.setmFirstTouch(point); break; case 1: ScanBaseView.this.setmWhere(2); ScanBaseView.this.setBmCenter((Bitmap) null); ScanBaseView scanBaseView = ScanBaseView.this; scanBaseView.phase = 0; _touchtime = 0; scanBaseView.setupScanArea(); ScanBaseView.this.bLongTouch = false; break; case 2: if (ScanBaseView.this.bLongTouch) { moveTheTouchPoint(); break; } break; default: return false; } postInvalidate(); return true; } public void moveTheTouchPoint() { switch (ScanBaseView.this.getmWhere()) { case -1: _pBaseTopLeft = ScanBaseView.this.getmTouch(); _pBaseCenter = ScanBaseView.this.calculateTheCenterPoint(this._pBaseTopLeft, _pBaseBottomRight); break; case 0: moveCenter(); ScanBaseView.this.setmCenter(this._pBaseCenter); break; case 1: _pBaseBottomRight = ScanBaseView.this.getmTouch(); _pBaseCenter = ScanBaseView.this.calculateTheCenterPoint(this._pBaseTopLeft, _pBaseBottomRight); break; } ScanBaseView.this.setmTop(this._pBaseTopLeft); ScanBaseView.this.setmBot(this._pBaseBottomRight); ScanBaseView scanBaseView = ScanBaseView.this; scanBaseView.setPiBaseTop(new PointInfo(_pBaseTopLeft.x, _pBaseTopLeft.y)); ScanBaseView scanBaseView2 = ScanBaseView.this; scanBaseView2.setPiBaseBot(new PointInfo(_pBaseBottomRight.x, _pBaseBottomRight.y)); ScanBaseView.this.setmCenter(this._pBaseCenter); } private void moveCenter() { Point point = ScanBaseView.this.getmFirstTouch(); Point point2 = ScanBaseView.this.getmTouch(); int i = point2.x - point.x; int i2 = point2.y - point.y; _pBaseTopLeft.x += i; _pBaseTopLeft.y += i2; _pBaseBottomRight.x += i; _pBaseBottomRight.y += i2; _pBaseCenter.x += i; _pBaseCenter.y += i2; ScanBaseView.this.setmFirstTouch(point2); } private void drawNormalCorner(Canvas canvas) { switch (ScanBaseView.this.screenStatus) { case 2: drawCornerBotLeft(canvas, ScanBaseView.mTop); drawCornerTopRight(canvas, ScanBaseView.mBot); return; case 3: drawCornerBotRight(canvas, ScanBaseView.mTop); drawCornerTopLeft(canvas, ScanBaseView.mBot); return; case 4: drawCornerTopRight(canvas, ScanBaseView.mTop); drawCornerBotLeft(canvas, ScanBaseView.mBot); return; default: drawCornerTopLeft(canvas, ScanBaseView.mTop); drawCornerBotRight(canvas, ScanBaseView.mBot); return; } } private void drawCornerTopLeft(Canvas canvas, Point point) { Canvas canvas2 = canvas; canvas2.drawRect((float) (point.x - 6), (float) (point.y - 6), (float) ((point.x - 6) + 60), (float) point.y, ScanBaseView.this.getmPaint()); canvas2.drawRect((float) (point.x - 6), (float) (point.y - 6), (float) point.x, (float) ((point.y - 6) + 60), ScanBaseView.this.getmPaint()); } private void drawCornerBotRight(Canvas canvas, Point point) { Canvas canvas2 = canvas; canvas2.drawRect((float) ((point.x + 6) - 60), (float) point.y, (float) (point.x + 6), (float) (point.y + 6), ScanBaseView.this.getmPaint()); canvas2.drawRect((float) point.x, (float) ((point.y + 6) - 60), (float) (point.x + 6), (float) (point.y + 6), ScanBaseView.this.getmPaint()); } private void drawCornerBotLeft(Canvas canvas, Point point) { Canvas canvas2 = canvas; canvas2.drawRect((float) (point.x - 6), (float) point.y, (float) ((point.x - 6) + 60), (float) (point.y + 6), ScanBaseView.this.getmPaint()); canvas2.drawRect((float) (point.x - 6), (float) ((point.y + 6) - 60), (float) point.x, (float) (point.y + 6), ScanBaseView.this.getmPaint()); } private void drawCornerTopRight(Canvas canvas, Point point) { Canvas canvas2 = canvas; canvas2.drawRect((float) ((point.x + 6) - 60), (float) (point.y - 6), (float) (point.x + 6), (float) point.y, ScanBaseView.this.getmPaint()); canvas2.drawRect((float) point.x, (float) (point.y - 6), (float) (point.x + 6), (float) ((point.y - 6) + 60), ScanBaseView.this.getmPaint()); } private void drawCornerTopLeftMoving(Canvas canvas, Point point) { Canvas canvas2 = canvas; canvas2.drawRect((float) (point.x - 18), (float) (point.y - 18), (float) ((point.x - 18) + 150), (float) point.y, ScanBaseView.this.getmPaint()); canvas2.drawRect((float) (point.x - 18), (float) (point.y - 18), (float) point.x, (float) ((point.y - 18) + 150), ScanBaseView.this.getmPaint()); } private void drawCornerBotRightMoving(Canvas canvas, Point point) { Canvas canvas2 = canvas; canvas2.drawRect((float) ((point.x + 18) - 150), (float) point.y, (float) (point.x + 18), (float) (point.y + 18), ScanBaseView.this.getmPaint()); canvas2.drawRect((float) point.x, (float) ((point.y + 18) - 150), (float) (point.x + 18), (float) (point.y + 18), ScanBaseView.this.getmPaint()); } private void drawCornerBotLeftMoving(Canvas canvas, Point point) { Canvas canvas2 = canvas; canvas2.drawRect((float) (point.x - 18), (float) point.y, (float) ((point.x - 18) + 150), (float) (point.y + 18), ScanBaseView.this.getmPaint()); canvas2.drawRect((float) (point.x - 18), (float) ((point.y + 18) - 150), (float) point.x, (float) (point.y + 18), ScanBaseView.this.getmPaint()); } private void drawCornerTopRightMoving(Canvas canvas, Point point) { Canvas canvas2 = canvas; canvas2.drawRect((float) ((point.x + 18) - 150), (float) (point.y - 18), (float) (point.x + 18), (float) point.y, ScanBaseView.this.getmPaint()); canvas2.drawRect((float) point.x, (float) (point.y - 18), (float) (point.x + 18), (float) ((point.y - 18) + 150), ScanBaseView.this.getmPaint()); } } public void detectTheTouchPoint() { if (mTouch.x > Math.max(mTop.x, mBot.x) || mTouch.x < Math.min(mTop.x, mBot.x) || mTouch.y > Math.max(mTop.y, mBot.y) || mTouch.y < Math.min(mTop.y, mBot.y)) { EPLog.m313i(getLocalClassName(), "touche out"); if ((Math.abs(Math.min(mTop.x, mBot.x) - mTouch.x) >= SCAN_AREA_HOTSPOT_SIZE && Math.abs(mTouch.x - Math.max(mTop.x, mBot.x)) >= SCAN_AREA_HOTSPOT_SIZE) || (Math.abs(Math.min(mTop.y, mBot.y) - mTouch.y) >= SCAN_AREA_HOTSPOT_SIZE && Math.abs(mTouch.y - Math.max(mTop.y, mBot.y)) >= SCAN_AREA_HOTSPOT_SIZE)) { mWhere = 2; } else if (mTop.x >= mBot.x || mTop.y >= mBot.y) { if (mTop.x >= mBot.x || mTop.y <= mBot.y) { if (mTop.x <= mBot.x || mTop.y <= mBot.y) { if ((mTouch.x > mTop.x && Math.abs(mTouch.y - mTop.y) < SCAN_AREA_HOTSPOT_SIZE) || Math.abs(mTop.x - mTouch.x) < SCAN_AREA_HOTSPOT_SIZE) { mWhere = -1; } else if ((mTouch.x >= mBot.x || Math.abs(mTouch.y - mBot.y) >= SCAN_AREA_HOTSPOT_SIZE) && Math.abs(mTouch.x - mBot.x) >= SCAN_AREA_HOTSPOT_SIZE) { mWhere = 0; } else { mWhere = 1; } } else if ((mTouch.x > mTop.x && Math.abs(mTouch.y - mTop.y) < SCAN_AREA_HOTSPOT_SIZE) || Math.abs(mTop.x - mTouch.x) < SCAN_AREA_HOTSPOT_SIZE) { mWhere = -1; } else if ((mTouch.x >= mBot.x || Math.abs(mTouch.y - mBot.y) >= SCAN_AREA_HOTSPOT_SIZE) && Math.abs(mTouch.x - mBot.x) >= SCAN_AREA_HOTSPOT_SIZE) { mWhere = 0; } else { mWhere = 1; } } else if ((mTouch.x < mTop.x && Math.abs(mTouch.y - mTop.y) < SCAN_AREA_HOTSPOT_SIZE) || Math.abs(mTouch.x - mTop.x) < SCAN_AREA_HOTSPOT_SIZE) { mWhere = -1; } else if ((mTouch.x <= mBot.x || Math.abs(mTouch.y - mBot.y) >= SCAN_AREA_HOTSPOT_SIZE) && Math.abs(mBot.x - mTouch.x) >= SCAN_AREA_HOTSPOT_SIZE) { mWhere = 0; } else { mWhere = 1; } } else if ((mTouch.x < mTop.x && Math.abs(mTouch.y - mTop.y) < SCAN_AREA_HOTSPOT_SIZE) || Math.abs(mTouch.x - mTop.x) < SCAN_AREA_HOTSPOT_SIZE) { mWhere = -1; } else if ((mTouch.x <= mBot.x || Math.abs(mTouch.y - mBot.y) >= SCAN_AREA_HOTSPOT_SIZE) && Math.abs(mBot.x - mTouch.x) >= SCAN_AREA_HOTSPOT_SIZE) { mWhere = 0; } else { mWhere = 1; } } else { EPLog.m313i(getLocalClassName(), "touche in"); if (mTop.x >= mBot.x || mTop.y >= mBot.y) { if (mTop.x >= mBot.x || mTop.y <= mBot.y) { if (mTop.x <= mBot.x || mTop.y <= mBot.y) { if (Math.abs(mTop.x - mTouch.x) < SCAN_AREA_HOTSPOT_SIZE && mTouch.y - mTop.y < SCAN_AREA_HOTSPOT_SIZE) { mWhere = -1; } else if (Math.abs(mTouch.x - mBot.x) >= SCAN_AREA_HOTSPOT_SIZE || mBot.y - mTouch.y >= SCAN_AREA_HOTSPOT_SIZE) { mWhere = 0; } else { mWhere = 1; } } else if (Math.abs(mTop.x - mTouch.x) < SCAN_AREA_HOTSPOT_SIZE && mTop.y - mTouch.y < SCAN_AREA_HOTSPOT_SIZE) { mWhere = -1; } else if (Math.abs(mTouch.x - mBot.x) >= SCAN_AREA_HOTSPOT_SIZE || mTouch.y - mBot.y >= SCAN_AREA_HOTSPOT_SIZE) { mWhere = 0; } else { mWhere = 1; } } else if (Math.abs(mTouch.x - mTop.x) < SCAN_AREA_HOTSPOT_SIZE && mTop.y - mTouch.y < SCAN_AREA_HOTSPOT_SIZE) { mWhere = -1; } else if (Math.abs(mBot.x - mTouch.x) >= SCAN_AREA_HOTSPOT_SIZE || mTouch.y - mBot.y >= SCAN_AREA_HOTSPOT_SIZE) { mWhere = 0; } else { mWhere = 1; } } else if (Math.abs(mTouch.x - mTop.x) < SCAN_AREA_HOTSPOT_SIZE && mTouch.y - mTop.y < SCAN_AREA_HOTSPOT_SIZE) { mWhere = -1; } else if (Math.abs(mBot.x - mTouch.x) >= SCAN_AREA_HOTSPOT_SIZE || mBot.y - mTouch.y >= SCAN_AREA_HOTSPOT_SIZE) { mWhere = 0; } else { mWhere = 1; } } } public void detectTheScreenStatus() { if (mTop.x < mBot.x && mTop.y < mBot.y) { screenStatus = 1; } else if (mTop.x < mBot.x && mTop.y > mBot.y) { screenStatus = 2; } else if (mTop.x <= mBot.x || mTop.y <= mBot.y) { screenStatus = 4; } else { screenStatus = 3; } } class ScanAreaBackground extends View { Paint _paint = new Paint(); Paint _textPaint; boolean hideText; ScanActivity mScanActivity; String text; protected void onSizeChanged(int i, int i2, int i3, int i4) { super.onSizeChanged(i, i2, i3, i4); mScanActivity.onScanAreaSizeChange(); } /* access modifiers changed from: package-private */ public void drawTextInCanvas(Canvas canvas) { String str = new String(); float f = ((float) (ScanBaseView.this.getmBaseBot().x - ScanBaseView.this.getmBaseTop().x)) * 0.9f; float f2 = (float) (ScanBaseView.this.getmBaseBot().y - ScanBaseView.this.getmBaseTop().y); Rect rect = new Rect(); int length = text.length(); String str2 = str; int i = 0; int i2 = 0; while (i < length) { int breakText = _textPaint.breakText(this.text.substring(i, length), true, f, (float[]) null) + i; String substring = text.substring(i, breakText); _textPaint.getTextBounds(substring, 0, substring.length(), rect); i2 += rect.height(); str2 = (str2 + substring) + Constants.BREAK_LINE; i = breakText; } int i3 = (((float) ScanBaseView.this.getmBaseTop().x) + (((float) (ScanBaseView.this.getmBaseBot().x - ScanBaseView.this.getmBaseTop().x)) * 0.05f)); int i4 = ((((float) ScanBaseView.this.getmBaseTop().y) + (f2 / 2.0f)) - ((float) (i2 / 2))); String[] split = str2.split(Constants.BREAK_LINE); int i5 = 0; for (int i6 = 0; i6 < split.length; i6++) { canvas.drawText(split[i6], (float) i3, (float) (i4 + i5), _textPaint); _textPaint.getTextBounds(split[i6], 0, split[i6].length(), rect); i5 += rect.height(); } } public void hideText(boolean z) { hideText = z; } public ScanAreaBackground(Context context) { super(context); mScanActivity = (ScanActivity) context; _paint.setColor(-1); _paint.setShadowLayer(5.5f, 6.0f, 6.0f, R.color.light_gray); _textPaint = new Paint(); _textPaint.setColor(getResources().getColor(R.color.light_gray)); _textPaint.setAntiAlias(true); _textPaint.setTextAlign(Paint.Align.LEFT); _textPaint.setTextSize(new EditText(getContext()).getTextSize()); text = ScanBaseView.this.getString(R.string.str_msg_scan_viewbase); } protected void onDraw(Canvas canvas) { super.onDraw(canvas); drawTheDefaultBackground(canvas); } private void drawTheDefaultBackground(Canvas canvas) { canvas.drawRect((float) ScanBaseView.this.getmBaseTop().x, (float) ScanBaseView.this.getmBaseTop().y, (float) ScanBaseView.this.getmBaseBot().x, (float) ScanBaseView.this.getmBaseBot().y, _paint); if (!this.hideText) { drawTextInCanvas(canvas); } } } }