Java Code Examples for android.view.View.VISIBLE

The following are Jave code examples for showing how to use VISIBLE 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.
Example 1
Project: BubbleAlert   File: ScreenUtils.java   Source Code and License 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 2
Project: GitHub   File: CountryPage.java   Source Code and License Vote up 7 votes
public boolean onKeyEvent(int keyCode, KeyEvent event) {
	try {
		int resId = ResHelper.getIdRes(activity, "llSearch");
		if (keyCode == KeyEvent.KEYCODE_BACK
				&& event.getAction() == KeyEvent.ACTION_DOWN
				&& activity.findViewById(resId).getVisibility() == View.VISIBLE) {
			activity.findViewById(resId).setVisibility(View.GONE);
			resId = ResHelper.getIdRes(activity, "llTitle");
			activity.findViewById(resId).setVisibility(View.VISIBLE);
			etSearch.setText("");
			return true;
		}
	} catch (Throwable e) {
		SMSLog.getInstance().w(e);
	}
	return super.onKeyEvent(keyCode, event);
}
 
Example 3
Project: CoordinatorLayoutExample-master   File: FooterBehavior.java   Source Code and License Vote up 7 votes
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, View child,
                              View target, int dx, int dy, int[] consumed) {
    if (dy > 0 && sinceDirectionChange < 0 || dy < 0 && sinceDirectionChange > 0) {
        child.animate().cancel();
        sinceDirectionChange = 0;
    }
    sinceDirectionChange += dy;
    int visibility = child.getVisibility();
    if (sinceDirectionChange > child.getHeight() && visibility == View.VISIBLE) {
        hide(child);
    } else {
        if (sinceDirectionChange < 0 && (visibility == View.GONE || visibility == View
                .INVISIBLE)) {
            show(child);
        }
    }
}
 
Example 4
Project: GitHub   File: ColorChooserDialog.java   Source Code and License Vote up 7 votes
@ColorInt private int getSelectedColor() {
    if (colorChooserCustomFrame != null &&
            colorChooserCustomFrame.getVisibility() == View.VISIBLE) {
        return selectedCustomColor;
    }

    int color = 0;
    if (subIndex() > -1)
        color = mColorsSub[topIndex()][subIndex()];
    else if (topIndex() > -1)
        color = mColorsTop[topIndex()];
    if (color == 0) {
        int fallback = 0;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            fallback = DialogUtils.resolveColor(getActivity(), android.R.attr.colorAccent);
        color = DialogUtils.resolveColor(getActivity(), R.attr.colorAccent, fallback);
    }
    return color;
}
 
Example 5
Project: anitrend-app   File: ScrollAwareFab.java   Source Code and License Vote up 7 votes
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton 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(new FloatingActionButton.OnVisibilityChangedListener() {
            /**
             * Called when a FloatingActionButton has been hidden
             *
             * @param fab the FloatingActionButton that was hidden.
             */
            @Override
            public void onHidden(FloatingActionButton fab) {
                super.onShown(fab);
                fab.setVisibility(View.INVISIBLE);
            }
        });
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        child.show();
    }
}
 
Example 6
Project: FilterBar   File: RegionContainer.java   Source Code and License Vote up 7 votes
private void setLv1Item(NewConditionItem item) {
    if (item == null) {
        mPrimaryList.setVisibility(View.GONE);
        setLv2Item(null);
        return;
    }
    if (mPrimaryList.getVisibility() != View.VISIBLE) {
        mPrimaryList.setVisibility(View.VISIBLE);
    }
    mPrimaryAdapter.setList(item.subItems);
    mPrimaryAdapter.notifyDataSetChanged();

    for (int i = 0; i < item.subItems.size(); ++i) {
        NewConditionItem subItem = item.subItems.get(i);
        if (subItem.selected) {
            setLv2Item(subItem);
            if (mSetting) {
                checkSelectedItemVisibility(mPrimaryList, i);
            }
            return;
        }
    }
    setLv2Item(null);
}
 
Example 7
Project: alerta-fraude   File: CordovaWebViewImpl.java   Source Code and License Vote up 6 votes
@Override
public void onPageFinishedLoading(String url) {
    LOG.d(TAG, "onPageFinished(" + url + ")");

    clearLoadTimeoutTimer();

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

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

    // Shutdown if blank loaded
    if (url.equals("about:blank")) {
        pluginManager.postMessage("exit", null);
    }
}
 
Example 8
Project: chromium-for-android-56-debug-video   File: CardUnmaskPrompt.java   Source Code and License Vote up 6 votes
private void showExpirationDateInputsInputs() {
    if (!mShouldRequestExpirationDate || mExpirationContainer.getVisibility() == View.VISIBLE) {
        return;
    }

    mExpirationContainer.setVisibility(View.VISIBLE);
    mCardUnmaskInput.setEms(3);
    mMonthInput.addTextChangedListener(this);
    mYearInput.addTextChangedListener(this);
}
 
Example 9
Project: Microsphere   File: CameraGLRendererBase.java   Source Code and License Vote up 6 votes
protected void updateState() {
    Log.d(LOGTAG, "updateState");
    Log.d(LOGTAG, "mEnabled="+mEnabled+", mHaveSurface="+mHaveSurface);
    boolean willStart = mEnabled && mHaveSurface && mView.getVisibility() == View.VISIBLE;
    if (willStart != mIsStarted) {
        if(willStart) doStart();
        else doStop();
    } else {
        Log.d(LOGTAG, "keeping State unchanged");
    }
    Log.d(LOGTAG, "updateState end");
}
 
Example 10
Project: buddybox   File: MainActivity.java   Source Code and License Vote up 6 votes
private void navigateTo(int frame) {
    boolean isSampling = findViewById(R.id.frameSampler).getVisibility() == View.VISIBLE;

    if (frame == R.id.frameLibrary) {
        libraryActivate();
    } else {
        findViewById(R.id.frameLibrary).setVisibility(View.INVISIBLE);
        ((TextView) findViewById(R.id.libraryText)).setTextColor(Color.parseColor("#FFFFFF"));
        ((ImageView) findViewById(R.id.libraryNavbarBtn)).setImageResource(R.drawable.ic_library_music);
    }

    if (frame == R.id.frameSampler) {
        samplerActivate();
    } else {
        findViewById(R.id.frameSampler).setVisibility(View.INVISIBLE);
        ((TextView) findViewById(R.id.samplerText)).setTextColor(Color.parseColor("#FFFFFF"));
        ((ImageView) findViewById(R.id.samplerNavbarBtn)).setImageResource(R.drawable.ic_whatshot);
        if (isSampling)
            dispatch(SAMPLER_STOP);
    }

    if (frame == R.id.frameLoved) {
        lovedActivate();
    } else {
        findViewById(R.id.frameLoved).setVisibility(View.INVISIBLE);
        ((TextView) findViewById(R.id.lovedText)).setTextColor(Color.parseColor("#FFFFFF"));
        ((ImageView) findViewById(R.id.lovedNavbarBtn)).setImageResource(R.drawable.ic_loved);
    }

    if (frame == R.id.frameSharing) {
        sharingActivate();
    } else {
        findViewById(R.id.frameSharing).setVisibility(View.INVISIBLE);
        ((TextView) findViewById(R.id.sharingText)).setTextColor(Color.parseColor("#FFFFFF"));
        ((ImageView) findViewById(R.id.sharingNavbarBtn)).setImageResource(R.drawable.ic_sharing);
    }
}
 
Example 11
Project: PresenterLite   File: GraphicalLayout.java   Source Code and License Vote up 6 votes
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);
    ViewTreeObserver observer = getViewTreeObserver();
    if (getVisibility() == View.VISIBLE && changed && observer != null && observer.isAlive()) {
        observer.addOnPreDrawListener(mPredrawListener);
    }
}
 
Example 12
Project: Nimbus   File: CoreTeamEventActivity.java   Source Code and License Vote up 6 votes
public static void startAlphaAnimation(View v, long duration, int visibility) {
    AlphaAnimation alphaAnimation = (visibility == View.VISIBLE)
            ? new AlphaAnimation(0f, 1f)
            : new AlphaAnimation(1f, 0f);

    alphaAnimation.setDuration(duration);
    alphaAnimation.setFillAfter(true);
    v.startAnimation(alphaAnimation);
}
 
Example 13
Project: MyFire   File: ScrollAwareFABBehavior.java   Source Code and License Vote up 6 votes
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton 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();
        RxBus.getInstance().post(AppConstant.MENU_SHOW_HIDE,false);
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        RxBus.getInstance().post(AppConstant.MENU_SHOW_HIDE,true);
        child.show();
    }
}
 
Example 14
Project: Sanxing   File: HabitCalendarFragment.java   Source Code and License Vote up 6 votes
@OnClick(R.id.expand_habit_calendar_view)
void expandHabitCalendarViewOnClick() {
    TransitionManager.beginDelayedTransition(habitCalendarContent);
    TransitionManager.beginDelayedTransition(fragHabitRootLinearLayout);
    TransitionManager.beginDelayedTransition(habitCalendarCard);
    if(habitCalendarContent.getVisibility() == View.VISIBLE) {
        habitCalendarContent.setVisibility(View.GONE);
    } else {
        habitCalendarContent.setVisibility(View.VISIBLE);
    }
}
 
Example 15
Project: BookLoadingView   File: BookLoadingView.java   Source Code and License Vote up 6 votes
public void setVisibility(int visibility, int delay) {
    super.setVisibility(visibility);
    if (visibility == View.VISIBLE) {
        startLoading(delay);
    } else {
        stopLoading();
    }
}
 
Example 16
Project: chromium-for-android-56-debug-video   File: ChromeFullscreenManager.java   Source Code and License Vote up 6 votes
@Override
public void run() {
    int visibility = shouldShowAndroidControls() ? View.VISIBLE : View.INVISIBLE;
    if (mControlContainer.getView().getVisibility() == visibility) return;
    // requestLayout is required to trigger a new gatherTransparentRegion(), which
    // only occurs together with a layout and let's SurfaceFlinger trim overlays.
    // This may be almost equivalent to using View.GONE, but we still use View.INVISIBLE
    // since drawing caches etc. won't be destroyed, and the layout may be less expensive.
    mControlContainer.getView().setVisibility(visibility);
    mControlContainer.getView().requestLayout();
}
 
Example 17
Project: JewelryUI   File: MainActivity.java   Source Code and License Vote up 6 votes
@Override
public void onBackPressed() {
    if (floatingActionButton.getVisibility() != View.VISIBLE) {
        FabTransformation.with(floatingActionButton)
                .setListener(new FabTransformation.OnTransformListener() {
                    @Override
                    public void onStartTransform() {
                    }
                    @Override
                    public void onEndTransform() {
                        morphToCircle(btnPay);
                        tvTitle.setVisibility(View.INVISIBLE);
                        nameList.clear();
                    }
                })
                .transformFrom(layoutContainer);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        FabTransformation.with(floatingActionButton)
                                .transformFrom(layoutFakeRipple);
                    }
                });
            }
        }, 100);

        return;
    }
    super.onBackPressed();
}
 
Example 18
Project: Hillffair17   File: QuizQuestionActivity.java   Source Code and License Vote up 6 votes
@Override
public void onBackPressed() {

    if(staytuned_message.getVisibility()== View.GONE || progressBar.getVisibility()== View.VISIBLE){
        QuizDialog dialog=new QuizDialog();
        dialog.show(manager,"dialog");

    }else {
        super.onBackPressed();
    }

}
 
Example 19
Project: yjPlay   File: BaseView.java   Source Code and License Vote up 6 votes
/***
 * 显示按钮提示页
 *
 * @param visibility 状态
 */
protected void showBtnContinueHint(int visibility) {
    if (visibility == View.VISIBLE) {
        showLoadState(GONE);
        showReplay(GONE);
        showErrorState(GONE);
        showPreViewLayout(GONE);
        showBackView(VISIBLE, true);
    }
    if (playBtnHintLayout != null) {
        playBtnHintLayout.setVisibility(visibility);
    }
}
 
Example 20
Project: NoteCrypt   File: CryptoLoad.java   Source Code and License Vote up 5 votes
@Override
protected void onPreExecute() {
    if (spinner != null && spinner.getVisibility() != View.VISIBLE) {
        spinner.setVisibility(View.VISIBLE);
    }
}