Java Code Examples for android.view.View#INVISIBLE

The following examples show how to use android.view.View#INVISIBLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TranslateUpDownBehavior.java    From okhttp-OkGo with Apache License 2.0 6 votes vote down vote up
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
    if (((dyConsumed > 0 && dyUnconsumed == 0) || (dyConsumed == 0 && dyUnconsumed > 0)) && !isAnimating && child.getVisibility() == View.VISIBLE) {
        if (listener != null) listener.onChange(true);
        AnimHelper.translateDown(child, new MyViewPropertyAnimatorListener() {
            @Override
            public void onAnimationEnd(View view) {
                super.onAnimationEnd(view);
                view.setVisibility(View.INVISIBLE);
            }
        });
    } else if ((dyConsumed < 0 && dyUnconsumed == 0) || (dyConsumed == 0 && dyUnconsumed < 0) && !isAnimating && child.getVisibility() == View.INVISIBLE) {
        if (listener != null) listener.onChange(false);
        child.setVisibility(View.VISIBLE);
        AnimHelper.translateUp(child, null);
    }
}
 
Example 2
Source File: IntroActivity.java    From SlidingIntroScreen with Apache License 2.0 6 votes vote down vote up
/**
 * Enables or disables the final button, so that it matches the current member variables.
 */
private void reflectMemberVariablesInFinalButton() {
	// Determine whether or not changes need to occur
	final boolean lastPageReached = (viewPager.getCurrentItem() + 1) == pages.size();
	final boolean buttonShouldBeInvisible = !lastPageReached || finalButtonDisabled;
	final boolean buttonIsCurrentlyInvisible = finalButton.getVisibility() == View.INVISIBLE;
	final boolean shouldUpdateButton = buttonShouldBeInvisible != buttonIsCurrentlyInvisible;

	// Apply changes if necessary
	if (shouldUpdateButton) {
		final Animator buttonAnimator = buttonShouldBeInvisible ?
				buttonAnimatorFactory.newFinalButtonDisappearAnimator(finalButton) :
				buttonAnimatorFactory.newFinalButtonAppearAnimator(finalButton);

		if (buttonShouldBeInvisible) {
			disableButton(buttonAnimator, finalButton);
		} else {
			enableButton(buttonAnimator, finalButton);
		}
	}
}
 
Example 3
Source File: CustomViewBehind.java    From Moring-Alarm with Apache License 2.0 6 votes vote down vote up
public void scrollBehindTo(View content, int x, int y) {
	int vis = View.VISIBLE;		
	if (mMode == SlidingMenu.LEFT) {
		if (x >= content.getLeft()) vis = View.INVISIBLE;
		scrollTo((int)((x + getBehindWidth())*mScrollScale), y);
	} else if (mMode == SlidingMenu.RIGHT) {
		if (x <= content.getLeft()) vis = View.INVISIBLE;
		scrollTo((int)(getBehindWidth() - getWidth() + 
				(x-getBehindWidth())*mScrollScale), y);
	} else if (mMode == SlidingMenu.LEFT_RIGHT) {
		mContent.setVisibility(x >= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
		mSecondaryContent.setVisibility(x <= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
		vis = x == 0 ? View.INVISIBLE : View.VISIBLE;
		if (x <= content.getLeft()) {
			scrollTo((int)((x + getBehindWidth())*mScrollScale), y);				
		} else {
			scrollTo((int)(getBehindWidth() - getWidth() + 
					(x-getBehindWidth())*mScrollScale), y);				
		}
	}
	if (vis == View.INVISIBLE)
		Log.v(TAG, "behind INVISIBLE");
	setVisibility(vis);
}
 
Example 4
Source File: InputMethodService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
void updateExtractFrameVisibility() {
    final int vis;
    if (isFullscreenMode()) {
        vis = mExtractViewHidden ? View.INVISIBLE : View.VISIBLE;
        // "vis" should be applied for the extract frame as well in the fullscreen mode.
        mExtractFrame.setVisibility(vis);
    } else {
        vis = View.VISIBLE;
        mExtractFrame.setVisibility(View.GONE);
    }
    updateCandidatesVisibility(mCandidatesVisibility == View.VISIBLE);
    if (mWindowWasVisible && mFullscreenArea.getVisibility() != vis) {
        int animRes = mThemeAttrs.getResourceId(vis == View.VISIBLE
                ? com.android.internal.R.styleable.InputMethodService_imeExtractEnterAnimation
                : com.android.internal.R.styleable.InputMethodService_imeExtractExitAnimation,
                0);
        if (animRes != 0) {
            mFullscreenArea.startAnimation(AnimationUtils.loadAnimation(
                    this, animRes));
        }
    }
    mFullscreenArea.setVisibility(vis);
}
 
Example 5
Source File: CustomViewBehind.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
public void scrollBehindTo(View content, int x, int y) {
	int vis = View.VISIBLE;		
	if (mMode == SlidingMenu.LEFT) {
		if (x >= content.getLeft()) vis = View.INVISIBLE;
		scrollTo((int)((x + getBehindWidth())*mScrollScale), y);
	} else if (mMode == SlidingMenu.RIGHT) {
		if (x <= content.getLeft()) vis = View.INVISIBLE;
		scrollTo((int)(getBehindWidth() - getWidth() + 
				(x-getBehindWidth())*mScrollScale), y);
	} else if (mMode == SlidingMenu.LEFT_RIGHT) {
		mContent.setVisibility(x >= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
		mSecondaryContent.setVisibility(x <= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
		vis = x == 0 ? View.INVISIBLE : View.VISIBLE;
		if (x <= content.getLeft()) {
			scrollTo((int)((x + getBehindWidth())*mScrollScale), y);				
		} else {
			scrollTo((int)(getBehindWidth() - getWidth() + 
					(x-getBehindWidth())*mScrollScale), y);				
		}
	}
	if (vis == View.INVISIBLE)
		Log.v(TAG, "behind INVISIBLE");
	setVisibility(vis);
}
 
Example 6
Source File: MessageButtonBehaviourOnPageSelected.java    From material-intro-screen with MIT License 6 votes vote down vote up
@Override
public void pageSelected(int position) {
    final SlideFragment slideFragment = adapter.getItem(position);

    if (slideFragment.hasAnyPermissionsToGrant()) {
        showMessageButton(slideFragment);
        messageButton.setText(slideFragment.getActivity().getString(R.string.grant_permissions));
        messageButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                slideFragment.askForPermissions();
            }
        });
    } else if (checkIfMessageButtonHasBehaviour(position)) {
        showMessageButton(slideFragment);
        messageButton.setText(messageButtonBehaviours.get(position).getMessageButtonText());
        messageButton.setOnClickListener(messageButtonBehaviours.get(position).getClickListener());
    } else if (messageButton.getVisibility() != View.INVISIBLE) {
        messageButton.startAnimation(AnimationUtils.loadAnimation(slideFragment.getContext(), R.anim.fade_out));
        messageButton.setVisibility(View.INVISIBLE);
    }
}
 
Example 7
Source File: CustomViewBehind.java    From appcan-android with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void scrollBehindTo(View content, int x, int y) {
    int vis = View.VISIBLE;
    if (mMode == SlidingMenu.LEFT) {
        if (x >= content.getLeft()) vis = View.INVISIBLE;
        scrollTo((int) ((x + getBehindWidth()) * mScrollScale), y);
    } else if (mMode == SlidingMenu.RIGHT) {
        if (x <= content.getLeft()) vis = View.INVISIBLE;
        scrollTo((int) (getBehindWidth() - getWidth() +
                (x - getBehindWidth()) * mScrollScale), y);
    } else if (mMode == SlidingMenu.LEFT_RIGHT) {
        mContent.setVisibility(x >= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
        mSecondaryContent.setVisibility(x <= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
        vis = x == 0 ? View.INVISIBLE : View.VISIBLE;
        if (x <= content.getLeft()) {
            scrollTo((int) ((x + getBehindWidth()) * mScrollScale), y);
        } else {
            scrollTo((int) (getBehindWidth() - getWidth() +
                    (x - getBehindWidth()) * mScrollScale), y);
        }
    }
    if (vis == View.INVISIBLE)
        Log.v(TAG, "behind INVISIBLE");
    setVisibility(vis);
}
 
Example 8
Source File: TouchInterceptor.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
private void doExpansion() {
    int childnum = mDragPos - getFirstVisiblePosition();
    if (mDragPos > mFirstDragPos) {
        childnum++;
    }

    View first = getChildAt(mFirstDragPos - getFirstVisiblePosition());

    for (int i = 0;; i++) {
        View vv = getChildAt(i);
        if (vv == null) {
            break;
        }
        int height = mItemHeightNormal;
        int visibility = View.VISIBLE;
        if (vv.equals(first)) {
            // processing the item that is being dragged
            if (mDragPos == mFirstDragPos) {
                // hovering over the original location
                visibility = View.INVISIBLE;
            } else {
                // not hovering over it
                height = 1;
            }
        } else if (i == childnum) {
            if (mDragPos < getCount() - 1) {
                height = mItemHeightExpanded;
            }
        }
        ViewGroup.LayoutParams params = vv.getLayoutParams();
        params.height = height;
        vv.setLayoutParams(params);
        vv.setVisibility(visibility);
    }
}
 
Example 9
Source File: LoadingLayout.java    From LbaizxfPulltoRefresh with Apache License 2.0 5 votes vote down vote up
public final void showInvisibleViews() {
	if (View.INVISIBLE == mHeaderText.getVisibility()) {
		mHeaderText.setVisibility(View.VISIBLE);
	}
	if (View.INVISIBLE == mHeaderProgress.getVisibility()) {
		mHeaderProgress.setVisibility(View.VISIBLE);
	}
	if (View.INVISIBLE == mHeaderImage.getVisibility()) {
		mHeaderImage.setVisibility(View.VISIBLE);
	}
	if (View.INVISIBLE == mSubHeaderText.getVisibility()) {
		mSubHeaderText.setVisibility(View.VISIBLE);
	}
}
 
Example 10
Source File: LoadingLayout.java    From Social with Apache License 2.0 5 votes vote down vote up
public final void showInvisibleViews() {
	if (View.INVISIBLE == mHeaderText.getVisibility()) {
		mHeaderText.setVisibility(View.VISIBLE);
	}
	if (View.INVISIBLE == mHeaderProgress.getVisibility()) {
		mHeaderProgress.setVisibility(View.VISIBLE);
	}
	if (View.INVISIBLE == mHeaderImage.getVisibility()) {
		mHeaderImage.setVisibility(View.VISIBLE);
	}
	if (View.INVISIBLE == mSubHeaderText.getVisibility()) {
		mSubHeaderText.setVisibility(View.VISIBLE);
	}
}
 
Example 11
Source File: GosDeploy.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
/**
 * 设置模组类型开关
 *
 * @return
 */
public static int setModuleSelectOn() {
	int modeOnOff = View.INVISIBLE;

	String moduleSelectOn = infoMap.get(Module_Select_On_Key).toString();
	if (Boolean.parseBoolean(moduleSelectOn)) {
		modeOnOff = View.VISIBLE;
	}

	return modeOnOff;
}
 
Example 12
Source File: TreeActivity.java    From WanAndroid with Apache License 2.0 5 votes vote down vote up
public void scroll(int offsetY){
    if (offsetY > 0 && btn_scroll_top.getVisibility() != View.INVISIBLE && !viewAnimatorHelper.isAnimating()){
        viewAnimatorHelper.hideFloatActionButton();
    }else if (offsetY < 0 && btn_scroll_top.getVisibility() != View.VISIBLE){
        viewAnimatorHelper.showFloatActionButton();
    }
}
 
Example 13
Source File: FrontCardView.java    From px-android with MIT License 5 votes vote down vote up
private void clearCardImage() {
    baseImageCard.clearAnimation();
    imageCardContainer.clearAnimation();
    imageCardContainer.setVisibility(View.INVISIBLE);
    if (baseImageCard.getVisibility() == View.INVISIBLE) {
        baseImageCard.setVisibility(View.VISIBLE);
        baseImageCard.startAnimation(animFadeIn);
    }
}
 
Example 14
Source File: MainActivity.java    From andOTP with MIT License 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();

    if (requireAuthentication) {
        if (settings.getAuthMethod() != AuthMethod.NONE) {
            requireAuthentication = false;
            authenticate(R.string.auth_msg_authenticate);
        }
    } else {
        if (settings.getFirstTimeWarningShown()) {
            if (adapter.getEncryptionKey() == null) {
                updateEncryption(null);
            } else {
                populateAdapter();
            }
            checkIntent();
        }

        if (setCountDownTimerNow())
            countDownTimer.start();
    }

    if (filterString != null) {
        // ensure the current filter string is applied after a resume
        setFilterString(this.filterString);
    }

    View cardList = findViewById(R.id.cardList);
    if(cardList.getVisibility() == View.INVISIBLE)
        cardList.setVisibility(View.VISIBLE);

    startUpdater();
}
 
Example 15
Source File: CordovaWebViewClient.java    From bluemix-parking-meter with MIT License 4 votes vote down vote up
/**
 * Notify the host application that a page has finished loading.
 * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet.
 *
 *
 * @param view          The webview initiating the callback.
 * @param url           The url of the page.
 */
@Override
public void onPageFinished(WebView view, String url) {
    super.onPageFinished(view, url);
    // Ignore excessive calls, if url is not about:blank (CB-8317).
    if (!isCurrentlyLoading && !url.startsWith("about:")) {
        return;
    }
    isCurrentlyLoading = false;
    LOG.d(TAG, "onPageFinished(" + url + ")");

    /**
     * Because of a timing issue we need to clear this history in onPageFinished as well as
     * onPageStarted. However we only want to do this if the doClearHistory boolean is set to
     * true. You see when you load a url with a # in it which is common in jQuery applications
     * onPageStared is not called. Clearing the history at that point would break jQuery apps.
     */
    if (this.doClearHistory) {
        view.clearHistory();
        this.doClearHistory = false;
    }

    // Clear timeout flag
    this.appView.loadUrlTimeout++;

    // Broadcast message that page has loaded
    this.appView.postMessage("onPageFinished", url);

    // Make app visible after 2 sec in case there was a JS error and Cordova JS never initialized correctly
    if (this.appView.getVisibility() == View.INVISIBLE) {
        Thread t = new Thread(new Runnable() {
            public void run() {
                try {
                    Thread.sleep(2000);
                    cordova.getActivity().runOnUiThread(new Runnable() {
                        public void run() {
                            appView.postMessage("spinner", "stop");
                        }
                    });
                } catch (InterruptedException e) {
                }
            }
        });
        t.start();
    }

    // Shutdown if blank loaded
    if (url.equals("about:blank")) {
        appView.postMessage("exit", null);
    }
}
 
Example 16
Source File: FastScroller.java    From FlexibleAdapter with Apache License 2.0 4 votes vote down vote up
public boolean isHidden() {
    return bar == null || handle == null ||
            bar.getVisibility() == View.INVISIBLE ||
            handle.getVisibility() == View.INVISIBLE;
}
 
Example 17
Source File: CommunityMainFragment.java    From umeng_community_android with MIT License 4 votes vote down vote up
/**
 * 设置回退按钮的可见性
 * 
 * @param visible
 */
public void setBackButtonVisibility(int visible) {
    if (visible == View.VISIBLE || visible == View.INVISIBLE || visible == View.GONE) {
        this.mBackButtonVisible = visible;
    }
}
 
Example 18
Source File: WxArticleFragment.java    From Awesome-WanAndroid with Apache License 2.0 4 votes vote down vote up
@Override
public void reload() {
    if (mPresenter != null && mTabLayout.getVisibility() == View.INVISIBLE) {
        mPresenter.getWxAuthorListData();
    }
}
 
Example 19
Source File: SecKeyboardView.java    From AndroidSecurityKeyboard with Apache License 2.0 4 votes vote down vote up
private void showKeyboard() {
    int visibility = mKeyboardView.getVisibility();
    if (visibility == View.GONE || visibility == View.INVISIBLE) {
        mKeyboardView.setVisibility(View.VISIBLE);
    }
}
 
Example 20
Source File: EditPage.java    From AndroidLinkup with GNU General Public License v2.0 4 votes vote down vote up
public void onClick(View v) {
	if (v.equals(llTitle.getBtnBack())) {
		Platform plat = null;
		for (int i = 0; i < views.length; i++) {
			if (views[i].getVisibility() == View.INVISIBLE) {
				plat = platformList[i];
				break;
			}
		}

		// 取消分享的统计
		if (plat != null) {
			ShareSDK.logDemoEvent(5, plat);
		}
		finish();
		return;
	}

	// 取消分享的统计
	if (v.equals(llTitle.getBtnRight())) {
		String text = etContent.getText().toString();
		reqData.put("text", text);
		if(!shareImage){
			if (reqData.get("imagePath") == null) {
				reqData.put("viewToShare", null);
				reqData.put("imageUrl", null);
			} else if (reqData.get("imageUrl") == null) {
				reqData.put("imagePath", null);
				reqData.put("viewToShare", null);
			} else {
				reqData.put("imageUrl", null);
				reqData.put("imagePath", null);
			}
		}

		HashMap<Platform, HashMap<String, Object>> editRes
				= new HashMap<Platform, HashMap<String,Object>>();
		boolean selected = false;
		for (int i = 0; i < views.length; i++) {
			if (views[i].getVisibility() != View.VISIBLE) {
				editRes.put(platformList[i], reqData);
				selected = true;
			}
		}

		if (selected) {
			if (parent != null) {
				parent.share(editRes);
			}
			finish();
		} else {
			int resId = getStringRes(activity, "select_one_plat_at_least");
			if (resId > 0) {
				Toast.makeText(getContext(), resId, Toast.LENGTH_SHORT).show();
			}
		}
		return;
	}

	if (v instanceof FrameLayout) {
		((FrameLayout) v).getChildAt(1).performClick();
		return;
	}

	if (v.getVisibility() == View.INVISIBLE) {
		v.setVisibility(View.VISIBLE);
	} else {
		v.setVisibility(View.INVISIBLE);
	}
}