Java Code Examples for android.view.View.GONE

The following are Jave code examples for showing how to use GONE of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: PageScrollView   File: PageScrollView.java   View Source Code Vote up 7 votes
public int indexOfItemView(View view) {
    if (view != null) {
        int virtualIndex = 0;
        final int count = getChildCount();
        for (int i = 0; i < count; i++) {
            final View child = getChildAt(i);
            if ((child.getVisibility() == View.GONE) || (child == mPageHeaderView || child == mPageFooterView))
                continue;
            if (view == child) {
                return virtualIndex;
            }
            virtualIndex++;
        }
    }
    return -1;
}
 
Example 2
Project: TripBuyer   File: SellerTravelDetailsActivity.java   View Source Code Vote up 7 votes
@OnClick(R.id.down)
public void down() {
    if (mFlowLayout2.getVisibility() == View.VISIBLE) {
        mFlowLayout2.setVisibility(View.GONE);
        KLog.i("---lin---> ok1111");
        return;
    }


    if (mFlowLayout2.getVisibility() == View.GONE) {
        mFlowLayout2.setVisibility(View.VISIBLE);
        KLog.i("---lin---> ok2222");
    }


    KLog.i("---lin---> ok");
}
 
Example 3
Project: BubbleAlert   File: ScreenUtils.java   View Source Code Vote up 7 votes
public static View getMeasuredViewForAlertDialog(LayoutInflater inflater, int itemId, int btnCount, String content, int width, boolean hasEditText) {

        View view = inflater.inflate(itemId, null);
        if (btnCount == 1) {
            view.findViewById(R.id.btnCancel).setVisibility(View.GONE);
        } else if (btnCount == 3) {
            view.findViewById(R.id.btnCancel).setVisibility(View.VISIBLE);
            view.findViewById(R.id.btnExit).setVisibility(View.VISIBLE);
        } else {
            view.findViewById(R.id.btnCancel).setVisibility(View.VISIBLE);
        }
        ((TextView) view.findViewById(R.id.txtContent)).setText(content);

        int visibility = hasEditText ? View.VISIBLE : View.GONE;
        view.findViewById(R.id.edtLibName).setVisibility(visibility);
        view.measure(View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY),
                View.MeasureSpec.makeMeasureSpec(view.getHeight(), View.MeasureSpec.UNSPECIFIED));

        return view;
    }
 
Example 4
Project: translucent_layout   File: TranslucentKit.java   View Source Code Vote up 7 votes
/**
 * Measure parent view as pure view group.
 */
public void onMeasurePureViewGroup() {
  if (!fitSystemEnabled || mLastInsets == null) {
    return;
  }
  if (!exactParentHeightInit) {
    exactParentHeightInit = true;
    exactParentHeight = readParentHeight(injectParent, 0);
  }

  final int childCount = injectParent.getChildCount();
  for (int i = 0; i < childCount; i++) {
    final View child = injectParent.getChildAt(i);

    if (child.getVisibility() == View.GONE) {
      continue;
    }

    final ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) child.getLayoutParams();

    injectWindowInsets(child, lp);
  }
}
 
Example 5
Project: GCWeather   File: ChooseAreaFragment.java   View Source Code Vote up 7 votes
private void queryCounties(){
    titleText.setText(selectedCity.getCityName());
    if (backButton.getVisibility() == View.GONE){
        backButton.setVisibility(View.VISIBLE);
    }
    countyList = DataSupport
            .where("cityid = ?", String.valueOf(selectedCity.getId()))
            .find(County.class);
    if (countyList.size() > 0){
        dataList.clear();
        for (County county : countyList){
            dataList.add(county.getCountyName());
        }
        adapter.notifyDataSetChanged();
        listView.setSelection(0);
        currentLevel = LEVEL_COUNTY;
    }else {
        int provinceCode = selectedProvince.getProvinceCode();
        int cityCode = selectedCity.getCityCode();
        String address = "http://www.guolin.tech/api/china/"+provinceCode+"/"+cityCode;
        queryFromServer(address, "county");
    }

}
 
Example 6
Project: airgram   File: VideoEditorActivity.java   View Source Code Vote up 6 votes
private void updateVideoEditedInfo() {
    if (editedSizeTextView == null) {
        return;
    }
    esimatedDuration = (long) Math.ceil((videoTimelineView.getRightProgress() - videoTimelineView.getLeftProgress()) * videoDuration);

    int width;
    int height;

    if (compressVideo.getVisibility() == View.GONE || compressVideo.getVisibility() == View.VISIBLE && !compressVideo.isChecked()) {
        width = rotationValue == 90 || rotationValue == 270 ? originalHeight : originalWidth;
        height = rotationValue == 90 || rotationValue == 270 ? originalWidth : originalHeight;
        estimatedSize = (int) (originalSize * ((float) esimatedDuration / videoDuration));
    } else {
        width = rotationValue == 90 || rotationValue == 270 ? resultHeight : resultWidth;
        height = rotationValue == 90 || rotationValue == 270 ? resultWidth : resultHeight;
        estimatedSize = calculateEstimatedSize((float) esimatedDuration / videoDuration);
    }

    if (videoTimelineView.getLeftProgress() == 0) {
        startTime = -1;
    } else {
        startTime = (long) (videoTimelineView.getLeftProgress() * videoDuration) * 1000;
    }
    if (videoTimelineView.getRightProgress() == 1) {
        endTime = -1;
    } else {
        endTime = (long) (videoTimelineView.getRightProgress() * videoDuration) * 1000;
    }

    String videoDimension = String.format("%dx%d", width, height);
    int minutes = (int) (esimatedDuration / 1000 / 60);
    int seconds = (int) Math.ceil(esimatedDuration / 1000) - minutes * 60;
    String videoTimeSize = String.format("%d:%02d, ~%s", minutes, seconds, AndroidUtilities.formatFileSize(estimatedSize));
    editedSizeTextView.setText(String.format("%s, %s", videoDimension, videoTimeSize));
}
 
Example 7
Project: Hitalk   File: BlackboardFragmentLayout.java   View Source Code Vote up 6 votes
public void updateEditTextBodyVisible(int visibility, CommentConfig commentConfig) {
    mCommentConfig = commentConfig;
    mCommentLayout.setVisibility(visibility);

    measureBNItemHighAndCommentItemOffset(commentConfig);

    if(View.VISIBLE==visibility){
        mCet.requestFocus();
        Utils.showSoftInput( mCet.getContext(),  mCet);

    }else if(View.GONE==visibility){
        Utils.hideSoftInput( mCet.getContext(),  mCet);
    }
}
 
Example 8
Project: Hitalk   File: RichAutoCompleteTextView.java   View Source Code Vote up 6 votes
private void updateDropDownForFilter(int count) {
    if (getWindowVisibility() == View.GONE) return;
    final boolean enoughToFilter = enoughToFilter();
    if (count > 0 && enoughToFilter) {
        if (hasFocus() && hasWindowFocus()) {
            showDropDown();
        }
    } else if (isPopupShowing()) {
        dismissDropDown();
    }
}
 
Example 9
Project: FinalProject   File: ActivityInteractionFragment.java   View Source Code Vote up 6 votes
private void showEmptyView() {
    if (no_post_layout.getVisibility() == View.GONE) {
        no_post_layout.setVisibility(View.VISIBLE);
        progressBar.setVisibility(View.GONE);
        no_post_textview.setText("You need to like or Comment other users posts to see their posts here");
    }
}
 
Example 10
Project: easyfilemanager   File: FabSpeedDialBehaviour.java   View Source Code Vote up 6 votes
/**
     * Pre-Lollipop we use padding so that the shadow has enough space to be drawn. This method
     * offsets our layout position so that we're positioned correctly if we're on one of
     * our parent's edges.
     */
/*    private void offsetIfNeeded(CoordinatorLayout parent, FabSpeedDial fab) {
        final Rect padding = fab.mShadowPadding;

        if (padding != null && padding.centerX() > 0 && padding.centerY() > 0) {
            final CoordinatorLayout.LayoutParams lp =
                    (CoordinatorLayout.LayoutParams) fab.getLayoutParams();

            int offsetTB = 0, offsetLR = 0;

            if (fab.getRight() >= parent.getWidth() - lp.rightMargin) {
                // If we're on the left edge, shift it the right
                offsetLR = padding.right;
            } else if (fab.getLeft() <= lp.leftMargin) {
                // If we're on the left edge, shift it the left
                offsetLR = -padding.left;
            }
            if (fab.getBottom() >= parent.getBottom() - lp.bottomMargin) {
                // If we're on the bottom edge, shift it down
                offsetTB = padding.bottom;
            } else if (fab.getTop() <= lp.topMargin) {
                // If we're on the top edge, shift it up
                offsetTB = -padding.top;
            }

            fab.offsetTopAndBottom(offsetTB);
            fab.offsetLeftAndRight(offsetLR);
        }
    }*/

    @Override
    public void onNestedScroll(CoordinatorLayout coordinatorLayout, FabSpeedDial child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
        super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
        if(dyConsumed > 0 && child.getVisibility() == View.VISIBLE){
            child.hide();
        } else if(dyConsumed < 0 && child.getVisibility() == View.GONE){
            child.show();
        }
    }
 
Example 11
Project: cwac-crossport   File: CoordinatorLayout.java   View Source Code Vote up 6 votes
/**
   * Get the position rect for the given child. If the child has currently requested layout
   * or has a visibility of GONE.
 *
 * @param child child view to check
   * @param transform true to include transformation in the output rect, false to
   *                        only account for the base position
 * @param out rect to set to the output values
 */
void getChildRect(View child, boolean transform, Rect out) {
  if (child.isLayoutRequested() || child.getVisibility() == View.GONE) {
    out.setEmpty();
    return;
  }
  if (transform) {
    getDescendantRect(child, out);
  } else {
    out.set(child.getLeft(), child.getTop(), child.getRight(), child.getBottom());
  }
}
 
Example 12
Project: FlickLauncher   File: WorkspaceStateTransitionAnimation.java   View Source Code Vote up 6 votes
public static void updateVisibility(View view, boolean accessibilityEnabled) {
    // We want to avoid the extra layout pass by setting the views to GONE unless
    // accessibility is on, in which case not setting them to GONE causes a glitch.
    int invisibleState = accessibilityEnabled ? View.GONE : View.INVISIBLE;
    if (view.getAlpha() < ALPHA_CUTOFF_THRESHOLD && view.getVisibility() != invisibleState) {
        view.setVisibility(invisibleState);
    } else if (view.getAlpha() > ALPHA_CUTOFF_THRESHOLD
            && view.getVisibility() != View.VISIBLE) {
        view.setVisibility(View.VISIBLE);
    }
}
 
Example 13
Project: CSipSimple   File: ActionBarImpl.java   View Source Code Vote up 6 votes
@Override
public void hide() {
    if (mCurrentShowAnim != null) {
        mCurrentShowAnim.end();
    }
    if (mContainerView.getVisibility() == View.GONE) {
        return;
    }

    if (mShowHideAnimationEnabled) {
        mContainerView.setAlpha(1);
        mContainerView.setTransitioning(true);
        AnimatorSet anim = new AnimatorSet();
        AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mContainerView, "alpha", 0));
        if (mContentView != null) {
            b.with(ObjectAnimator.ofFloat(mContentView, "translationY",
                    0, -mContainerView.getHeight()));
            b.with(ObjectAnimator.ofFloat(mContainerView, "translationY",
                    -mContainerView.getHeight()));
        }
        if (mSplitView != null && mSplitView.getVisibility() == View.VISIBLE) {
            mSplitView.setAlpha(1);
            b.with(ObjectAnimator.ofFloat(mSplitView, "alpha", 0));
        }
        anim.addListener(mHideListener);
        mCurrentShowAnim = anim;
        anim.start();
    } else {
        mHideListener.onAnimationEnd(null);
    }
}
 
Example 14
Project: chat-sdk-android-push-firebase   File: PickerFragment.java   View Source Code Vote up 6 votes
@Override
void updateCheckboxState(CheckBox checkBox, boolean graphObjectSelected) {
    checkBox.setChecked(graphObjectSelected);
    int visible = (graphObjectSelected || selectionStrategy
            .shouldShowCheckBoxIfUnselected()) ? View.VISIBLE : View.GONE;
    checkBox.setVisibility(visible);
}
 
Example 15
Project: OSchina_resources_android   File: NoteEditFragment.java   View Source Code Vote up 6 votes
@Override
public boolean onTouch(View v, MotionEvent event) {
    if (MotionEvent.ACTION_DOWN == event.getAction()) {
        if (mLayoutMenu.getVisibility() == View.GONE) {
            openMenu();
        } else {
            closeMenu();
        }
    }
    return true;
}
 
Example 16
Project: underlx   File: InstantAutoComplete.java   View Source Code Vote up 6 votes
@Override
protected void onFocusChanged(boolean focused, int direction,
                              Rect previouslyFocusedRect) {
    super.onFocusChanged(focused, direction, previouslyFocusedRect);
    if (getWindowVisibility() == View.GONE) {
        // avoid crashing on rotation
        return;
    }
    if (focused && getAdapter() != null) {
        performFiltering(getText(), 0);
        showDropDown();
    }
}
 
Example 17
Project: spline   File: LayerRowViewModel.java   View Source Code Vote up 5 votes
@Bindable({"visible", "selected"})
public int getVisibleToggleVisibility() {
    return !isVisible() || isSelected() ? View.VISIBLE : View.GONE;
}
 
Example 18
Project: RecyclerViewPreferences   File: NumberSetting.java   View Source Code Vote up 5 votes
public int getSeekbarVisibility() {
    return (this == DialogInput || this == DialogSeekbar) ? View.GONE : View.VISIBLE;
}
 
Example 19
Project: LittleFlickr   File: PhotoWallFragment.java   View Source Code Vote up 5 votes
private void showProgressDialog() {
    if (mProgressBar.getVisibility() == View.GONE) {
        mProgressBar.setVisibility(View.VISIBLE);
    }

}
 
Example 20
Project: codedemos   File: CoordingtorLayoutActivity.java   View Source Code Vote up 5 votes
private void hideToolBar() {
    if (binding.toolbar.getVisibility() != View.GONE) {
        binding.toolbar.setVisibility(View.GONE);
    }
}