Example usage for android.view View getVisibility

List of usage examples for android.view View getVisibility

Introduction

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

Prototype

@ViewDebug.ExportedProperty(mapping = { @ViewDebug.IntToString(from = VISIBLE, to = "VISIBLE"),
        @ViewDebug.IntToString(from = INVISIBLE, to = "INVISIBLE"),
        @ViewDebug.IntToString(from = GONE, to = "GONE") })
@Visibility
public int getVisibility() 

Source Link

Document

Returns the visibility status for this view.

Usage

From source file:com.csipsimple.ui.filters.AccountFiltersListFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ListView lv = getListView();//from   w  w  w .j a  v a  2s .  co  m

    //getListView().setSelector(R.drawable.transparent);
    lv.setCacheColorHint(Color.TRANSPARENT);

    // View management
    View detailsFrame = getActivity().findViewById(R.id.details);
    dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE;

    if (savedInstanceState != null) {
        // Restore last state for checked position.
        curCheckFilterId = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID);
        //curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD);
    }
    setListShown(false);
    if (mAdapter == null) {
        if (mHeaderView != null) {
            lv.addHeaderView(mHeaderView, null, true);
        }
        mAdapter = new AccountFiltersListAdapter(getActivity(), null);
        //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container));
        //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE);
        setListAdapter(mAdapter);
        registerForContextMenu(lv);

        lv.setVerticalFadingEdgeEnabled(true);
    }

    if (dualPane) {
        // In dual-pane mode, the list view highlights the selected item.
        Log.d("lp", "dual pane mode");
        lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        //lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT);
        lv.setVerticalScrollBarEnabled(false);
        lv.setFadingEdgeLength(50);

        updateCheckedItem();
        // Make sure our UI is in the correct state.
        //showDetails(curCheckPosition, curCheckWizard);
    } else {
        //getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT);
        lv.setVerticalScrollBarEnabled(true);
        lv.setFadingEdgeLength(100);
    }
}

From source file:ca.zadrox.dota2esportticker.ui.MatchActivity.java

private int getContentTopClearance() {

    View slidingTabs = findViewById(R.id.sliding_tabs);

    final boolean slidingTabsVisible = slidingTabs != null && slidingTabs.getVisibility() == View.VISIBLE;

    int actionBarClearance = UIUtils.calculateActionBarSize(this);
    int slidingTabsClearance = slidingTabsVisible
            ? getResources().getDimensionPixelSize(R.dimen.tab_indicator_height)
            : 0;/*from  w  w w  . j  a v a2  s  . c om*/
    int gridPadding = getResources().getDimensionPixelSize(R.dimen.explore_grid_padding);

    int contentTopPadding = actionBarClearance + slidingTabsClearance + gridPadding;

    setProgressBarTopWhenActionBarShown(actionBarClearance + slidingTabsClearance);
    //mDrawShadowFrameLayout.setShadowTopOffset(actionBarClearance + secondaryClearance);

    return contentTopPadding;
}

From source file:com.bydavy.card.receipts.activities.ReceiptListActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_receipt_list);
    mLoadingView = findViewById(R.id.loading_container);
    mContentView = findViewById(R.id.content_container);
    setupActionBar();// w  ww .j  a  va 2  s. c  om

    final View detailFrame = findViewById(FRAGMENT_PAGER_FRAGMENT_ID);
    mDualPane = (detailFrame != null) && (detailFrame.getVisibility() == View.VISIBLE);

    if (savedInstanceState != null) {
        mReceiptListFragment = (ReceiptListFragment) getSupportFragmentManager()
                .findFragmentById(FRAGMENT_RECEIPT_LIST_ID);
        if (mDualPane) {
            mPagerFragment = (ReceiptPagerFragment) getSupportFragmentManager()
                    .findFragmentById(FRAGMENT_PAGER_FRAGMENT_ID);
        }

        final int navListIndex = savedInstanceState.getInt(SAVED_STATE_NAVIGATION_LIST_INDEX);
        // We are going to recreate fragments accordingly to navListIndex
        // saved (Easier to handle that reusing)
        getSupportActionBar().setSelectedNavigationItem(navListIndex);

        if ((getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE)
                && AndroidUtils.isScreenSizeBiggerOrEqual(getResources(),
                        Configuration.SCREENLAYOUT_SIZE_LARGE)) {
            final int index = savedInstanceState.getInt(SAVED_STATE_LIST_INDEX);

            // In this case we need open the receipt pager
            startActivityReceiptPager(index, mReceiptListFragment.getCursorSelection(),
                    mReceiptListFragment.getCursorSelectionArgs(), mReceiptListFragment.getCursorSortOrder());
        }
    }

    // sampleData();
}

From source file:com.actionbarsherlock.internal.widget.IcsAbsSpinner.java

/**
 * Maps a point to a position in the list.
 *
 * @param x X in local coordinate//from w  w w  .j ava  2 s  .  c om
 * @param y Y in local coordinate
 * @return The position of the item which contains the specified point, or
 *         {@link #INVALID_POSITION} if the point does not intersect an item.
 */
public int pointToPosition(int x, int y) {
    Rect frame = mTouchFrame;
    if (frame == null) {
        mTouchFrame = new Rect();
        frame = mTouchFrame;
    }

    final int count = getChildCount();
    for (int i = count - 1; i >= 0; i--) {
        View child = getChildAt(i);
        if (child.getVisibility() == View.VISIBLE) {
            child.getHitRect(frame);
            if (frame.contains(x, y)) {
                return mFirstPosition + i;
            }
        }
    }
    return INVALID_POSITION;
}

From source file:com.github.rubensousa.stackview.StackView.java

private void updateViews() {
    View view = mViews.remove(0);
    mViews.add(view);/*w  w  w .ja v  a  2 s . c  om*/

    // Animate translation and scaling
    for (int i = 0; i < mViews.size() - 1; i++) {
        view = mViews.get(i);
        if (view.getVisibility() == View.VISIBLE) {
            setupView(view, i);
        } else {
            // Set a random rotation
            view.setRotation(nextRotation());
        }
    }
}

From source file:com.battlelancer.seriesguide.ui.EpisodesActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_episodes);
    setupActionBar();/*  ww w.j  a v  a2  s. co  m*/
    setupNavDrawer();

    // if coming from a notification, set last cleared time
    NotificationService.handleDeleteIntent(this, getIntent());

    // check for dual pane layout
    View pager = findViewById(R.id.pagerEpisodes);
    mDualPane = pager != null && pager.getVisibility() == View.VISIBLE;

    boolean isFinishing = false;

    // check if we have a certain episode to display
    final int episodeId = getIntent().getIntExtra(InitBundle.EPISODE_TVDBID, 0);
    if (episodeId != 0) {
        if (!mDualPane) {
            // display just the episode pager in its own activity
            Intent intent = new Intent(this, EpisodeDetailsActivity.class);
            intent.putExtra(EpisodeDetailsActivity.InitBundle.EPISODE_TVDBID, episodeId);
            startActivity(intent);
            isFinishing = true;
        } else {
            // get season id
            final Cursor episode = getContentResolver().query(
                    Episodes.buildEpisodeUri(String.valueOf(episodeId)),
                    new String[] { Episodes._ID, Seasons.REF_SEASON_ID }, null, null, null);
            if (episode != null && episode.moveToFirst()) {
                mSeasonId = episode.getInt(1);
            } else {
                // could not get season id
                isFinishing = true;
            }
            if (episode != null) {
                episode.close();
            }
        }
    }

    if (isFinishing) {
        finish();
        return;
    }

    if (mSeasonId == 0) {
        mSeasonId = getIntent().getIntExtra(InitBundle.SEASON_TVDBID, 0);
    }

    // get show id and season number
    final Cursor season = getContentResolver().query(Seasons.buildSeasonUri(String.valueOf(mSeasonId)),
            new String[] { Seasons._ID, Seasons.COMBINED, Shows.REF_SHOW_ID }, null, null, null);
    if (season != null && season.moveToFirst()) {
        mSeasonNumber = season.getInt(1);
        mShowId = season.getInt(2);
    } else {
        isFinishing = true;
    }
    if (season != null) {
        season.close();
    }

    if (isFinishing) {
        finish();
        return;
    }

    final Series show = DBUtils.getShow(this, mShowId);
    if (show == null) {
        finish();
        return;
    }

    setupActionBar(show);

    // check if we should start at a certain position
    int startPosition = 0;
    if (mDualPane) {
        // also build episode list for view pager
        startPosition = updateEpisodeList(episodeId);
    }

    // setup the episode list fragment
    if (savedInstanceState == null) {
        mEpisodesFragment = EpisodesFragment.newInstance(mShowId, mSeasonId, mSeasonNumber, startPosition);
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(R.id.fragment_episodes, mEpisodesFragment, "episodes").commit();
    } else {
        mEpisodesFragment = (EpisodesFragment) getSupportFragmentManager().findFragmentByTag("episodes");
    }

    // setup the episode view pager if available
    if (mDualPane) {
        // set the pager background
        Utils.loadPosterBackground(this, (ImageView) findViewById(R.id.background), show.getPoster());

        // setup view pager
        mAdapter = new EpisodePagerAdapter(this, getSupportFragmentManager(), mEpisodes, true);
        mPager = (ViewPager) pager;
        mPager.setAdapter(mAdapter);

        // setup tabs
        mTabs = (SlidingTabLayout) findViewById(R.id.tabsEpisodes);
        mTabs.setCustomTabView(R.layout.tabstrip_item, R.id.textViewTabStripItem);
        mTabs.setSelectedIndicatorColors(
                getResources().getColor(Utils.resolveAttributeToResourceId(getTheme(), R.attr.colorAccent)));
        mTabs.setBottomBorderColor(Utils.setColorAlpha(
                getResources().getColor(
                        Utils.resolveAttributeToResourceId(getTheme(), R.attr.sgColorTabStripUnderline)),
                0x26));
        mTabs.setViewPager(mPager);

        // set page listener afterwards to avoid null pointer for
        // non-existing content view
        mPager.setCurrentItem(startPosition, false);
        mTabs.setOnPageChangeListener(mOnPageChangeListener);
    } else {
        // Make sure no fragments are left over from a config
        // change
        for (Fragment fragment : getActiveFragments()) {
            if (fragment.getTag() == null) {
                Timber.d("Removing a leftover fragment");
                getSupportFragmentManager().beginTransaction().remove(fragment).commit();
            }
        }
    }

    updateShowDelayed(mShowId);
}

From source file:com.iangclifton.android.floatlabel.FloatLabel.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void layoutChild(View child, int parentLeft, int parentTop, int parentRight, int parentBottom) {
    if (child.getVisibility() != GONE) {
        final LayoutParams lp = (LayoutParams) child.getLayoutParams();

        final int width = child.getMeasuredWidth();
        final int height = child.getMeasuredHeight();

        int childLeft;
        final int childTop = parentTop + lp.topMargin;

        int gravity = lp.gravity;
        if (gravity == -1) {
            gravity = Gravity.TOP | Gravity.START;
        }//  w ww  .j  av  a  2s  .  c  o  m

        final int layoutDirection;
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
            layoutDirection = LAYOUT_DIRECTION_LTR;
        } else {
            layoutDirection = getLayoutDirection();
        }

        final int absoluteGravity = GravityCompat.getAbsoluteGravity(gravity, layoutDirection);

        switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
        case Gravity.CENTER_HORIZONTAL:
            childLeft = parentLeft + (parentRight - parentLeft - width) / 2 + lp.leftMargin - lp.rightMargin;
            break;
        case Gravity.RIGHT:
            childLeft = parentRight - width - lp.rightMargin;
            break;
        case Gravity.LEFT:
        default:
            childLeft = parentLeft + lp.leftMargin;
        }

        child.layout(childLeft, childTop, childLeft + width, childTop + height);
    }
}

From source file:com.astuetz.viewpager.extensions.SwipeyTabsView.java

/**
 * {@inheritDoc}//from   ww  w  . j av a2 s .c  o  m
 */
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

    int maxTabHeight = 0;

    mWidthMeasureSpec = widthMeasureSpec;
    mHeightMeasureSpec = heightMeasureSpec;

    final int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec),
            MeasureSpec.AT_MOST);
    final int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec),
            MeasureSpec.AT_MOST);

    for (int i = 0; i < mTabsCount; i++) {
        final View child = getChildAt(i);

        if (child.getVisibility() == GONE)
            continue;

        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);

        mPositions.get(i).width = child.getMeasuredWidth();
        mPositions.get(i).height = child.getMeasuredHeight();

        maxTabHeight = Math.max(maxTabHeight, mPositions.get(i).height);
    }

    setMeasuredDimension(resolveSize(0, widthMeasureSpec),
            resolveSize(maxTabHeight + getPaddingTop() + getPaddingBottom(), heightMeasureSpec));

}

From source file:semanticweb.hws14.movapp.activities.MovieDetail.java

private void initDetailView() {
    btnSpoiler = (Button) findViewById(R.id.btnSpoiler);
    btnActorList = (Button) findViewById(R.id.btnToActorList);
    btnImdbPage = (Button) findViewById(R.id.btnLinkImdB);
    btnSpoiler = (Button) findViewById(R.id.btnSpoiler);
    btnRandomRelatedMovies = (Button) findViewById(R.id.btnRandomRelatedMovies);
    btnRelatedMovies = (Button) findViewById(R.id.btnRelatedMovies);

    btnSpoiler.setOnClickListener(new View.OnClickListener() {
        @Override/*from  w w  w  .j  a v a 2s  .  c o m*/
        public void onClick(View v) {
            View wikiAbs = findViewById(R.id.tvWikiAbstract);
            if (wikiAbs.getVisibility() == View.VISIBLE) {
                wikiAbs.setVisibility(View.GONE);
            } else {
                wikiAbs.setVisibility(View.VISIBLE);
            }
        }
    });
}

From source file:android.support.transition.ChangeTransform.java

private void captureValues(TransitionValues transitionValues) {
    View view = transitionValues.view;
    if (view.getVisibility() == View.GONE) {
        return;/*  ww  w. ja  v a 2  s  .  c  o  m*/
    }
    transitionValues.values.put(PROPNAME_PARENT, view.getParent());
    Transforms transforms = new Transforms(view);
    transitionValues.values.put(PROPNAME_TRANSFORMS, transforms);
    Matrix matrix = view.getMatrix();
    if (matrix == null || matrix.isIdentity()) {
        matrix = null;
    } else {
        matrix = new Matrix(matrix);
    }
    transitionValues.values.put(PROPNAME_MATRIX, matrix);
    if (mReparent) {
        Matrix parentMatrix = new Matrix();
        ViewGroup parent = (ViewGroup) view.getParent();
        ViewUtils.transformMatrixToGlobal(parent, parentMatrix);
        parentMatrix.preTranslate(-parent.getScrollX(), -parent.getScrollY());
        transitionValues.values.put(PROPNAME_PARENT_MATRIX, parentMatrix);
        transitionValues.values.put(PROPNAME_INTERMEDIATE_MATRIX, view.getTag(R.id.transition_transform));
        transitionValues.values.put(PROPNAME_INTERMEDIATE_PARENT_MATRIX, view.getTag(R.id.parent_matrix));
    }
}