Example usage for android.view View isShown

List of usage examples for android.view View isShown

Introduction

In this page you can find the example usage for android.view View isShown.

Prototype

public boolean isShown() 

Source Link

Document

Returns the visibility of this view and all of its ancestors

Usage

From source file:Main.java

public static boolean isShown(View mContentLayout) {
    if (!mContentLayout.isShown())
        return false;
    ViewParent parent = mContentLayout.getParent();
    do {/* w  w  w  . j  a  v a  2 s. c om*/
        if (parent instanceof View && !((View) parent).isShown())
            return false;
        else
            System.out.println(parent.getClass());

    } while ((parent = parent.getParent()) != null);
    return true;
}

From source file:Main.java

public static void animateScaleOut(final View view) {
    if (!view.isShown()) {
        view.setScaleX(0.2f);/* ww w. j  a  v  a 2s  .co m*/
        view.setScaleY(0.2f);
        view.animate().setStartDelay(200).alpha(1).scaleX(1).scaleY(1)
                .setListener(new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animation) {

                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        view.setVisibility(View.VISIBLE);
                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {

                    }

                    @Override
                    public void onAnimationRepeat(Animator animation) {

                    }
                });
    }
}

From source file:com.techan.thirdparty.EmptyViewSwipeRefreshLayout.java

@Override
public boolean canChildScrollUp() {
    if (swipeableChildren != null) {
        // check if any supplied swipeable children can scroll up
        for (View view : swipeableChildren) {
            if (view.isShown() && ViewCompat.canScrollVertically(view, -1)) {
                // prevent refresh gesture
                return true;
            }/*w ww .j  av a 2s.c o  m*/
        }
    }
    return false;
}

From source file:cn.androidy.swiftlib.view.MultiSwipeRefreshLayout.java

/**
 * This method controls when the swipe-to-refresh gesture is triggered. By returning false here
 * we are signifying that the view is in a state where a refresh gesture can start.
 *
 * <p>As {@link android.support.v4.widget.SwipeRefreshLayout} only supports one direct child by
 * default, we need to manually iterate through our swipeable children to see if any are in a
 * state to trigger the gesture. If so we return false to start the gesture.
 *//*from ww w.jav a2s . c o m*/
@Override
public boolean canChildScrollUp() {
    if (mSwipeableChildren != null && mSwipeableChildren.length > 0) {
        // Iterate through the scrollable children and check if any of them can not scroll up
        for (View view : mSwipeableChildren) {
            if (view != null && view.isShown() && !canViewScrollUp(view)) {
                // If the view is shown, and can not scroll upwards, return false and start the
                // gesture.
                return false;
            }
        }
    }
    return true;
}

From source file:com.zagapps.eventblank.utils.MultiSwipeRefreshLayout.java

/**
 * This method controls when the swipe-to-refresh gesture is triggered. By returning false here
 * we are signifying that the view is in a state where a refresh gesture can start.
 *
 * <p>As {@link android.support.v4.widget.SwipeRefreshLayout} only supports one direct child by
 * default, we need to manually iterate through our swipeable children to see if any are in a
 * state to trigger the gesture. If so we return false to start the gesture.
 *//* w  ww. ja  v a2 s  .  co m*/
@Override
public boolean canChildScrollUp() {
    if (mSwipeableChildren != null && mSwipeableChildren.length > 0) {
        // Iterate through the scrollable children and check if any of them can not scroll up
        for (View view : mSwipeableChildren) {
            if (view != null && view.isShown() && !canViewScrollUp(view)) {
                return false;
            }
        }
    }
    return true;
}

From source file:com.microsoft.artcurator.ui.view.SwipeRefreshLayout.java

@Override
public boolean canChildScrollUp() {
    // look at our inner frame and iterate over the children
    ViewGroup inner = (ViewGroup) getChildAt(0);
    View child;
    for (int ii = 0; ii < inner.getChildCount(); ii++) {
        child = inner.getChildAt(ii);//from  w  w w  .j  a  v a 2  s .  c om
        if (child.isShown()) {
            return ViewCompat.canScrollVertically(child, -1);
        }
    }
    return super.canChildScrollUp();
}

From source file:cw.kop.autobackground.tutorial.CardFragment.java

@Override
public void onClick(View v) {
    View expandedView = v.findViewById(R.id.source_expand_container);
    if (expandedView.isShown()) {
        expandedView.setVisibility(View.GONE);
    } else {/*from  w  w w .  java  2s . c  om*/
        expandedView.setVisibility(View.VISIBLE);
    }
}

From source file:moe.yukinoneko.gcomic.module.gallery.external.ExternalGalleryActivity.java

public void toggleSystemUi() {
    boolean isShown = mToolbar.getAlpha() == 1.0f;
    ViewCompat.animate(mToolbar).alpha(isShown ? 0.0f : 1.0f).start();
    ViewCompat.animate(bottomBar).alpha(isShown ? 0.0f : 1.0f)
            .setListener(new ViewPropertyAnimatorListenerAdapter() {
                @Override//from  w w w  . jav a  2 s . c om
                public void onAnimationStart(View view) {
                    super.onAnimationStart(view);

                    if (view.isShown()) {
                        return;
                    }

                    view.setVisibility(View.VISIBLE);
                }

                @Override
                public void onAnimationEnd(View view) {
                    super.onAnimationEnd(view);

                    if (view.getAlpha() == 1.0f) {
                        return;
                    }

                    view.setVisibility(View.INVISIBLE);
                }
            }).start();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        mDecorView.setSystemUiVisibility(isShown ? FULL_SCREEN_FLAG : NOT_FULL_SCREEN_FLAG);
    }
}

From source file:com.blogspot.marioboehmer.thingibrowse.ThingResultListActivity.java

@Override
public void onNetworkError() {
    runOnUiThread(new Runnable() {
        @Override//  w ww .jav  a2s  .com
        public void run() {
            View progressBar = findViewById(android.R.id.empty);
            if (progressBar != null && progressBar.isShown()) {
                progressBar.setVisibility(View.GONE);
            }
            if (!wasNetworkErrorShown) {
                Toast.makeText(ThingResultListActivity.this, getString(R.string.network_error),
                        Toast.LENGTH_LONG).show();
            }
            wasNetworkErrorShown = true;
        }
    });
}

From source file:com.microsoft.office.integration.test.AbstractTest.java

private boolean isDialog(Activity activity, View decorView) {
    if (decorView == null || !decorView.isShown()) {
        return false;
    }//from   www .  ja  v a2s. c  o m
    Context viewContext = null;
    if (decorView != null) {
        viewContext = decorView.getContext();
    }

    if (viewContext instanceof ContextThemeWrapper) {
        ContextThemeWrapper ctw = (ContextThemeWrapper) viewContext;
        viewContext = ctw.getBaseContext();
    }
    Context activityContext = activity;
    Context activityBaseContext = activity.getBaseContext();
    return (activityContext.equals(viewContext) || activityBaseContext.equals(viewContext))
            && (decorView != activity.getWindow().getDecorView());
}