Java Code Examples for android.view.ViewGroup#invalidate()

The following examples show how to use android.view.ViewGroup#invalidate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EnterTransitionCoordinator.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private void triggerViewsReady(final ArrayMap<String, View> sharedElements) {
    if (mAreViewsReady) {
        return;
    }
    mAreViewsReady = true;
    final ViewGroup decor = getDecor();
    // Ensure the views have been laid out before capturing the views -- we need the epicenter.
    if (decor == null || (decor.isAttachedToWindow() &&
            (sharedElements.isEmpty() || !sharedElements.valueAt(0).isLayoutRequested()))) {
        viewsReady(sharedElements);
    } else {
        mViewsReadyListener = OneShotPreDrawListener.add(decor, () -> {
            mViewsReadyListener = null;
            viewsReady(sharedElements);
        });
        decor.invalidate();
    }
}
 
Example 2
Source File: DotWidget.java    From star-zone-android with Apache License 2.0 6 votes vote down vote up
private void addDot(View target) {
    ViewGroup.LayoutParams targetViewParams = target.getLayoutParams();
    ViewGroup.LayoutParams newTargetViewParams = new ViewGroup.LayoutParams(targetViewParams.width, targetViewParams.height);
    targetViewParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
    targetViewParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    //new一个容器
    container = new FrameLayout(getContext());
    container.setClipToPadding(false);

    ViewGroup parent = (ViewGroup) target.getParent();
    int index = parent.indexOfChild(target);
    //去掉目标view
    parent.removeView(target);
    //添加容器
    parent.addView(container, index, targetViewParams);

    //容器添加目标view
    container.addView(target, newTargetViewParams);
    setVisibility(GONE);
    //容器添加本view(红点)
    container.addView(this);
    parent.invalidate();
}
 
Example 3
Source File: BadgeView.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
private void a(View view)
{
    android.view.ViewGroup.LayoutParams layoutparams = view.getLayoutParams();
    android.view.ViewParent viewparent = view.getParent();
    FrameLayout framelayout = new FrameLayout(i);
    if (view instanceof TabWidget)
    {
        View view1 = ((TabWidget)view).getChildTabViewAt(q);
        j = view1;
        ((ViewGroup)view1).addView(framelayout, new android.view.ViewGroup.LayoutParams(-1, -1));
        setVisibility(8);
        framelayout.addView(this);
        return;
    } else
    {
        ViewGroup viewgroup = (ViewGroup)viewparent;
        int i1 = viewgroup.indexOfChild(view);
        viewgroup.removeView(view);
        viewgroup.addView(framelayout, i1, layoutparams);
        framelayout.addView(view);
        setVisibility(8);
        framelayout.addView(this);
        viewgroup.invalidate();
        return;
    }
}
 
Example 4
Source File: ExitTransitionCoordinator.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void startExitTransition() {
    Transition transition = getExitTransition();
    ViewGroup decorView = getDecor();
    if (transition != null && decorView != null && mTransitioningViews != null) {
        setTransitioningViewsVisiblity(View.VISIBLE, false);
        TransitionManager.beginDelayedTransition(decorView, transition);
        setTransitioningViewsVisiblity(View.INVISIBLE, false);
        decorView.invalidate();
    } else {
        transitionStarted();
    }
}
 
Example 5
Source File: BottomRedPointView.java    From letv with Apache License 2.0 5 votes vote down vote up
private void applyTo(View target) {
    LayoutParams lp = target.getLayoutParams();
    ViewParent parent = target.getParent();
    FrameLayout container = new FrameLayout(this.context);
    ViewGroup group = (ViewGroup) parent;
    int index = group.indexOfChild(target);
    group.removeView(target);
    group.addView(container, index, lp);
    container.addView(target);
    container.addView(this);
    group.invalidate();
}
 
Example 6
Source File: BoardAdapter.java    From BoardView with Apache License 2.0 5 votes vote down vote up
public void removeColumn(int index){
    BoardItem item = (BoardItem)((ViewGroup)((ViewGroup)boardView.getChildAt(0)).getChildAt(0)).getChildAt(index);
    ViewGroup group = ((ViewGroup) item.getParent());
    ((ViewGroup)item.getParent()).removeView(item);
    columns.remove(index);
    group.invalidate();
}
 
Example 7
Source File: BadgeView.java    From umeng_community_android with MIT License 5 votes vote down vote up
private void applyTo(View target) {

        LayoutParams lp = target.getLayoutParams();
        ViewParent parent = target.getParent();
        FrameLayout container = new FrameLayout(context);

        if (target instanceof TabWidget) {
            // set target to the relevant tab child container
            target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
            this.target = target;

            ((ViewGroup) target).addView(container,
                    new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

            this.setVisibility(View.GONE);
            container.addView(this);
        } else {
            ViewGroup group = (ViewGroup) parent;
            int index = group.indexOfChild(target);

            group.removeView(target);
            group.addView(container, index, lp);

            container.addView(target);

            this.setVisibility(View.GONE);
            container.addView(this);

            group.invalidate();

        }

    }
 
Example 8
Source File: ParallaxTransformer.java    From FamilyChat with Apache License 2.0 5 votes vote down vote up
private void bringViewToFront(View view) {
    ViewGroup group = (ViewGroup) view.getParent();
    int index = group.indexOfChild(view);
    if (index != group.getChildCount() - 1) {
        view.bringToFront();
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
            view.requestLayout();
            group.invalidate();
        }
    }
}
 
Example 9
Source File: TrashView.java    From FloatingView with Apache License 2.0 4 votes vote down vote up
/**
 * Clear the animation garbage of the target view.
 */
private static void clearClippedChildren(ViewGroup viewGroup) {
    viewGroup.setClipChildren(true);
    viewGroup.invalidate();
    viewGroup.setClipChildren(false);
}
 
Example 10
Source File: BadgeView.java    From android-project-wo2b with Apache License 2.0 4 votes vote down vote up
private void applyTo(View target)
{

	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);

	if (target instanceof TabWidget)
	{

		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;

		((ViewGroup) target).addView(container,
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

		this.setVisibility(View.GONE);
		container.addView(this);

	}
	else
	{

		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent;
		int index = group.indexOfChild(target);

		group.removeView(target);
		group.addView(container, index, lp);

		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);

		group.invalidate();

	}

}
 
Example 11
Source File: BadgeView.java    From android-discourse with Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {

        LayoutParams lp = target.getLayoutParams();
        ViewParent parent = target.getParent();
        FrameLayout container = new FrameLayout(context);

        if (target instanceof TabWidget) {

            // set target to the relevant tab child container
            target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
            this.target = target;

            ((ViewGroup) target).addView(container, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

            this.setVisibility(View.GONE);
            container.addView(this);

        } else {

            // TODO verify that parent is indeed a ViewGroup
            ViewGroup group = (ViewGroup) parent;
            int index = group.indexOfChild(target);

            group.removeView(target);
            group.addView(container, index, lp);

            container.addView(target);

            this.setVisibility(View.GONE);
            container.addView(this);

            group.invalidate();

        }

    }
 
Example 12
Source File: BadgeView.java    From android-common-utils with Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 13
Source File: BadgeView.java    From RefreshActionItem with Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 14
Source File: BadgeView.java    From BigApp_Discuz_Android with Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 15
Source File: BadgeView.java    From RefreshActionItem-Native with Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 16
Source File: BadgeView.java    From aptoide-client with GNU General Public License v2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container,
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent;
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 17
Source File: BadgeView.java    From xmpp with Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 18
Source File: BadgeView.java    From tysq-android with GNU General Public License v3.0 3 votes vote down vote up
private void applyTo(View target) {

        LayoutParams lp = target.getLayoutParams();
        ViewParent parent = target.getParent();
        FrameLayout container = new FrameLayout(context);

        if (target instanceof TabWidget) {

            // set target to the relevant tab child container
            target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
            this.target = target;

            ((ViewGroup) target).addView(container,
                    new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

            this.setVisibility(View.GONE);
            container.addView(this);

        } else {

            // TODO verify that parent is indeed a ViewGroup
            ViewGroup group = (ViewGroup) parent;
            int index = group.indexOfChild(target);

            group.removeView(target);
            group.addView(container, index, lp);

            container.addView(target);

            this.setVisibility(View.GONE);
            container.addView(this);

            group.invalidate();

        }

    }
 
Example 19
Source File: BadgeView.java    From RefreshActionItem with Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 20
Source File: BadgeView.java    From RefreshActionItem-Native with Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}