Java Code Examples for android.view.ViewGroup#setVisibility()
The following examples show how to use
android.view.ViewGroup#setVisibility() .
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: CordovaWebView.java From L.TileLayer.Cordova with MIT License | 6 votes |
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 Log.d(TAG, "showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden(); return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) this.getParent(); parent.addView(view, COVER_SCREEN_GRAVITY_CENTER); // Hide the content view. this.setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); }
Example 2
Source File: CordovaWebView.java From phonegap-plugin-loading-spinner with Apache License 2.0 | 6 votes |
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 Log.d(TAG, "showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden(); return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) this.getParent(); parent.addView(view, COVER_SCREEN_GRAVITY_CENTER); // Hide the content view. this.setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); }
Example 3
Source File: AdsManager.java From text_converter with GNU General Public License v3.0 | 6 votes |
/** * Create {@link PublisherAdView} and add to container * * @param context - android context * @param container - parent view for add ad view * @return true if ads has been added */ public static boolean addBannerAds(Context context, @Nullable ViewGroup container) { if (isPremiumUser(context)) { if (container != null) { container.setVisibility(View.GONE); } return false; } else { if (container == null) return false; container.setVisibility(View.VISIBLE); PublisherAdView publisherAdView = new PublisherAdView(context); publisherAdView.setAdSizes(AdSize.SMART_BANNER, AdSize.FLUID); publisherAdView.setAdUnitId(AdConstants.AdUnitId.AD_UNIT_ID_NATIVE_MAIN_320_50); PublisherAdRequest.Builder builder = new PublisherAdRequest.Builder(); if (BuildConfig.DEBUG) builder.addTestDevice(TEST_DEVICE_ID); publisherAdView.loadAd(builder.build()); container.removeAllViews(); container.addView(publisherAdView); } return false; }
Example 4
Source File: CordovaWebView.java From cordova-amazon-fireos with Apache License 2.0 | 6 votes |
public void showCustomView(View view, AmazonWebChromeClient.CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 Log.d(TAG, "showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden(); return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) this.getParent(); parent.addView(view, COVER_SCREEN_GRAVITY_CENTER); // Hide the content view. this.setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); }
Example 5
Source File: AppSettings.java From PocketMaps with MIT License | 6 votes |
public void showAppSettings(final ViewGroup calledFromVP, SettType settType) { initClearBtn(appSettingsVP, calledFromVP); if (settType == SettType.Default) { changeMapItemVP.setVisibility(View.VISIBLE); trackingLayoutVP.setVisibility(View.VISIBLE); naviLayoutVP.setVisibility(View.GONE); chooseMapBtn(appSettingsVP); trackingBtn(appSettingsVP); } else { naviLayoutVP.setVisibility(View.VISIBLE); changeMapItemVP.setVisibility(View.GONE); trackingLayoutVP.setVisibility(View.GONE); alternateRoute(); naviDirections(); } appSettingsVP.setVisibility(View.VISIBLE); calledFromVP.setVisibility(View.INVISIBLE); if (getTracking().isTracking()) resetAnalyticsItem(); }
Example 6
Source File: PopupNotificationActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void reuseView(ViewGroup view) { if (view == null) { return; } int tag = (Integer) view.getTag(); view.setVisibility(View.GONE); if (tag == 1) { textViews.add(view); } else if (tag == 2) { imageViews.add(view); } else if (tag == 3) { audioViews.add(view); } }
Example 7
Source File: CordovaWebViewImpl.java From ultimate-cordova-webview-app with MIT License | 5 votes |
@Override @Deprecated public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 LOG.d(TAG, "showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden(); return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) engine.getView().getParent(); parent.addView(view, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER)); // Hide the content view. engine.getView().setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); }
Example 8
Source File: PopupNotificationActivity.java From Yahala-Messenger with MIT License | 5 votes |
private void reuseView(ViewGroup view) { if (view == null) { return; } int tag = (Integer) view.getTag(); view.setVisibility(View.GONE); if (tag == 1) { textViews.add(view); } else if (tag == 2) { imageViews.add(view); } else if (tag == 3) { audioViews.add(view); } }
Example 9
Source File: DemoLandingFragment.java From material-components-android with Apache License 2.0 | 5 votes |
private void addLinks(LayoutInflater layoutInflater, View view) { ViewGroup linksSection = view.findViewById(R.id.cat_demo_landing_links_section); int linksArrayResId = getLinksArrayResId(); if (linksArrayResId != -1) { String[] linksStringArray = getResources().getStringArray(linksArrayResId); for (String linkString : linksStringArray) { addLinkView(layoutInflater, linksSection, linkString); } linksSection.setVisibility(View.VISIBLE); } else { linksSection.setVisibility(View.GONE); } }
Example 10
Source File: CordovaWebViewImpl.java From chappiecast with Mozilla Public License 2.0 | 5 votes |
@Override @Deprecated public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 Log.d(TAG, "showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden(); return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) engine.getView().getParent(); parent.addView(view, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER)); // Hide the content view. engine.getView().setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); }
Example 11
Source File: ViewMatchersTest.java From android-test with Apache License 2.0 | 5 votes |
@Test public void isVisibleTest() { View visible = new View(context); visible.setVisibility(View.VISIBLE); View invisible = new View(context); invisible.setVisibility(View.INVISIBLE); assertTrue(withEffectiveVisibility(Visibility.VISIBLE).matches(visible)); assertFalse(withEffectiveVisibility(Visibility.VISIBLE).matches(invisible)); // Make the visible view invisible by giving it an invisible parent. ViewGroup parent = new RelativeLayout(context); parent.addView(visible); parent.setVisibility(View.INVISIBLE); assertFalse(withEffectiveVisibility(Visibility.VISIBLE).matches(visible)); }
Example 12
Source File: CordovaWebViewImpl.java From BigDataPlatform with GNU General Public License v3.0 | 5 votes |
@Override @Deprecated public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 LOG.d(TAG, "showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden(); return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) engine.getView().getParent(); parent.addView(view, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER)); // Hide the content view. engine.getView().setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); }
Example 13
Source File: Preference.java From Android-MaterialPreference with MIT License | 5 votes |
@Override protected View onCreateView(ViewGroup parent) { LayoutInflater layoutInflater = (LayoutInflater) getContext().getSystemService(LAYOUT_INFLATER_SERVICE); View layout = layoutInflater.inflate(R.layout.mp_preference, parent, false); ViewGroup widgetFrame = (ViewGroup) layout.findViewById(R.id.widget_frame); int widgetLayoutResId = getWidgetLayoutResource(); if (widgetLayoutResId != 0) { layoutInflater.inflate(widgetLayoutResId, widgetFrame); } widgetFrame.setVisibility(widgetLayoutResId != 0 ? VISIBLE : GONE); return layout; }
Example 14
Source File: AdvancedDataViewHolder.java From SimpleRecyclerAdapter with Apache License 2.0 | 5 votes |
private void init() { mTitle = (TextView) itemView.findViewById(R.id.title); mText = (TextView) itemView.findViewById(R.id.description); mBtnMore = (Button) itemView.findViewById(R.id.btn_more); mBtnRemove = (Button) itemView.findViewById(R.id.btn_remove); mBtnUp = (Button) itemView.findViewById(R.id.btn_move_up); mBtnDown = (Button) itemView.findViewById(R.id.btn_move_down); mActions = (ViewGroup) itemView.findViewById(R.id.actions); mActions.setVisibility(View.VISIBLE); }
Example 15
Source File: MeetingRemindProcessor.java From imsdk-android with MIT License | 5 votes |
@Override public void processChatView(ViewGroup parent, final IMessageItem item) { IMMessage message = item.getMessage(); final Context context = item.getContext(); try { RemindDataBean meetingDataBean = JsonUtils.getGson().fromJson(message.getExt() , RemindDataBean.class); ClickRemindView meetingRemindView = ViewPool.getView(ClickRemindView.class, context); StringBuilder sb = new StringBuilder(); sb.append(meetingDataBean.getTitle()); sb.append("\n\n"); List<Map<String,String>> keyValues = meetingDataBean.getKeyValues(); if(keyValues != null && keyValues.size() > 0){ for(Map<String,String> map : keyValues){ for (Map.Entry entry : map.entrySet()) { sb.append(entry.getKey().toString() + ":" + entry.getValue().toString()); sb.append("\n"); } } } meetingRemindView.setData(sb.toString()); final String gotoUrl = meetingDataBean.getUrl() + "username=" + CurrentPreference.getInstance().getUserid() + "&meeting_id=" + meetingDataBean.getParams().get("id"); meetingRemindView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(!TextUtils.isEmpty(gotoUrl)){ Uri uri = Uri.parse(gotoUrl); Intent intent = new Intent(context, QunarWebActvity.class); intent.setData(uri); context.startActivity(intent); } } }); parent.setVisibility(View.VISIBLE); parent.addView(meetingRemindView); } catch (Exception e) { e.printStackTrace(); } }
Example 16
Source File: DynamicDetailFragment.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
private void a(ViewGroup viewgroup, ViewGroup viewgroup1) { viewgroup.setVisibility(4); viewgroup1.setVisibility(0); AnimationSet animationset = new AnimationSet(true); AlphaAnimation alphaanimation = new AlphaAnimation(0.0F, 1.0F); alphaanimation.setDuration(80L); animationset.addAnimation(alphaanimation); TranslateAnimation translateanimation = new TranslateAnimation(1, 0.0F, 1, 0.0F, 1, -1F, 1, 0.0F); translateanimation.setDuration(100L); translateanimation.setInterpolator(new DecelerateInterpolator()); animationset.addAnimation(translateanimation); viewgroup1.setLayoutAnimation(new LayoutAnimationController(animationset, 0.7F)); viewgroup1.requestLayout(); }
Example 17
Source File: UCropFragment.java From EasyPhotos with Apache License 2.0 | 5 votes |
public void setupViews(View view, Bundle args) { mActiveWidgetColor = args.getInt(UCrop.Options.EXTRA_UCROP_COLOR_WIDGET_ACTIVE, ContextCompat.getColor(getContext(), R.color.ucrop_color_widget_background)); mActiveControlsWidgetColor = args.getInt(UCrop.Options.EXTRA_UCROP_COLOR_WIDGET_ACTIVE, ContextCompat.getColor(getContext(), R.color.ucrop_color_widget_active)); mLogoColor = args.getInt(UCrop.Options.EXTRA_UCROP_LOGO_COLOR, ContextCompat.getColor(getContext(), R.color.ucrop_color_default_logo)); mShowBottomControls = !args.getBoolean(UCrop.Options.EXTRA_HIDE_BOTTOM_CONTROLS, false); mRootViewBackgroundColor = args.getInt(UCrop.Options.EXTRA_UCROP_ROOT_VIEW_BACKGROUND_COLOR, ContextCompat.getColor(getContext(), R.color.ucrop_color_crop_background)); initiateRootViews(view); callback.loadingProgress(true); if (mShowBottomControls) { ViewGroup wrapper = view.findViewById(R.id.controls_wrapper); wrapper.setVisibility(View.VISIBLE); wrapper.setBackgroundColor(mRootViewBackgroundColor); LayoutInflater.from(getContext()).inflate(R.layout.ucrop_controls, wrapper, true); mControlsTransition = new AutoTransition(); mControlsTransition.setDuration(CONTROLS_ANIMATION_DURATION); mWrapperStateAspectRatio = view.findViewById(R.id.state_aspect_ratio); mWrapperStateAspectRatio.setOnClickListener(mStateClickListener); mWrapperStateRotate = view.findViewById(R.id.state_rotate); mWrapperStateRotate.setOnClickListener(mStateClickListener); mWrapperStateScale = view.findViewById(R.id.state_scale); mWrapperStateScale.setOnClickListener(mStateClickListener); mLayoutAspectRatio = view.findViewById(R.id.layout_aspect_ratio); mLayoutRotate = view.findViewById(R.id.layout_rotate_wheel); mLayoutScale = view.findViewById(R.id.layout_scale_wheel); setupAspectRatioWidget(args, view); setupRotateWidget(view); setupScaleWidget(view); setupStatesWrapper(view); } }
Example 18
Source File: Card.java From android-BatchStepSensor with Apache License 2.0 | 5 votes |
/** * Build the action views by inflating the appropriate layouts and setting the text and * values. * @param inflater * @param cardView * @param actionArea */ private void initializeActionViews(LayoutInflater inflater, ViewGroup cardView, ViewGroup actionArea) { if (!mCard.mCardActions.isEmpty()) { // Set action area to visible only when actions are visible actionArea.setVisibility(View.VISIBLE); mCard.mActionAreaView = actionArea; } // Inflate all card actions for (final CardAction action : mCard.mCardActions) { int useActionLayout = 0; switch (action.type) { case Card.ACTION_POSITIVE: useActionLayout = R.layout.card_button_positive; break; case Card.ACTION_NEGATIVE: useActionLayout = R.layout.card_button_negative; break; case Card.ACTION_NEUTRAL: default: useActionLayout = R.layout.card_button_neutral; break; } action.actionView = inflater.inflate(useActionLayout, actionArea, false); Button actionButton = (Button) action.actionView.findViewById(R.id.card_button); actionButton.setText(action.label); actionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mCard.mClickListener.onCardClick(action.id, mCard.mTag); } }); actionArea.addView(action.actionView); } }
Example 19
Source File: MessageSpliterProcessor.java From imsdk-android with MIT License | 4 votes |
@Override public void processChatView(ViewGroup parent, final IMessageItem item) { MessageSpliterView spliterView = new MessageSpliterView(item.getContext()); parent.addView(spliterView); parent.setVisibility(View.VISIBLE); }
Example 20
Source File: DemoLandingFragment.java From material-components-android with Apache License 2.0 | 4 votes |
@SuppressWarnings("RestrictTo") @Nullable @Override public View onCreateView( LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) { View view = layoutInflater.inflate( R.layout.cat_demo_landing_fragment, viewGroup, false /* attachToRoot */); Bundle arguments = getArguments(); if (arguments != null) { String transitionName = arguments.getString(FeatureDemoUtils.ARG_TRANSITION_NAME); ViewCompat.setTransitionName(view, transitionName); } Toolbar toolbar = view.findViewById(R.id.toolbar); AppCompatActivity activity = (AppCompatActivity) getActivity(); activity.setSupportActionBar(toolbar); activity.getSupportActionBar().setTitle(getTitleResId()); activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); Context toolbarContext = toolbar.getContext(); TypedArray a = toolbarContext .getTheme() .obtainStyledAttributes(new int[] {R.attr.colorControlNormal, R.attr.colorAccent}); colorControlNormal = MaterialResources.getColorStateList(toolbarContext, a, 0).getDefaultColor(); colorAccent = a.getColor(1, 0); TextView descriptionTextView = view.findViewById(R.id.cat_demo_landing_description); ViewGroup mainDemoContainer = view.findViewById(R.id.cat_demo_landing_main_demo_container); ViewGroup additionalDemosSection = view.findViewById(R.id.cat_demo_landing_additional_demos_section); ViewGroup additionalDemosContainer = view.findViewById(R.id.cat_demo_landing_additional_demos_container); // Links should be added whether or not the feature is restricted. addLinks(layoutInflater, view); // If this fragments demos is restricted, due to conditions set by the subclass, exit early // without showing any demos and just show the restricted message. if (isRestricted()) { descriptionTextView.setText(getRestrictedMessageId()); mainDemoContainer.setVisibility(View.GONE); additionalDemosSection.setVisibility(View.GONE); return view; } descriptionTextView.setText(getDescriptionResId()); addDemoView(layoutInflater, mainDemoContainer, getMainDemo(), false); List<Demo> additionalDemos = getAdditionalDemos(); for (Demo additionalDemo : additionalDemos) { addDemoView(layoutInflater, additionalDemosContainer, additionalDemo, true); } additionalDemosSection.setVisibility(additionalDemos.isEmpty() ? View.GONE : View.VISIBLE); DemoUtils.addBottomSpaceInsetsIfNeeded((ViewGroup) view, viewGroup); return view; }