Example usage for android.view ViewGroup post

List of usage examples for android.view ViewGroup post

Introduction

In this page you can find the example usage for android.view ViewGroup post.

Prototype

public boolean post(Runnable action) 

Source Link

Document

Causes the Runnable to be added to the message queue.

Usage

From source file:io.github.douglasjunior.androidSimpleTooltip.SimpleTooltip.java

public void show() {
    verifyDismissed();/*from   w  w  w  . j  a v  a  2s. co  m*/
    final ViewGroup rootView = (ViewGroup) mAnchorView.getRootView();

    createOverlay(rootView);

    mContentLayout.getViewTreeObserver().addOnGlobalLayoutListener(mLocationLayoutListener);

    rootView.post(new Runnable() {
        @Override
        public void run() {
            mPopupWindow.showAtLocation(rootView, Gravity.NO_GRAVITY, rootView.getWidth(),
                    rootView.getHeight());
        }
    });
}

From source file:com.jins_meme.bridge.MainActivity.java

void changeSettingButton(final boolean isRev) {
    final String overflowDesc = getString(R.string.accessibility_overflow);

    final ViewGroup decor = (ViewGroup) getWindow().getDecorView();

    decor.post(new Runnable() {
        @Override/*from w w  w.  j a v  a  2  s . c o  m*/
        public void run() {
            final ArrayList<View> outViews = new ArrayList<>();

            decor.findViewsWithText(outViews, overflowDesc, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);

            if (outViews.isEmpty()) {
                return;
            }

            ImageView overflow = (ImageView) outViews.get(0);
            if (isRev) {
                overflow.setImageResource(R.mipmap.ic_setting_rev);
            } else {
                overflow.setImageResource(R.mipmap.ic_setting);
            }
        }
    });
}

From source file:com.gigabytedevelopersinc.app.calculator.Calculator.java

private void removeCling(int id) {
    setPagingEnabled(true);//from   w  ww.  jav  a 2 s .  c  o  m
    clingActive = false;

    final View cling = findViewById(id);
    if (cling != null) {
        final ViewGroup parent = (ViewGroup) cling.getParent();
        parent.post(new Runnable() {
            @Override
            public void run() {
                parent.removeView(cling);
            }
        });
    }
}

From source file:com.android.launcher2.Launcher.java

private void removeCling(int id) {
    final View cling = findViewById(id);
    if (cling != null) {
        final ViewGroup parent = (ViewGroup) cling.getParent();
        parent.post(new Runnable() {
            @Override/*from   w  ww.  j a v a  2s. c  o  m*/
            public void run() {
                parent.removeView(cling);
            }
        });
        mHideFromAccessibilityHelper.restoreImportantForAccessibility(mDragLayer);
    }
}