Example usage for android.view View INVISIBLE

List of usage examples for android.view View INVISIBLE

Introduction

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

Prototype

int INVISIBLE

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

Click Source Link

Document

This view is invisible, but it still takes up space for layout purposes.

Usage

From source file:de.sourcestream.movieDB.controller.TVDetails.java

/**
 * Called to have the fragment instantiate its user interface view.
 *
 * @param inflater           sets the layout for the current view.
 * @param container          the container which holds the current view.
 * @param savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given here.
 *                           Return the View for the fragment's UI, or null.
 *///from  ww  w . j  av  a  2  s . c  om
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    activity = ((MainActivity) getActivity());
    onGalleryIconClick = new onGalleryIconClick();
    onMoreIconClick = new onMoreIconClick();
    onHomeIconClick = new onHomeIconClick();
    onPageChangeSelected = new onPageChangeSelected();
    downAnimationListener = new DownAnimationListener();
    upAnimationListener = new UpAnimationListener();
    iconUpAnimationListener = new IconUpAnimationListener();
    iconDownAnimationListener = new IconDownAnimationListener();
    phone = getResources().getBoolean(R.bool.portrait_only);
    scale = getResources().getDisplayMetrics().density;
    if (phone) {
        hideThreshold = (int) (-105 * scale);
        minThreshold = (int) (-49 * scale);
    } else {
        hideThreshold = (int) (-100 * scale);
        minThreshold = (int) (-42 * scale);
    }

    if (currentId != this.getArguments().getInt("id") || this.timeOut == 1) {
        rootView = inflater.inflate(R.layout.tvdetails, container, false);
        spinner = (ProgressBar) rootView.findViewById(R.id.progressBar);

        homeIcon = (CircledImageView) rootView.findViewById(R.id.homeIcon);
        homeIcon.bringToFront();
        homeIcon.setVisibility(View.INVISIBLE);
        galleryIcon = (CircledImageView) rootView.findViewById(R.id.galleryIcon);
        galleryIcon.bringToFront();
        galleryIcon.setVisibility(View.INVISIBLE);

        // Highest Z-index has to be declared last
        moreIcon = (CircledImageView) rootView.findViewById(R.id.moreIcon);
        moreIcon.bringToFront();
    }
    moreIcon.setOnClickListener(onMoreIconClick);

    return rootView;
}

From source file:es.uniovi.imovil.fcrtrainer.BinaryExerciseFragment.java

private void updateToTrainMode() {
    gameMode = false;//from  w w  w  .j a  va2  s .c  o m

    Button solution = (Button) rootView.findViewById(R.id.seesolution);
    solution.setVisibility(View.VISIBLE);
    Button change = (Button) rootView.findViewById(R.id.change);
    change.setVisibility(View.VISIBLE);

    TextView points = (TextView) rootView.findViewById(R.id.points);
    points.setVisibility(View.INVISIBLE);
}

From source file:de.sourcestream.movieDB.controller.CastDetails.java

/**
 * Called to have the fragment instantiate its user interface view.
 *
 * @param inflater           sets the layout for the current view.
 * @param container          the container which holds the current view.
 * @param savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given here.
 *                           Return the View for the fragment's UI, or null.
 *///from w w  w .  ja va2 s .com
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    activity = ((MainActivity) getActivity());
    movieModel = new MovieModel();
    onGalleryIconClick = new onGalleryIconClick();
    onMoreIconClick = new onMoreIconClick();
    onHomeIconClick = new onHomeIconClick();
    onPageChangeSelected = new onPageChangeSelected();
    downAnimationListener = new DownAnimationListener();
    upAnimationListener = new UpAnimationListener();
    iconUpAnimationListener = new IconUpAnimationListener();
    iconDownAnimationListener = new IconDownAnimationListener();
    phone = getResources().getBoolean(R.bool.portrait_only);
    scale = getResources().getDisplayMetrics().density;
    if (phone) {
        hideThreshold = (int) (-105 * scale);
        minThreshold = (int) (-49 * scale);
    } else {
        hideThreshold = (int) (-100 * scale);
        minThreshold = (int) (-42 * scale);
    }

    if (currentId != this.getArguments().getInt("id") || this.timeOut == 1) {
        rootView = inflater.inflate(R.layout.castdetails, container, false);
        spinner = (ProgressBar) rootView.findViewById(R.id.progressBar);

        homeIcon = (CircledImageView) rootView.findViewById(R.id.homeIcon);
        homeIcon.bringToFront();
        homeIcon.setVisibility(View.INVISIBLE);

        galleryIcon = (CircledImageView) rootView.findViewById(R.id.galleryIcon);
        galleryIcon.bringToFront();
        galleryIcon.setVisibility(View.INVISIBLE);

        moreIcon = (CircledImageView) rootView.findViewById(R.id.moreIcon);
        moreIcon.bringToFront();
    }
    moreIcon.setOnClickListener(onMoreIconClick);

    return rootView;
}

From source file:com.facebook.android.friendsmash.ScoreboardFragment.java

private void populateScoreboard() {
    // Ensure all components are firstly removed from scoreboardContainer
    scoreboardContainer.removeAllViews();

    // Ensure the progress spinner is hidden
    progressContainer.setVisibility(View.INVISIBLE);

    // Ensure scoreboardEntriesList is not null and not empty first
    if (application.getScoreboardEntriesList() == null || application.getScoreboardEntriesList().size() <= 0) {
        closeAndShowError(getResources().getString(R.string.error_no_scores));
    } else {/*from www  .j av  a  2 s.c  om*/
        // Iterate through scoreboardEntriesList, creating new UI elements for each entry
        int index = 0;
        Iterator<ScoreboardEntry> scoreboardEntriesIterator = application.getScoreboardEntriesList().iterator();
        while (scoreboardEntriesIterator.hasNext()) {
            // Get the current scoreboard entry
            final ScoreboardEntry currentScoreboardEntry = scoreboardEntriesIterator.next();

            // FrameLayout Container for the currentScoreboardEntry ...

            // Create and add a new FrameLayout to display the details of this entry
            FrameLayout frameLayout = new FrameLayout(getActivity());
            scoreboardContainer.addView(frameLayout);

            // Set the attributes for this frameLayout
            int topPadding = getResources().getDimensionPixelSize(R.dimen.scoreboard_entry_top_margin);
            frameLayout.setPadding(0, topPadding, 0, 0);

            // ImageView background image ...
            {
                // Create and add an ImageView for the background image to this entry
                ImageView backgroundImageView = new ImageView(getActivity());
                frameLayout.addView(backgroundImageView);

                // Set the image of the backgroundImageView
                String uri = "drawable/scores_stub_even";
                if (index % 2 != 0) {
                    // Odd entry
                    uri = "drawable/scores_stub_odd";
                }
                int imageResource = getResources().getIdentifier(uri, null, getActivity().getPackageName());
                Drawable image = getResources().getDrawable(imageResource);
                backgroundImageView.setImageDrawable(image);

                // Other attributes of backgroundImageView to modify
                FrameLayout.LayoutParams backgroundImageViewLayoutParams = new FrameLayout.LayoutParams(
                        FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
                int backgroundImageViewMarginTop = getResources()
                        .getDimensionPixelSize(R.dimen.scoreboard_background_imageview_margin_top);
                backgroundImageViewLayoutParams.setMargins(0, backgroundImageViewMarginTop, 0, 0);
                backgroundImageViewLayoutParams.gravity = Gravity.LEFT;
                if (index % 2 != 0) {
                    // Odd entry
                    backgroundImageViewLayoutParams.gravity = Gravity.RIGHT;
                }
                backgroundImageView.setLayoutParams(backgroundImageViewLayoutParams);
            }

            // ProfilePictureView of the current user ...
            {
                // Create and add a ProfilePictureView for the current user entry's profile picture
                ProfilePictureView profilePictureView = new ProfilePictureView(getActivity());
                frameLayout.addView(profilePictureView);

                // Set the attributes of the profilePictureView
                int profilePictureViewWidth = getResources()
                        .getDimensionPixelSize(R.dimen.scoreboard_profile_picture_view_width);
                FrameLayout.LayoutParams profilePictureViewLayoutParams = new FrameLayout.LayoutParams(
                        profilePictureViewWidth, profilePictureViewWidth);
                int profilePictureViewMarginLeft = 0;
                int profilePictureViewMarginTop = getResources()
                        .getDimensionPixelSize(R.dimen.scoreboard_profile_picture_view_margin_top);
                int profilePictureViewMarginRight = 0;
                int profilePictureViewMarginBottom = 0;
                if (index % 2 == 0) {
                    profilePictureViewMarginLeft = getResources()
                            .getDimensionPixelSize(R.dimen.scoreboard_profile_picture_view_margin_left);
                } else {
                    profilePictureViewMarginRight = getResources()
                            .getDimensionPixelSize(R.dimen.scoreboard_profile_picture_view_margin_right);
                }
                profilePictureViewLayoutParams.setMargins(profilePictureViewMarginLeft,
                        profilePictureViewMarginTop, profilePictureViewMarginRight,
                        profilePictureViewMarginBottom);
                profilePictureViewLayoutParams.gravity = Gravity.LEFT;
                if (index % 2 != 0) {
                    // Odd entry
                    profilePictureViewLayoutParams.gravity = Gravity.RIGHT;
                }
                profilePictureView.setLayoutParams(profilePictureViewLayoutParams);

                // Finally set the id of the user to show their profile pic
                profilePictureView.setProfileId(currentScoreboardEntry.getId());
            }

            // LinearLayout to hold the text in this entry

            // Create and add a LinearLayout to hold the TextViews
            LinearLayout textViewsLinearLayout = new LinearLayout(getActivity());
            frameLayout.addView(textViewsLinearLayout);

            // Set the attributes for this textViewsLinearLayout
            FrameLayout.LayoutParams textViewsLinearLayoutLayoutParams = new FrameLayout.LayoutParams(
                    FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
            int textViewsLinearLayoutMarginLeft = 0;
            int textViewsLinearLayoutMarginTop = getResources()
                    .getDimensionPixelSize(R.dimen.scoreboard_textviews_linearlayout_margin_top);
            int textViewsLinearLayoutMarginRight = 0;
            int textViewsLinearLayoutMarginBottom = 0;
            if (index % 2 == 0) {
                textViewsLinearLayoutMarginLeft = getResources()
                        .getDimensionPixelSize(R.dimen.scoreboard_textviews_linearlayout_margin_left);
            } else {
                textViewsLinearLayoutMarginRight = getResources()
                        .getDimensionPixelSize(R.dimen.scoreboard_textviews_linearlayout_margin_right);
            }
            textViewsLinearLayoutLayoutParams.setMargins(textViewsLinearLayoutMarginLeft,
                    textViewsLinearLayoutMarginTop, textViewsLinearLayoutMarginRight,
                    textViewsLinearLayoutMarginBottom);
            textViewsLinearLayoutLayoutParams.gravity = Gravity.LEFT;
            if (index % 2 != 0) {
                // Odd entry
                textViewsLinearLayoutLayoutParams.gravity = Gravity.RIGHT;
            }
            textViewsLinearLayout.setLayoutParams(textViewsLinearLayoutLayoutParams);
            textViewsLinearLayout.setOrientation(LinearLayout.VERTICAL);

            // TextView with the position and name of the current user
            {
                // Set the text that should go in this TextView first
                int position = index + 1;
                String currentScoreboardEntryTitle = position + ". " + currentScoreboardEntry.getName();

                // Create and add a TextView for the current user position and first name
                TextView titleTextView = new TextView(getActivity());
                textViewsLinearLayout.addView(titleTextView);

                // Set the text and other attributes for this TextView
                titleTextView.setText(currentScoreboardEntryTitle);
                titleTextView.setTextAppearance(getActivity(), R.style.ScoreboardPlayerNameFont);
            }

            // TextView with the score of the current user
            {
                // Create and add a TextView for the current user score
                TextView scoreTextView = new TextView(getActivity());
                textViewsLinearLayout.addView(scoreTextView);

                // Set the text and other attributes for this TextView
                scoreTextView.setText("Score: " + currentScoreboardEntry.getScore());
                scoreTextView.setTextAppearance(getActivity(), R.style.ScoreboardPlayerScoreFont);
            }

            // Finally make this frameLayout clickable so that a game starts with the user smashing
            // the user represented by this frameLayout in the scoreContainer
            frameLayout.setOnTouchListener(new OnTouchListener() {

                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    if (event.getAction() == MotionEvent.ACTION_UP) {
                        Bundle bundle = new Bundle();
                        bundle.putString("user_id", currentScoreboardEntry.getId());

                        Intent i = new Intent();
                        i.putExtras(bundle);

                        getActivity().setResult(Activity.RESULT_FIRST_USER, i);
                        getActivity().finish();
                        return false;
                    } else {
                        return true;
                    }
                }

            });

            // Increment the index before looping back
            index++;
        }
    }
}

From source file:com.facebook.android.friendsmash.HomeActivity.java

private void showFragment(int fragmentIndex, boolean addToBackStack) {
    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction transaction = fm.beginTransaction();
    for (int i = 0; i < fragments.length; i++) {
        if (i == fragmentIndex) {
            transaction.show(fragments[i]);
        } else {/*from   www  .  j av a 2 s  .  c om*/
            transaction.hide(fragments[i]);
        }
    }
    if (addToBackStack) {
        transaction.addToBackStack(null);
    }
    transaction.commit();

    // Do other changes depending on the fragment that is now showing
    if (FriendSmashApplication.IS_SOCIAL) {
        switch (fragmentIndex) {
        case FB_LOGGED_OUT_HOME:
            // Hide the progressContainer in FBLoggedOutHomeFragment 
            if (fragments[FB_LOGGED_OUT_HOME] != null
                    && ((FBLoggedOutHomeFragment) fragments[FB_LOGGED_OUT_HOME]) != null) {
                ((FBLoggedOutHomeFragment) fragments[FB_LOGGED_OUT_HOME]).progressContainer
                        .setVisibility(View.INVISIBLE);
            }
            // Set the loggedIn attribute
            ((FriendSmashApplication) getApplication()).setLoggedIn(false);
            break;
        case HOME:
            // Update the youScoredTextView in HomeFragment
            if (fragments[HOME] != null) {
                ((HomeFragment) fragments[HOME]).updateYouScoredTextView();
                ((HomeFragment) fragments[HOME]).updateButtonVisibility();
            }
            // Set the loggedIn attribute
            ((FriendSmashApplication) getApplication()).setLoggedIn(true);
            break;
        }
    }
}

From source file:com.moods_final.moods.entertainment.VideoListDemoActivity.java

public void onClickClose(@SuppressWarnings("unused") View view) {
    listFragment.getListView().clearChoices();
    listFragment.getListView().requestLayout();
    videoFragment.pause();//from  ww w  . j  a v  a  2 s .  c  o  m
    videoBox.animate().translationYBy(videoBox.getHeight()).setDuration(ANIMATION_DURATION_MILLIS)
            .withEndAction(new Runnable() {
                @Override
                public void run() {
                    videoBox.setVisibility(View.INVISIBLE);
                }
            });
}

From source file:com.layer.atlas.AtlasMessagesList.java

public void init(final LayerClient layerClient, final Atlas.ParticipantProvider participantProvider) {
    if (layerClient == null)
        throw new IllegalArgumentException("LayerClient cannot be null");
    if (participantProvider == null)
        throw new IllegalArgumentException("ParticipantProvider cannot be null");

    this.client = layerClient;
    LayoutInflater.from(getContext()).inflate(R.layout.atlas_messages_list, this);

    // --- message view
    messagesList = (ListView) findViewById(R.id.atlas_messages_list);
    messagesList.setAdapter(messagesAdapter = new BaseAdapter() {

        public View getView(int position, View convertView, ViewGroup parent) {
            final Cell cell = cells.get(position);
            MessagePart part = cell.messagePart;
            String userId = part.getMessage().getSender().getUserId();

            boolean myMessage = client.getAuthenticatedUserId().equals(userId);

            if (convertView == null) {
                convertView = LayoutInflater.from(parent.getContext())
                        .inflate(R.layout.atlas_view_messages_convert, parent, false);
            }/*  w  w w  .ja v  a2  s  . c om*/

            View spacerTop = convertView.findViewById(R.id.atlas_view_messages_convert_spacer_top);
            spacerTop.setVisibility(
                    cell.clusterItemId == cell.clusterHeadItemId && !cell.timeHeader ? View.VISIBLE
                            : View.GONE);

            View spacerBottom = convertView.findViewById(R.id.atlas_view_messages_convert_spacer_bottom);
            spacerBottom.setVisibility(cell.clusterTail ? View.VISIBLE : View.GONE);

            // format date
            View timeBar = convertView.findViewById(R.id.atlas_view_messages_convert_timebar);
            TextView timeBarDay = (TextView) convertView
                    .findViewById(R.id.atlas_view_messages_convert_timebar_day);
            TextView timeBarTime = (TextView) convertView
                    .findViewById(R.id.atlas_view_messages_convert_timebar_time);
            if (cell.timeHeader) {

                Calendar cal = Calendar.getInstance();
                cal.set(Calendar.HOUR_OF_DAY, 0);
                cal.set(Calendar.MINUTE, 0);
                cal.set(Calendar.SECOND, 0);
                long todayMidnight = cal.getTimeInMillis();
                long yesterMidnight = todayMidnight - (24 * 60 * 60 * 1000); // 24h less
                Date sentAt = cell.messagePart.getMessage().getSentAt();
                if (sentAt == null)
                    sentAt = new Date();

                String timeBarTimeText = timeFormat.format(sentAt.getTime());
                String timeBarDayText = null;
                if (sentAt.getTime() > todayMidnight) {
                    timeBarDayText = "Today";
                } else if (sentAt.getTime() > yesterMidnight) {
                    timeBarDayText = "Yesterday";
                } else {
                    timeBarDayText = Tools.sdfDayOfWeek.format(sentAt);
                }
                timeBarDay.setText(timeBarDayText);
                timeBarTime.setText(timeBarTimeText);
                timeBar.setVisibility(View.VISIBLE);
            } else {
                timeBar.setVisibility(View.GONE);
            }

            TextView textAvatar = (TextView) convertView
                    .findViewById(R.id.atlas_view_messages_convert_initials);
            View spacerRight = convertView.findViewById(R.id.atlas_view_messages_convert_spacer_right);
            if (myMessage) {
                spacerRight.setVisibility(View.GONE);
                textAvatar.setVisibility(View.INVISIBLE);
            } else {
                spacerRight.setVisibility(View.VISIBLE);
                Atlas.Participant participant = participantProvider.getParticipant(userId);
                String displayText = participant != null ? Atlas.getInitials(participant) : "";
                textAvatar.setText(displayText);
                textAvatar.setVisibility(View.VISIBLE);
            }

            // mark unsent messages
            View cellContainer = convertView.findViewById(R.id.atlas_view_messages_cell_container);
            cellContainer.setAlpha(
                    (myMessage && !cell.messagePart.getMessage().isSent()) ? CELL_CONTAINER_ALPHA_UNSENT
                            : CELL_CONTAINER_ALPHA_SENT);

            // delivery receipt check
            TextView receiptView = (TextView) convertView
                    .findViewById(R.id.atlas_view_messages_convert_delivery_receipt);
            receiptView.setVisibility(View.GONE);
            if (latestDeliveredMessage != null
                    && latestDeliveredMessage.getId().equals(cell.messagePart.getMessage().getId())) {
                receiptView.setVisibility(View.VISIBLE);
                receiptView.setText("Delivered");
            }
            if (latestReadMessage != null
                    && latestReadMessage.getId().equals(cell.messagePart.getMessage().getId())) {
                receiptView.setVisibility(View.VISIBLE);
                receiptView.setText("Read");
            }

            // processing cell
            bindCell(convertView, cell);

            // mark displayed message as read
            Message msg = part.getMessage();
            if (!msg.getSender().getUserId().equals(client.getAuthenticatedUserId())) {
                msg.markAsRead();
            }

            timeBarDay.setTextColor(dateTextColor);
            timeBarTime.setTextColor(dateTextColor);
            textAvatar.setTextColor(avatarTextColor);
            ((GradientDrawable) textAvatar.getBackground()).setColor(avatarBackgroundColor);

            return convertView;
        }

        private void bindCell(View convertView, final Cell cell) {

            ViewGroup cellContainer = (ViewGroup) convertView
                    .findViewById(R.id.atlas_view_messages_cell_container);

            View cellRootView = cell.onBind(cellContainer);
            boolean alreadyInContainer = false;
            // cleanUp container
            cellRootView.setVisibility(View.VISIBLE);
            for (int iChild = 0; iChild < cellContainer.getChildCount(); iChild++) {
                View child = cellContainer.getChildAt(iChild);
                if (child != cellRootView) {
                    child.setVisibility(View.GONE);
                } else {
                    alreadyInContainer = true;
                }
            }
            if (!alreadyInContainer) {
                cellContainer.addView(cellRootView);
            }
        }

        public long getItemId(int position) {
            return position;
        }

        public Object getItem(int position) {
            return cells.get(position);
        }

        public int getCount() {
            return cells.size();
        }

    });

    messagesList.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Cell item = cells.get(position);
            if (clickListener != null) {
                clickListener.onItemClick(item);
            }
        }
    });
    // --- end of messageView

    updateValues();
}

From source file:com.dzt.uberclone.HomeFragment.java

private void postSendUberRequest(String json) {
    try {//from  w w  w. ja v a  2 s.co  m
        JSONObject jsonObject = new JSONObject(json);
        int pendingrideid = jsonObject.getInt("pending_ride_id");
        waitForUberDriver(pendingrideid);
    } catch (JSONException e) {
        e.printStackTrace();
    }

    showMSG("Waiting for a driver to accept");

    requestuber.setVisibility(View.INVISIBLE);
}

From source file:com.kakao.auth.authorization.authcode.KakaoWebViewDialog.java

@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView(int margin) {
    // TODO xml   ??
    FrameLayout webViewContainer = new FrameLayout(getContext());
    webView = new WebView(getContext());
    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebViewClient(new DialogWebViewClient());
    webView.setWebChromeClient(new KakaoWebChromeClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(url, headers);//www. j  av a2  s.  co m
    webView.canGoBack();
    webView.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    webView.setVisibility(View.INVISIBLE);
    webView.getSettings().setSaveFormData(KakaoSDK.getAdapter().getSessionConfig().isSaveFormData());
    webView.getSettings().setSavePassword(false);
    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    contentFrameLayout.addView(webViewContainer);
}