List of usage examples for android.view ViewGroup setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:dev.drsoran.moloko.fragments.base.impl.LoaderFragmentImpl.java
private void showContent() { if (support.getRootView() != null) { final View spinner = getLoadingSpinnerView(); if (spinner != null) spinner.setVisibility(View.GONE); final ViewGroup content = support.getContentView(); if (content != null) { support.initContentAfterDataLoaded(content); content.setVisibility(View.VISIBLE); }/*from w w w .j a v a2s. c om*/ } }
From source file:com.vanloo.coffeeapp.view.SlidingTabLayout.java
public void setSmallToolbarStyle() { ViewGroup parent = (ViewGroup) getParent(); parent.setVisibility(GONE); // ((ViewGroup)parent.getParent()).removeView(parent); }
From source file:org.alfresco.mobile.android.application.fragments.workflow.CreateTaskTypePickerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setRetainInstance(true);/* w ww .j a v a 2s . c om*/ container.setVisibility(View.VISIBLE); alfSession = SessionUtils.getSession(getActivity()); SessionUtils.checkSession(getActivity(), alfSession); vRoot = inflater.inflate(R.layout.app_task_create, container, false); lv = (LinearLayout) vRoot.findViewById(R.id.create_task_group); pb = (ProgressBar) vRoot.findViewById(R.id.progressbar); ev = vRoot.findViewById(R.id.empty); TextView evt = (TextView) vRoot.findViewById(R.id.empty_text); evt.setText(R.string.error_general); // BUTTONS Button b = (Button) vRoot.findViewById(R.id.task_todo); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { createTask(todo); } }); b = (Button) vRoot.findViewById(R.id.task_review_approve); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { createTask(review); } }); return vRoot; }
From source file:org.alfresco.mobile.android.application.fragments.node.rendition.PreviewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setRetainInstance(false);//from ww w. ja v a2 s .c o m if (container != null) { container.setVisibility(View.VISIBLE); } setRootView(inflater.inflate(R.layout.app_preview, container, false)); if (getSession() == null) { return getRootView(); } if (node == null) { return null; } // Detect if isRestrictable isRestrictable = node.hasAspect(ContentModel.ASPECT_RESTRICTABLE); ImageView iv = (ImageView) viewById(R.id.preview); int iconId = R.drawable.mime_folder; iv.setTag(viewById(R.id.preview_message)); if (node.isDocument() && node instanceof NodeImpl) { iconId = MimeTypeManager.getInstance(getActivity()).getIcon(node.getName(), true); if (((Document) node).isLatestVersion()) { ((ImageViewTouch) iv).setScaleEnabled(false); ((ImageViewTouch) iv).setDoubleTapEnabled(false); ((ImageViewTouch) iv).setDisplayType(DisplayType.NONE); RenditionBuilder request = RenditionManager.with(getActivity()).loadNode(node).placeHolder(iconId) .rendition(RenditionRequest.RENDITION_PREVIEW); if (touchEnabled) { request.touchViewEnable(true); } request.into(iv); } } else if (node.isDocument() && node instanceof NodeSyncPlaceHolder) { iv.setImageResource(MimeTypeManager.getInstance(getActivity()).getIcon(node.getName(), true)); } else { iv.setImageResource(iconId); } return getRootView(); }
From source file:dev.drsoran.moloko.fragments.base.impl.LoaderFragmentImpl.java
private void showElementNotFoundError() { if (support.getRootView() != null) { final View spinner = getLoadingSpinnerView(); if (spinner != null) spinner.setVisibility(View.GONE); final ViewGroup content = support.getContentView(); if (content != null) { content.removeAllViews();//from ww w . j a v a 2 s . com inflateErrorWithIcon(content, R.string.err_entity_not_found, support.getLoaderDataName()); content.setVisibility(View.VISIBLE); } } }
From source file:com.jbirdvegas.mgerrit.cards.PatchSetReviewersCard.java
private void setColoredApproval(Integer value, TextView approval, ViewGroup container) { int mGreen = mContext.getResources().getColor(R.color.text_green); int mRed = mContext.getResources().getColor(R.color.text_red); if (value == null) value = 0;/* w w w . ja v a 2 s. co m*/ if (value >= 1) { if (container != null) container.setVisibility(View.VISIBLE); approval.setText('+' + value.toString()); approval.setTextColor(mGreen); } else if (value <= -1) { if (container != null) container.setVisibility(View.VISIBLE); approval.setText(value.toString()); approval.setTextColor(mRed); } else if (container != null) { container.setVisibility(View.GONE); } else { approval.setText(Reviewer.NO_SCORE); } }
From source file:com.android.tv.settings.dialog.old.BaseDialogFragment.java
public void performEntryTransition(final Activity activity, final ViewGroup contentView, int iconResourceId, Uri iconResourceUri, final ImageView icon, final TextView title, final TextView description, final TextView breadcrumb) { // Pull out the root layout of the dialog and set the background drawable, to be // faded in during the transition. final ViewGroup twoPane = (ViewGroup) contentView.getChildAt(0); twoPane.setVisibility(View.INVISIBLE); // If the appropriate data is embedded in the intent and there is an icon specified // in the content fragment, we animate the icon from its initial position to the final // position. Otherwise, we perform a simpler transition in which the ActionFragment // slides in and the ContentFragment text fields slide in. mIntroAnimationInProgress = true;/*from ww w . j a v a 2 s.c om*/ List<TransitionImage> images = TransitionImage.readMultipleFromIntent(activity, activity.getIntent()); TransitionImageAnimation ltransitionAnimation = null; final Uri iconUri; final int color; if (images != null && images.size() > 0) { if (iconResourceId != 0) { iconUri = Uri.parse(UriUtils.getAndroidResourceUri(activity, iconResourceId)); } else if (iconResourceUri != null) { iconUri = iconResourceUri; } else { iconUri = null; } TransitionImage src = images.get(0); color = src.getBackground(); if (iconUri != null) { ltransitionAnimation = new TransitionImageAnimation(contentView); ltransitionAnimation.addTransitionSource(src); ltransitionAnimation.transitionDurationMs(ANIMATE_IN_DURATION).transitionStartDelayMs(0) .interpolator(new DecelerateInterpolator(1f)); } } else { iconUri = null; color = 0; } final TransitionImageAnimation transitionAnimation = ltransitionAnimation; // Fade out the old activity, and hard cut the new activity. activity.overridePendingTransition(R.anim.hard_cut_in, R.anim.fade_out); int bgColor = mFragment.getResources().getColor(R.color.dialog_activity_background); mBgDrawable.setColor(bgColor); mBgDrawable.setAlpha(0); twoPane.setBackground(mBgDrawable); // If we're animating the icon, we create a new ImageView in which to place the embedded // bitmap. We place it in the root layout to match its location in the previous activity. mShadowLayer = (FrameLayoutWithShadows) twoPane.findViewById(R.id.shadow_layout); if (transitionAnimation != null) { transitionAnimation.listener(new TransitionImageAnimation.Listener() { @Override public void onRemovedView(TransitionImage src, TransitionImage dst) { if (icon != null) { //want to make sure that users still see at least the source image // if the dst image is too large to finish downloading before the // animation is done. Check if the icon is not visible. This mean // BaseContentFragement have not finish downloading the image yet. if (icon.getVisibility() != View.VISIBLE) { icon.setImageDrawable(src.getBitmap()); int intrinsicWidth = icon.getDrawable().getIntrinsicWidth(); LayoutParams lp = icon.getLayoutParams(); lp.height = lp.width * icon.getDrawable().getIntrinsicHeight() / intrinsicWidth; icon.setVisibility(View.VISIBLE); } icon.setAlpha(1f); } if (mShadowLayer != null) { mShadowLayer.setShadowsAlpha(1f); } onIntroAnimationFinished(); } }); icon.setAlpha(0f); if (mShadowLayer != null) { mShadowLayer.setShadowsAlpha(0f); } } // We need to defer the remainder of the animation preparation until the first // layout has occurred, as we don't yet know the final location of the icon. twoPane.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { twoPane.getViewTreeObserver().removeOnGlobalLayoutListener(this); // if we buildLayer() at this time, the texture is actually not created // delay a little so we can make sure all hardware layer is created before // animation, in that way we can avoid the jittering of start animation twoPane.postOnAnimationDelayed(mEntryAnimationRunnable, ANIMATE_DELAY); } final Runnable mEntryAnimationRunnable = new Runnable() { @Override public void run() { if (!mFragment.isAdded()) { // We have been detached before this could run, so just bail return; } twoPane.setVisibility(View.VISIBLE); final int secondaryDelay = SLIDE_IN_DISTANCE; // Fade in the activity background protection ObjectAnimator oa = ObjectAnimator.ofInt(mBgDrawable, "alpha", 255); oa.setDuration(ANIMATE_IN_DURATION); oa.setStartDelay(secondaryDelay); oa.setInterpolator(new DecelerateInterpolator(1.0f)); oa.start(); View actionFragmentView = activity.findViewById(mActionAreaId); boolean isRtl = ViewCompat.getLayoutDirection(contentView) == ViewCompat.LAYOUT_DIRECTION_RTL; int startDist = isRtl ? SLIDE_IN_DISTANCE : -SLIDE_IN_DISTANCE; int endDist = isRtl ? -actionFragmentView.getMeasuredWidth() : actionFragmentView.getMeasuredWidth(); // Fade in and slide in the ContentFragment TextViews from the start. prepareAndAnimateView(title, 0, startDist, secondaryDelay, ANIMATE_IN_DURATION, new DecelerateInterpolator(1.0f), false); prepareAndAnimateView(breadcrumb, 0, startDist, secondaryDelay, ANIMATE_IN_DURATION, new DecelerateInterpolator(1.0f), false); prepareAndAnimateView(description, 0, startDist, secondaryDelay, ANIMATE_IN_DURATION, new DecelerateInterpolator(1.0f), false); // Fade in and slide in the ActionFragment from the end. prepareAndAnimateView(actionFragmentView, 0, endDist, secondaryDelay, ANIMATE_IN_DURATION, new DecelerateInterpolator(1.0f), false); if (icon != null && transitionAnimation != null) { // now we get the icon view in place, update the transition target TransitionImage target = new TransitionImage(); target.setUri(iconUri); target.createFromImageView(icon); if (icon.getBackground() instanceof ColorDrawable) { ColorDrawable d = (ColorDrawable) icon.getBackground(); target.setBackground(d.getColor()); } transitionAnimation.addTransitionTarget(target); transitionAnimation.startTransition(); } else if (icon != null) { prepareAndAnimateView(icon, 0, startDist, secondaryDelay, ANIMATE_IN_DURATION, new DecelerateInterpolator(1.0f), true /* is the icon */); if (mShadowLayer != null) { mShadowLayer.setShadowsAlpha(0f); } } } }; }); }
From source file:org.boliu.android.viewtrip.session.SessionDetailFragment.java
private void displaySessionData(final SessionDetailModel data) { mTitle.setText(data.getSessionTitle()); mSubtitle.setText(data.getSessionSubtitle()); mPhotoViewContainer.setBackgroundColor(UIUtils.scaleSessionColorToDefaultBG(data.getSessionColor())); if (data.hasPhotoUrl()) { mHasPhoto = true;/*from w ww . j ava2s . c o m*/ mNoPlaceholderImageLoader.loadImage(data.getPhotoUrl(), mPhotoView, new RequestListener<String, Bitmap>() { @Override public boolean onException(Exception e, String model, Target<Bitmap> target, boolean isFirstResource) { mHasPhoto = false; recomputePhotoAndScrollingMetrics(); return false; } @Override public boolean onResourceReady(Bitmap resource, String model, Target<Bitmap> target, boolean isFromMemoryCache, boolean isFirstResource) { // Trigger image transition recomputePhotoAndScrollingMetrics(); return false; } }); recomputePhotoAndScrollingMetrics(); } else { mHasPhoto = false; recomputePhotoAndScrollingMetrics(); } tryExecuteDeferredUiOperations(); //displayTags(data); if (!data.isKeynote()) { showStarredDeferred(data.isInSchedule(), false); } if (!TextUtils.isEmpty(data.getSessionAbstract())) { UIUtils.setTextMaybeHtml(mAbstract, data.getSessionAbstract()); mAbstract.setVisibility(View.VISIBLE); } else { mAbstract.setVisibility(View.GONE); } // Build requirements section final View requirementsBlock = getActivity().findViewById(R.id.session_requirements_block); final String sessionRequirements = data.getRequirements(); if (!TextUtils.isEmpty(sessionRequirements)) { UIUtils.setTextMaybeHtml(mRequirements, sessionRequirements); requirementsBlock.setVisibility(View.VISIBLE); } else { requirementsBlock.setVisibility(View.GONE); } final ViewGroup relatedVideosBlock = (ViewGroup) getActivity().findViewById(R.id.related_videos_block); relatedVideosBlock.setVisibility(View.GONE); if (data.getLiveStreamVideoWatched()) { mPhotoView.setColorFilter(getContext().getResources().getColor(R.color.video_scrim_watched)); mLiveStreamPlayIconAndText.setText(getString(R.string.session_replay)); } if (data.hasLiveStream()) { mLiveStreamPlayIconAndText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String videoId = YouTubeUtils.getVideoIdFromSessionData(data.getYouTubeUrl(), data.getLiveStreamId()); YouTubeUtils.showYouTubeVideo("Z9FXpMD6JO8", getActivity()); } }); } fireAnalyticsScreenView(data.getSessionTitle()); mHandler.post(new Runnable() { @Override public void run() { onScrollChanged(0, 0); // trigger scroll handling mScrollViewChild.setVisibility(View.VISIBLE); //mAbstract.setTextIsSelectable(true); } }); mTimeHintUpdaterRunnable = new Runnable() { @Override public void run() { if (getActivity() == null) { // Do not post a delayed message if the activity is detached. return; } updateTimeBasedUi(data); mHandler.postDelayed(mTimeHintUpdaterRunnable, SessionDetailConstants.TIME_HINT_UPDATE_INTERVAL); } }; mHandler.postDelayed(mTimeHintUpdaterRunnable, SessionDetailConstants.TIME_HINT_UPDATE_INTERVAL); }
From source file:com.jtechme.apphub.privileged.views.InstallConfirmActivity.java
private void startInstallConfirm() { final Drawable appIcon = mAppDiff.mPkgInfo.applicationInfo.loadIcon(mPm); final String appLabel = (String) mAppDiff.mPkgInfo.applicationInfo.loadLabel(mPm); View appSnippet = findViewById(R.id.app_snippet); ((ImageView) appSnippet.findViewById(R.id.app_icon)).setImageDrawable(appIcon); ((TextView) appSnippet.findViewById(R.id.app_name)).setText(appLabel); TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost); tabHost.setup();//from w w w .ja v a 2 s. c om ViewPager viewPager = (ViewPager) findViewById(R.id.pager); TabsAdapter adapter = new TabsAdapter(this, tabHost, viewPager); adapter.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String tabId) { } }); boolean permVisible = false; mScrollView = null; mOkCanInstall = false; int msg = 0; AppSecurityPermissions perms = new AppSecurityPermissions(this, mAppDiff.mPkgInfo); if (mAppDiff.mInstalledAppInfo != null) { msg = (mAppDiff.mInstalledAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ? R.string.install_confirm_update_system : R.string.install_confirm_update; mScrollView = new CaffeinatedScrollView(this); mScrollView.setFillViewport(true); final boolean newPermissionsFound = perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW) > 0; if (newPermissionsFound) { permVisible = true; mScrollView.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_NEW)); } else { throw new RuntimeException( "This should not happen. No new permissions were found but InstallConfirmActivity has been started!"); } adapter.addTab(tabHost.newTabSpec(TAB_ID_NEW).setIndicator(getText(R.string.newPerms)), mScrollView); } else { findViewById(R.id.tabscontainer).setVisibility(View.GONE); findViewById(R.id.divider).setVisibility(View.VISIBLE); } final int np = perms.getPermissionCount(AppSecurityPermissions.WHICH_PERSONAL); final int nd = perms.getPermissionCount(AppSecurityPermissions.WHICH_DEVICE); if (np > 0 || nd > 0) { permVisible = true; LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View root = inflater.inflate(R.layout.permissions_list, null); if (mScrollView == null) { mScrollView = (CaffeinatedScrollView) root.findViewById(R.id.scrollview); } final ViewGroup privacyList = (ViewGroup) root.findViewById(R.id.privacylist); if (np > 0) { privacyList.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_PERSONAL)); } else { privacyList.setVisibility(View.GONE); } final ViewGroup deviceList = (ViewGroup) root.findViewById(R.id.devicelist); if (nd > 0) { deviceList.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_DEVICE)); } else { root.findViewById(R.id.devicelist).setVisibility(View.GONE); } adapter.addTab(tabHost.newTabSpec(TAB_ID_ALL).setIndicator(getText(R.string.allPerms)), root); } if (!permVisible) { if (mAppDiff.mInstalledAppInfo != null) { // This is an update to an application, but there are no // permissions at all. msg = (mAppDiff.mInstalledAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ? R.string.install_confirm_update_system_no_perms : R.string.install_confirm_update_no_perms; } else { // This is a new application with no permissions. msg = R.string.install_confirm_no_perms; } tabHost.setVisibility(View.GONE); findViewById(R.id.filler).setVisibility(View.VISIBLE); findViewById(R.id.divider).setVisibility(View.GONE); mScrollView = null; } if (msg != 0) { ((TextView) findViewById(R.id.install_confirm)).setText(msg); } mInstallConfirm.setVisibility(View.VISIBLE); mOk = (Button) findViewById(R.id.ok_button); mCancel = (Button) findViewById(R.id.cancel_button); mOk.setOnClickListener(this); mCancel.setOnClickListener(this); if (mScrollView == null) { // There is nothing to scroll view, so the ok button is immediately // set to install. mOk.setText(R.string.menu_install); mOkCanInstall = true; } else { mScrollView.setFullScrollAction(new Runnable() { @Override public void run() { mOk.setText(R.string.menu_install); mOkCanInstall = true; } }); } }
From source file:free.yhc.netmbuddy.YTSearchActivity.java
@Override protected void onResume() { // onResume of each fragments SHOULD be called after 'setController'. // So, super.onResume() is located at the bottom of onResume(). super.onResume(); ViewGroup playerv = (ViewGroup) findViewById(R.id.player); mMp.setController(this, playerv, (ViewGroup) findViewById(R.id.list_drawer), null, mMp.getVideoToolButton());//from w w w. j a v a2 s. c o m if (mMp.hasActiveVideo()) playerv.setVisibility(View.VISIBLE); else playerv.setVisibility(View.GONE); }