Example usage for android.view ViewTreeObserver removeOnGlobalLayoutListener

List of usage examples for android.view ViewTreeObserver removeOnGlobalLayoutListener

Introduction

In this page you can find the example usage for android.view ViewTreeObserver removeOnGlobalLayoutListener.

Prototype

public void removeOnGlobalLayoutListener(OnGlobalLayoutListener victim) 

Source Link

Document

Remove a previously installed global layout callback

Usage

From source file:org.linphone.compatibility.ApiTwentyOnePlus.java

public static void removeGlobalLayoutListener(ViewTreeObserver viewTreeObserver,
        OnGlobalLayoutListener keyboardListener) {
    viewTreeObserver.removeOnGlobalLayoutListener(keyboardListener);
}

From source file:Main.java

public static void removeGlobalLayout(ViewTreeObserver viewTreeObserver,
        ViewTreeObserver.OnGlobalLayoutListener layoutListener) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        viewTreeObserver.removeOnGlobalLayoutListener(layoutListener);
    } else {//from   w  w  w .  j  a  v a2s .  c o  m
        viewTreeObserver.removeGlobalOnLayoutListener(layoutListener);
    }

}

From source file:com.getkeepsafe.taptargetview.ViewUtil.java

@SuppressWarnings("deprecation")
static void removeOnGlobalLayoutListener(ViewTreeObserver observer,
        ViewTreeObserver.OnGlobalLayoutListener listener) {
    if (Build.VERSION.SDK_INT >= 16) {
        observer.removeOnGlobalLayoutListener(listener);
    } else {/* w w  w . java2  s.c om*/
        observer.removeGlobalOnLayoutListener(listener);
    }
}

From source file:Main.java

@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static final void removeOnGlobalLayoutListener(ViewTreeObserver viewTreeObserver,
        ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        viewTreeObserver.removeGlobalOnLayoutListener(onGlobalLayoutListener);
    } else {//from ww w  .  j  a  v a 2 s  .  c  o m
        viewTreeObserver.removeOnGlobalLayoutListener(onGlobalLayoutListener);
    }
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static void removeGlobalLayoutListener(final ViewTreeObserver viewTreeObserver,
        final ViewTreeObserver.OnGlobalLayoutListener listener) {
    if (viewTreeObserver == null) {
        return;/*from w  ww . j  av a 2 s  .co  m*/
    }
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        viewTreeObserver.removeGlobalOnLayoutListener(listener);
    } else {
        viewTreeObserver.removeOnGlobalLayoutListener(listener);
    }
}

From source file:com.hobby.uiframework.widget.PagerSlidingTab.java

public static void removeGlobalOnLayoutListener(ViewTreeObserver mViewTreeObserver,
        ViewTreeObserver.OnGlobalLayoutListener listener) {
    if (android.os.Build.VERSION.SDK_INT < 16) {
        mViewTreeObserver.removeGlobalOnLayoutListener(listener);
    } else {//from  www.j a va  2 s .  c om
        mViewTreeObserver.removeOnGlobalLayoutListener(listener);
    }
}

From source file:com.example.ray.firstapp.bottombar.BottomBarBadge.java

protected BottomBarBadge(Context context, final View tabToAddTo, // Rhyming accidentally! That's a Smoove Move!
        int backgroundColor) {
    super(context);

    setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    setGravity(Gravity.CENTER);//from  w  w w  .  java 2 s. c  o  m
    MiscUtils.setTextAppearance(this, R.style.BB_BottomBarBadge_Text);

    int three = MiscUtils.dpToPixel(context, 3);
    ShapeDrawable backgroundCircle = BadgeCircle.make(three * 3, backgroundColor);
    setPadding(three, three, three, three);
    setBackgroundCompat(backgroundCircle);

    getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @SuppressWarnings("deprecation")
        @Override
        public void onGlobalLayout() {
            adjustPositionAndSize(tabToAddTo);
            ViewTreeObserver obs = getViewTreeObserver();

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                obs.removeOnGlobalLayoutListener(this);
            } else {
                obs.removeGlobalOnLayoutListener(this);
            }
        }
    });
}

From source file:com.example.google.maps.folding_map.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();

    // Map can be null if there is a Google Play services issue.
    if (mMap != null) {
        // Wait until the map has loaded before we allow it to be folded.
        mMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
            @Override//  ww  w  . j a v  a 2  s .  c  om
            public void onMapLoaded() {
                mMapAction.setEnabled(true);
            }
        });
    }

    mFoldingLayout = (FoldingLayout) findViewById(R.id.folding_layout);

    // Wait until the FoldingLayout has be laid out; it needs dimensions.
    mFoldingLayout.getViewTreeObserver()
            .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @SuppressWarnings("deprecation")
                @SuppressLint("NewApi")
                @Override
                public void onGlobalLayout() {
                    mFoldingLayout.setNumberOfFolds(3);
                    mFoldingLayout.setBackgroundColor(Color.BLACK);
                    mFoldingLayout.setFoldListener(MainActivity.this);

                    ViewTreeObserver obs = mFoldingLayout.getViewTreeObserver();
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                        obs.removeOnGlobalLayoutListener(this);
                    } else {
                        obs.removeGlobalOnLayoutListener(this);
                    }
                }
            });

    mImageView = (ImageView) findViewById(R.id.image_view);
}

From source file:com.abcs.haiwaigou.yyg.view.ReadMoreTextView.java

private void onGlobalLayoutLineEndIndex() {
    if (trimMode == TRIM_MODE_LINES) {
        getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override//from  w  w w .  j a v a 2  s. c  o m
            public void onGlobalLayout() {
                ViewTreeObserver obs = getViewTreeObserver();
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                    obs.removeOnGlobalLayoutListener(this);
                } else {
                    obs.removeGlobalOnLayoutListener(this);
                }
                refreshLineEndIndex();
                setText();
            }
        });
    }
}

From source file:com.wenhui.syncedListView.demo.demo.SyncListViewContainerFragment.java

private void removeGlobalLayoutListenerWrapper(ViewTreeObserver observer, OnGlobalLayoutListener listener) {
    if (Build.VERSION.SDK_INT >= 16) {
        observer.removeOnGlobalLayoutListener(listener);
    } else {//from  ww  w  . j a v a2 s .  co m
        observer.removeGlobalOnLayoutListener(listener);
    }
}