private void drawZoomLevel(Canvas canvas) { String zoomText = view.getZoom() + ""; float frac = view.getFloatZoom() - view.getZoom(); while (frac > OsmandMapTileView.ZOOM_DELTA_1) { frac -= OsmandMapTileView.ZOOM_DELTA_1; zoomText += "'"; } float length = zoomTextPaint.measureText(zoomText); if (zoomShadow.getBounds().width() == 0) { zoomShadow.setBounds( zoomInButton.getLeft() - 2, zoomInButton.getTop() - (int) (18 * scaleCoefficient), zoomInButton.getRight(), zoomInButton.getBottom()); } zoomShadow.draw(canvas); ShadowText.draw( zoomText, canvas, zoomInButton.getLeft() + (zoomInButton.getWidth() - length - 2) / 2, zoomInButton.getTop() + 4 * scaleCoefficient, zoomTextPaint, shadowColor); }
private void drawApplicationMode(Canvas canvas) { ApplicationMode appMode = view.getSettings().getApplicationMode(); if (appMode != cacheApplicationMode) { modeShadow.setBounds( backToMenuButton.getLeft() + (int) (2 * scaleCoefficient), backToMenuButton.getTop() - (int) (20 * scaleCoefficient), backToMenuButton.getRight() - (int) (4 * scaleCoefficient), backToMenuButton.getBottom()); if (appMode == ApplicationMode.CAR) { cacheAppModeIcon = view.getResources().getDrawable(R.drawable.car_small); } else if (appMode == ApplicationMode.BICYCLE) { cacheAppModeIcon = view.getResources().getDrawable(R.drawable.bicycle_small); } else if (appMode == ApplicationMode.PEDESTRIAN) { cacheAppModeIcon = view.getResources().getDrawable(R.drawable.pedestrian_small); } else { cacheAppModeIcon = view.getResources().getDrawable(R.drawable.default_mode_small); } int l = modeShadow.getBounds().left + (modeShadow.getBounds().width() - cacheAppModeIcon.getMinimumWidth()) / 2; int t = (int) (modeShadow.getBounds().top + 5 * scaleCoefficient); cacheAppModeIcon.setBounds( l, t, l + cacheAppModeIcon.getMinimumWidth(), t + cacheAppModeIcon.getMinimumHeight()); } modeShadow.draw(canvas); if (cacheAppModeIcon != null) { cacheAppModeIcon.draw(canvas); } }
@Override protected void setUp() throws Exception { super.setUp(); mActivity = getActivity(); mInstrumentation = getInstrumentation(); mButton = new Button(mActivity); mActivity.runOnUiThread( new Runnable() { public void run() { try { mActivity.addContentView( mButton, new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); } catch (Exception e) { mException = e; } } }); mInstrumentation.waitForIdleSync(); if (mException != null) { throw mException; } int right = mButton.getRight(); int bottom = mButton.getBottom(); mXInside = (mButton.getLeft() + right) / 3; mYInside = (mButton.getTop() + bottom) / 3; mRect = new Rect(); mButton.getHitRect(mRect); }
private void hideLogInButtonAndShowPanel() { int cx = (logInButton.getLeft() + logInButton.getRight()) / 2; int cy = logInButton.getBottom(); // get the final radius for the clipping circle int initialRadius = logInButton.getWidth(); // create and start the animator for this view // (the start radius is zero) ValueAnimator anim = ViewAnimationUtils.createCircularReveal(logInButton, cx, cy, initialRadius, 0); anim.addListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); logInButton.setVisibility(View.GONE); showLoginPanel(); } }); anim.setDuration(500).start(); }