List of usage examples for android.view View setWillNotDraw
public void setWillNotDraw(boolean willNotDraw)
From source file:io.plaidapp.core.ui.transitions.ReflowText.java
@Override public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) { if (startValues == null || endValues == null) return null; final View view = endValues.view; AnimatorSet transition = new AnimatorSet(); ReflowData startData = (ReflowData) startValues.values.get(PROPNAME_DATA); ReflowData endData = (ReflowData) endValues.values.get(PROPNAME_DATA); duration = calculateDuration(startData.bounds, endData.bounds); // create layouts & capture a bitmaps of the text in both states // (with max lines variants where needed) Layout startLayout = createLayout(startData, sceneRoot.getContext(), false); Layout endLayout = createLayout(endData, sceneRoot.getContext(), false); Layout startLayoutMaxLines = null;/*from w w w .j a va 2s . c om*/ Layout endLayoutMaxLines = null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // StaticLayout maxLines support if (startData.maxLines != -1) { startLayoutMaxLines = createLayout(startData, sceneRoot.getContext(), true); } if (endData.maxLines != -1) { endLayoutMaxLines = createLayout(endData, sceneRoot.getContext(), true); } } final Bitmap startText = createBitmap(startData, startLayoutMaxLines != null ? startLayoutMaxLines : startLayout); final Bitmap endText = createBitmap(endData, endLayoutMaxLines != null ? endLayoutMaxLines : endLayout); // temporarily turn off clipping so we can draw outside of our bounds don't draw view.setWillNotDraw(true); ((ViewGroup) view.getParent()).setClipChildren(false); // calculate the runs of text to move together List<Run> runs = getRuns(startData, startLayout, startLayoutMaxLines, endData, endLayout, endLayoutMaxLines); // create animators for moving, scaling and fading each run of text transition.playTogether(createRunAnimators(view, startData, endData, startText, endText, runs)); if (!freezeFrame) { transition.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { // clean up view.setWillNotDraw(false); view.getOverlay().clear(); ((ViewGroup) view.getParent()).setClipChildren(true); startText.recycle(); endText.recycle(); } }); } return transition; }
From source file:org.mozilla.gecko.GeckoApp.java
void addPluginView(final View view, final int x, final int y, final int w, final int h, final String metadata) { mMainHandler.post(new Runnable() { public void run() { PluginLayoutParams lp;/*w ww .j a va 2 s .c o m*/ Tabs tabs = Tabs.getInstance(); Tab tab = tabs.getSelectedTab(); if (tab == null) return; ViewportMetrics targetViewport = mLayerController.getViewportMetrics(); ViewportMetrics pluginViewport; try { JSONObject viewportObject = new JSONObject(metadata); pluginViewport = new ViewportMetrics(viewportObject); } catch (JSONException e) { Log.e(LOGTAG, "Bad viewport metadata: ", e); return; } if (mPluginContainer.indexOfChild(view) == -1) { lp = new PluginLayoutParams(x, y, w, h, pluginViewport); view.setWillNotDraw(false); if (view instanceof SurfaceView) { SurfaceView sview = (SurfaceView) view; sview.setZOrderOnTop(false); sview.setZOrderMediaOverlay(true); } mPluginContainer.addView(view, lp); tab.addPluginView(view); } else { lp = (PluginLayoutParams) view.getLayoutParams(); lp.reset(x, y, w, h, pluginViewport); lp.reposition(targetViewport); try { mPluginContainer.updateViewLayout(view, lp); view.setVisibility(View.VISIBLE); } catch (IllegalArgumentException e) { Log.i(LOGTAG, "e:" + e); // it can be the case where we // get an update before the view // is actually attached. } } } }); }