private void animateSelectedBricks() { if (!animatedBricks.isEmpty()) { for (final Brick animationBrick : animatedBricks) { Animation animation = AnimationUtils.loadAnimation(context, R.anim.blink); animation.setAnimationListener( new AnimationListener() { @Override public void onAnimationStart(Animation animation) { animationBrick.setAnimationState(true); } @Override public void onAnimationRepeat(Animation animation) {} @Override public void onAnimationEnd(Animation animation) { animationBrick.setAnimationState(false); } }); int position = animatedBricks.indexOf(animationBrick); animationBrick.setAnimationState(true); View view = animationBrick.getView(context, position, this); if (view.hasWindowFocus()) { view.startAnimation(animation); } } } animatedBricks.clear(); }
/** Returns true when the last Activity is a WebappActivity and is ready for testing . */ private boolean isWebappActivityReady(Activity lastActivity) { if (!(lastActivity instanceof WebappActivity)) return false; WebappActivity webappActivity = (WebappActivity) lastActivity; if (webappActivity.getActivityTab() == null) return false; View rootView = webappActivity.findViewById(android.R.id.content); if (!rootView.hasWindowFocus()) return false; return true; }
/** * Call this when a view loses focus. * * @hide */ public void focusOut(View view) { synchronized (mH) { if (DEBUG) Log.v( TAG, "focusOut: " + view + " mServedView=" + mServedView + " winFocus=" + view.hasWindowFocus()); if (mServedView != view) { // The following code would auto-hide the IME if we end up // with no more views with focus. This can happen, however, // whenever we go into touch mode, so it ends up hiding // at times when we don't really want it to. For now it // seems better to just turn it all off. if (false && view.hasWindowFocus()) { mNextServedView = null; scheduleCheckFocusLocked(view); } } } }