Example usage for android.view View VISIBLE

List of usage examples for android.view View VISIBLE

Introduction

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

Prototype

int VISIBLE

To view the source code for android.view View VISIBLE.

Click Source Link

Document

This view is visible.

Usage

From source file:Main.java

private static void expandInner(final View view, final View parentView, final ViewGroup rootContainer,
        final int targtetHeight) {

    setHeight(view, 0);/*from  ww  w.j  a v a2  s  .  c  o  m*/
    view.setVisibility(View.VISIBLE);
    final Animation animation = new Animation() {

        private final Rect rect = new Rect();
        private final Rect parentVisibleRect = new Rect();

        ViewTreeObserver.OnGlobalLayoutListener globalLayoutListener;

        private final Runnable checkViewRunnable = new Runnable() {
            @Override
            public void run() {
                checkForViewInsideVisibleArea();
            }
        };

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {

            int neededHeight = interpolatedTime == 1 ? LayoutParams.WRAP_CONTENT
                    : (int) (targtetHeight * interpolatedTime);
            setHeight(view, neededHeight);

            final ViewTreeObserver viewTreeObserver = view.getViewTreeObserver();

            if (globalLayoutListener == null) {
                globalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {

                    @Override
                    public void onGlobalLayout() {

                        if (globalLayoutListener == null) {
                            removeGlobalLayoutListener(viewTreeObserver, this);
                        }

                        checkForViewInsideVisibleArea();
                    }
                };

                viewTreeObserver.addOnGlobalLayoutListener(globalLayoutListener);
            }

            if (globalLayoutListener != null && interpolatedTime == 1) {
                runInUIThread(checkViewRunnable);
                globalLayoutListener = null;
            }

            view.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }

        private void checkForViewInsideVisibleArea() {

            if (rootContainer.indexOfChild(parentView) == -1) {
                return;
            }

            parentVisibleRect.left = 0;
            parentVisibleRect.top = 0;
            parentVisibleRect.right = parentView.getWidth();
            parentVisibleRect.bottom = parentView.getHeight();

            rootContainer.offsetDescendantRectToMyCoords(parentView, parentVisibleRect);

            if (parentVisibleRect.top < 0 || parentVisibleRect.bottom > rootContainer.getHeight()) {

                rect.left = parentView.getLeft();
                rect.top = parentView.getTop();
                rect.right = parentView.getRight();
                rect.bottom = parentView.getBottom();

                parentView.requestRectangleOnScreen(rect, true);
            }
        }
    };

    animation.setDuration(ANIMATION_DURATION);
    view.startAnimation(animation);
}

From source file:cn.loveapple.client.android.util.ComponentUtil.java

/**
 * {@linkplain Activity}??/??{@linkplain View}?
 * //w w  w  .ja v  a2 s .  c om
 * @param target{@linkplain Activity}
 * @param visibleList
 * @param invisibleList
 * @param gonList
 */
public static void setVisibilityList(Activity target, View[] visibleList, View[] invisibleList,
        View[] goneList) {
    if (ArrayUtils.isNotEmpty(visibleList)) {
        for (View v : visibleList) {
            if (v == null) {
                continue;
            }
            v.setVisibility(View.VISIBLE);
        }
    }
    if (ArrayUtils.isNotEmpty(invisibleList)) {
        for (View v : invisibleList) {
            if (v == null) {
                continue;
            }
            v.setVisibility(View.INVISIBLE);
        }
    }
    if (ArrayUtils.isNotEmpty(goneList)) {
        for (View v : goneList) {
            if (v == null) {
                continue;
            }
            v.setVisibility(View.GONE);
        }
    }
}

From source file:com.microsoft.azure.engagement.ProductDiscountActivity.java

/**
 * Method that animates a view// w w w . j a  va 2 s.  c om
 *
 * @param view           The view to animate
 * @param objectAnimator The objectAnimator to play
 * @param isVisible      The visibility of the view at the end of the animation
 */
public static final void performAnimation(final View view, ObjectAnimator objectAnimator,
        final boolean isVisible) {
    view.setVisibility(View.VISIBLE);

    objectAnimator.setDuration(300);

    final AnimatorSet animatorSet = new AnimatorSet();

    animatorSet.play(objectAnimator);

    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setVisibility(isVisible ? View.VISIBLE : View.INVISIBLE);
        }
    });
    animatorSet.start();
}

From source file:com.memetro.android.alerts.CommentDialog.java

public static void showDialog(final Context context, String comment, String creator, boolean isMine,
        final Long id) {

    final Dialog mDialog = new Dialog(context);
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mDialog.setContentView(R.layout.comment_dialog);
    mDialog.setCancelable(true);//from  ww w  .  j  a v a  2s  . c om

    TextView titleText = (TextView) mDialog.findViewById(R.id.title);
    TextView messageText = (TextView) mDialog.findViewById(R.id.message);
    Button closeButton = (Button) mDialog.findViewById(R.id.close);
    Button deleteButton = (Button) mDialog.findViewById(R.id.delete);

    titleText.setText(titleText.getText().toString() + " " + creator);
    messageText.setMovementMethod(ScrollingMovementMethod.getInstance());
    messageText.setText(comment);

    if (isMine) {
        deleteButton.setVisibility(View.VISIBLE);
        deleteButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                new DeleteInBg(context, String.valueOf(id)).execute();
                mDialog.dismiss();
                // TODO Refrescar las alertas
            }
        });
    }

    closeButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            mDialog.dismiss();
        }
    });

    mDialog.show();

}

From source file:com.vrem.wifianalyzer.wifi.filter.EnumFilter.java

EnumFilter(@NonNull Map<T, Integer> ids, @NonNull U filter, @NonNull Dialog dialog, int id) {
    this.filter = filter;
    IterableUtils.forEach(ids.keySet(), new EnumFilterClosure(ids, dialog));
    dialog.findViewById(id).setVisibility(View.VISIBLE);
}

From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.AbstractSignBrowserTest.java

public static Matcher<RecyclerView.ViewHolder> getHolderForSignWithName(final String signNameLocaleDe) {
    Validate.notEmpty(signNameLocaleDe);
    return new BaseMatcher<RecyclerView.ViewHolder>() {

        @Override//  www .  ja  va2s . com
        public boolean matches(Object item) {
            Validate.isInstanceOf(SignBrowserAdapter.ViewHolder.class, item);
            final SignBrowserAdapter.ViewHolder holder = (SignBrowserAdapter.ViewHolder) item;
            boolean matches = false;
            if (!(null == holder.txtSignName)) {
                matches = ((signNameLocaleDe.equals(holder.txtSignName.getText().toString()))
                        && (View.VISIBLE == holder.txtSignName.getVisibility()));
            }
            return matches;
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("with sign name: " + signNameLocaleDe);
        }
    };
}

From source file:MainActivity.java

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

    final ImageView imageViewThumbnail = (ImageView) findViewById(R.id.imageViewThumbnail);
    imageViewThumbnail.setImageBitmap(loadSampledResource(R.drawable.image, 100, 100));
    imageViewThumbnail.setOnClickListener(new View.OnClickListener() {
        @Override//from w w w . j  av a  2 s . c o m
        public void onClick(View view) {
            zoomFromThumbnail((ImageView) view);
        }
    });
    mImageViewExpanded = (ImageView) findViewById(R.id.imageViewExpanded);
    mImageViewExpanded.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mImageViewExpanded.setVisibility(View.GONE);
            mImageViewExpanded.setImageBitmap(null);
            imageViewThumbnail.setVisibility(View.VISIBLE);
        }
    });
}

From source file:com.vrem.wifianalyzer.wifi.filter.SSIDFilter.java

SSIDFilter(@NonNull BasicFilterAdapter<String> filterAdapter, @NonNull Dialog dialog) {
    this.filterAdapter = filterAdapter;

    String value = StringUtils.join(filterAdapter.getValues(), SEPARATOR_CHAR);

    EditText editText = (EditText) dialog.findViewById(R.id.filterSSIDtext);
    editText.setText(value);/*from   w w  w  .  j a v  a  2s.c om*/
    editText.addTextChangedListener(new onChange());

    dialog.findViewById(R.id.filterSSID).setVisibility(View.VISIBLE);
}

From source file:com.manning.androidhacks.hack002.MainActivity.java

public void onShowMap(View v) {
    mViewStub.setVisibility(View.VISIBLE);
}

From source file:com.ternup.caddisfly.activity.VideoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_video);

    final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
    File sdDir = this.getExternalFilesDir(null);
    final File videoFile = new File(sdDir, "training.mp4");

    if (videoFile.exists()) {
        playVideo(videoFile);// www.ja  va 2 s .  c om
    } else {

        if (NetworkUtils.checkInternetConnection(this)) {
            progressBar.setVisibility(View.VISIBLE);
            downloading = true;
            AsyncHttpClient client = new AsyncHttpClient();
            client.get("http://caddisfly.ternup.com/akvoapp/caddisfly-training.mp4",
                    new FileAsyncHttpResponseHandler(videoFile) {
                        @Override
                        public void onFailure(int i, Header[] headers, Throwable throwable, File file) {
                            progressBar.setVisibility(View.GONE);
                        }

                        @Override
                        public void onSuccess(int statusCode, Header[] headers, File response) {
                            playVideo(response);
                            progressBar.setVisibility(View.GONE);
                        }

                        @Override
                        public void onProgress(int bytesWritten, int totalSize) {
                            //int progressPercentage = (int)100*bytesWritten/totalSize;
                            progressBar.setMax(totalSize);
                            progressBar.setProgress(bytesWritten);
                        }

                        @Override
                        public void onFinish() {
                            super.onFinish();
                            progressBar.setVisibility(View.GONE);
                            downloading = false;
                        }
                    });
        }
    }

}