List of usage examples for android.view ViewGroup setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:org.crosswalk.engine.XWalkCordovaWebViewImpl.java
@Override @Deprecated//from w w w . j a v a 2s .c o m 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(); }
From source file:com.google.samples.apps.iosched.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;/* w w w. j a va 2s .co 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(); // Handle Keynote as a special case, where the user cannot remove it // from the schedule (it is auto added to schedule on sync) mAddScheduleButton.setVisibility( (AccountUtils.hasActiveAccount(getContext()) && !data.isKeynote()) ? View.VISIBLE : View.INVISIBLE); 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); updateEmptyView(data); updateTimeBasedUi(data); 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(videoId, 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:org.tigase.messenger.phone.pro.conversations.chat.ChatItemFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_chatitem_list, container, false); ButterKnife.bind(this, root); message.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override/* w w w . jav a2 s . c o m*/ public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) { if (id == R.id.send || id == EditorInfo.IME_NULL) { send(); return true; } return false; } }); message.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Container.setVisibility(View.GONE); iv_face_checked.setVisibility(View.VISIBLE); iv_face_normal.setVisibility(View.GONE); } }); iv_face_normal.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Container.setVisibility(View.VISIBLE); iv_face_checked.setVisibility(View.VISIBLE); iv_face_normal.setVisibility(View.GONE); closeIME(); } }); iv_face_checked.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Container.setVisibility(View.GONE); iv_face_normal.setVisibility(View.VISIBLE); iv_face_checked.setVisibility(View.GONE); } }); sendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { send(); } }); message.addTextChangedListener(watcher); // recyclerView.addItemDecoration(new // DividerItemDecoration(getActivity(), // DividerItemDecoration.VERTICAL_LIST)); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()); linearLayoutManager.setReverseLayout(true); recyclerView.setLayoutManager(linearLayoutManager); this.adapter = new MyChatItemRecyclerViewAdapter(getContext(), null, mListener) { @Override protected void onContentChanged() { refreshChatHistory(); } }; recyclerView.setAdapter(adapter); refreshChatHistory(); return root; }
From source file:com.nachiket.titan.LibraryActivity.java
private void setSearchBoxVisible(boolean visible) { mSearchBoxVisible = visible;//w w w .j a v a 2 s. c o m mSearchBox.setVisibility(visible ? View.VISIBLE : View.GONE); if (mControls != null) { mControls.setVisibility( visible || (mState & PlaybackService.FLAG_NO_MEDIA) != 0 ? View.GONE : View.VISIBLE); } else if (mActionControls != null) { // try to hide the bottom action bar ViewParent parent = mActionControls.getParent(); if (parent != null) parent = parent.getParent(); if (parent != null && parent instanceof ViewGroup) { ViewGroup ab = (ViewGroup) parent; if (ab.getChildCount() == 1) { ab.setVisibility(visible ? View.GONE : View.VISIBLE); } } } if (visible) { mTextFilter.requestFocus(); ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).showSoftInput(mTextFilter, 0); } }
From source file:org.apache.cordova.AndroidWebView.java
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();// w w w . jav a2 s. c o m 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(); }
From source file:com.silentcircle.contacts.editor.RawContactEditorView.java
/** * Set the internal state for this view, given a current * {@link RawContactDelta} state and the {@link com.silentcircle.contacts.model.account.AccountType} that * apply to that state./*from w ww. ja va2 s . c o m*/ */ @Override public void setState(RawContactDelta state, AccountType type, ViewIdGenerator vig, boolean isProfile) { mState = state; // Remove any existing sections mFields.removeAllViews(); // Bail if invalid state or account type if (state == null || type == null) return; setId(vig.getId(state, null, null, ViewIdGenerator.NO_VIEW_INDEX)); // Make sure we have a StructuredName and Organization RawContactModifier.ensureKindExists(state, type, StructuredName.CONTENT_ITEM_TYPE); RawContactModifier.ensureKindExists(state, type, Organization.CONTENT_ITEM_TYPE); mRawContactId = state.getRawContactId(); // Show photo editor when supported RawContactModifier.ensureKindExists(state, type, Photo.CONTENT_ITEM_TYPE); setHasPhotoEditor((type.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null)); getPhotoEditor().setEnabled(isEnabled()); mName.setEnabled(isEnabled()); mPhoneticName.setEnabled(isEnabled()); // Show and hide the appropriate views mFields.setVisibility(VISIBLE); mName.setVisibility(VISIBLE); mPhoneticName.setVisibility(VISIBLE); mGroupMembershipKind = type.getKindForMimetype(GroupMembership.CONTENT_ITEM_TYPE); if (mGroupMembershipKind != null) { mGroupMembershipView = (GroupMembershipView) mInflater.inflate(R.layout.item_group_membership, mFields, false); mGroupMembershipView.setParent(parent); mGroupMembershipView.setKind(mGroupMembershipKind); mGroupMembershipView.setEnabled(isEnabled()); } // Create editor sections for each possible data kind for (DataKind kind : type.getSortedDataKinds()) { // Skip kind of not editable if (!kind.editable) continue; final String mimeType = kind.mimeType; if (StructuredName.CONTENT_ITEM_TYPE.equals(mimeType)) { // Handle special case editor for structured name final RawContactDelta.ValuesDelta primary = state.getPrimaryEntry(mimeType); mName.setValues(type.getKindForMimetype(DataKind.PSEUDO_MIME_TYPE_DISPLAY_NAME), primary, state, false, vig); mPhoneticName.setValues(type.getKindForMimetype(DataKind.PSEUDO_MIME_TYPE_PHONETIC_NAME), primary, state, false, vig); } else if (Photo.CONTENT_ITEM_TYPE.equals(mimeType)) { // Handle special case editor for photos final RawContactDelta.ValuesDelta primary = state.getPrimaryEntry(mimeType); getPhotoEditor().setValues(kind, primary, state, false, vig); } else if (GroupMembership.CONTENT_ITEM_TYPE.equals(mimeType)) { if (mGroupMembershipView != null) { mGroupMembershipView.setState(state); } } else if (Organization.CONTENT_ITEM_TYPE.equals(mimeType)) { // Create the organization section final KindSectionView section = (KindSectionView) mInflater.inflate(R.layout.item_kind_section, mFields, false); section.setTitleVisible(false); section.setEnabled(isEnabled()); section.setState(kind, state, false, vig); // If there is organization info for the contact already, display it if (!section.isEmpty()) { mFields.addView(section); } else { // Otherwise provide the user with an "add organization" button that shows the // EditText fields only when clicked final View organizationView = mInflater.inflate(R.layout.organization_editor_view_switcher, mFields, false); final View addOrganizationButton = organizationView.findViewById(R.id.add_organization_button); final ViewGroup organizationSectionViewContainer = (ViewGroup) organizationView .findViewById(R.id.container); organizationSectionViewContainer.addView(section); // Setup the click listener for the "add organization" button addOrganizationButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Once the user expands the organization field, the user cannot // collapse them again. organizationSectionViewContainer.setVisibility(VISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { EditorAnimator.getInstance().expandOrganization(addOrganizationButton, organizationSectionViewContainer); } else { addOrganizationButton.setVisibility(INVISIBLE); } } }); mFields.addView(organizationView); } } else { // Otherwise use generic section-based editors if (kind.fieldList == null) continue; final KindSectionView section = (KindSectionView) mInflater.inflate(R.layout.item_kind_section, mFields, false); section.setEnabled(isEnabled()); section.setState(kind, state, false, vig); mFields.addView(section); } } if (mGroupMembershipView != null) { mFields.addView(mGroupMembershipView); } updatePhoneticNameVisibility(); addToDefaultGroupIfNeeded(); final int sectionCount = getSectionViewsWithoutFields().size(); mAddFieldButton.setVisibility(sectionCount > 0 ? VISIBLE : GONE); mAddFieldButton.setEnabled(isEnabled()); }
From source file:com.samsistemas.calendarview.widget.CalendarView.java
/** * This method prepare and populate the days in the CalendarView *//*from w ww . java2 s .c om*/ private void setDaysInCalendar() { Calendar calendar = Calendar.getInstance(getLocale()); calendar.setTime(mCalendar.getTime()); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.setFirstDayOfWeek(mFirstDayOfWeek); int firstDayOfMonth = calendar.get(Calendar.DAY_OF_WEEK); // Calculate dayOfMonthIndex int dayOfMonthIndex = CalendarUtility.getWeekIndex(firstDayOfMonth, calendar); int actualMaximum = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); final Calendar startCalendar = (Calendar) calendar.clone(); //Add required number of days startCalendar.add(Calendar.DATE, -(dayOfMonthIndex - 1)); int monthEndIndex = 42 - (actualMaximum + dayOfMonthIndex - 1); DayView dayView; ViewGroup dayOfMonthContainer; for (int i = 1; i < 43; i++) { dayOfMonthContainer = (ViewGroup) mView .findViewWithTag(mContext.getString(R.string.day_of_month_container) + i); dayView = (DayView) mView.findViewWithTag(mContext.getString(R.string.day_of_month_text) + i); if (dayView == null) continue; //Apply the default styles dayOfMonthContainer.setOnClickListener(null); dayView.bind(startCalendar.getTime(), getDecoratorsList()); dayView.setVisibility(View.VISIBLE); if (null != getTypeface()) { dayView.setTypeface(getTypeface()); } if (CalendarUtility.isSameMonth(calendar, startCalendar)) { dayOfMonthContainer.setOnClickListener(onDayOfMonthClickListener); dayOfMonthContainer.setOnLongClickListener(onDayOfMonthLongClickListener); dayView.setBackgroundColor(mCalendarBackgroundColor); mIsCommonDay = true; if (totalDayOfWeekend().length != 0) { for (int weekend : totalDayOfWeekend()) { if (startCalendar.get(Calendar.DAY_OF_WEEK) == weekend) { dayView.setTextColor(mWeekendColor); mIsCommonDay = false; } } } if (mIsCommonDay) { dayView.setTextColor(mDayOfWeekTextColor); } } else { dayView.setBackgroundColor(mDisabledDayBackgroundColor); dayView.setTextColor(mDisabledDayTextColor); if (!isOverflowDateVisible()) dayView.setVisibility(View.GONE); else if (i >= 36 && ((float) monthEndIndex / 7.0f) >= 1) { dayView.setVisibility(View.GONE); } } dayView.decorate(); //Set the current day color if (mCalendar.get(Calendar.MONTH) == startCalendar.get(Calendar.MONTH)) setCurrentDay(mCalendar.getTime()); startCalendar.add(Calendar.DATE, 1); dayOfMonthIndex++; } // If the last week row has no visible days, hide it or show it in case ViewGroup weekRow = (ViewGroup) mView.findViewWithTag("weekRow6"); dayView = (DayView) mView.findViewWithTag("dayOfMonthText36"); if (dayView.getVisibility() != VISIBLE) { weekRow.setVisibility(GONE); } else { weekRow.setVisibility(VISIBLE); } }
From source file:com.github.cpmproto.categorystepfragment.base.GuidedStepListFragment.java
/** * {@inheritDoc}/*from w w w. j ava 2 s . c o m*/ */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (DEBUG) Log.v(TAG, "onCreateView"); resolveTheme(); inflater = getThemeInflater(inflater); rootLayout = (GuidedStepRootLayout) inflater.inflate(R.layout.lb_guidedstep_fragment, container, false); rootLayout.setFocusOutStart(isFocusOutStartAllowed()); rootLayout.setFocusOutEnd(isFocusOutEndAllowed()); rootLayout.setBackgroundColor(Color.TRANSPARENT); rootLayout.setOnKeyPress(this); ViewGroup guidanceContainer = (ViewGroup) rootLayout.findViewById(R.id.content_fragment); guidanceContainer.setVisibility(View.INVISIBLE); ViewGroup actionContainer = (ViewGroup) rootLayout.findViewById(R.id.action_fragment); View actionsView = mActionsStylist.onCreateView(inflater, actionContainer); actionContainer.addView(actionsView); View buttonActionsView = mButtonActionsStylist.onCreateView(inflater, actionContainer); actionContainer.addView(buttonActionsView); GuidedActionAdapter.EditListener editListener = new GuidedActionAdapter.EditListener() { @Override public void onImeOpen() { runImeAnimations(true); } @Override public void onImeClose() { runImeAnimations(false); } @Override public long onGuidedActionEditedAndProceed(GuidedAction action) { return GuidedStepListFragment.this.onGuidedActionEditedAndProceed(action); } @Override public void onGuidedActionEditCanceled(GuidedAction action) { GuidedStepListFragment.this.onGuidedActionEditCanceled(action); } }; mAdapter = new GuidedActionAdapter(getActionsByKey(), new GuidedActionAdapter.ClickListener() { @Override public void onGuidedActionClicked(GuidedAction action) { GuidedStepListFragment.this.onGuidedActionClicked(action); if (isSubActionsExpanded()) { collapseSubActions(); } else if (action.hasSubActions()) { expandSubActions(action); } } }, this, mActionsStylist, false); mButtonAdapter = new GuidedActionAdapter(mButtonActions, new GuidedActionAdapter.ClickListener() { @Override public void onGuidedActionClicked(GuidedAction action) { GuidedStepListFragment.this.onGuidedActionClicked(action); } }, this, mButtonActionsStylist, false); mSubAdapter = new GuidedActionAdapter(null, new GuidedActionAdapter.ClickListener() { @Override public void onGuidedActionClicked(GuidedAction action) { if (mActionsStylist.isInExpandTransition()) { return; } if (GuidedStepListFragment.this.onSubGuidedActionClicked(action)) { collapseSubActions(); } rootLayout.setOnSubcategoryfocus(false); setActions(mActions, action.toString()); } }, this, mActionsStylist, true); mAdapterGroup = new GuidedActionAdapterGroup(); mAdapterGroup.addAdpter(mAdapter, mButtonAdapter); mAdapterGroup.addAdpter(mSubAdapter, null); mAdapterGroup.setEditListener(editListener); mActionsStylist.setEditListener(editListener); mActionsStylist.getActionsGridView().setAdapter(mAdapter); if (mActionsStylist.getSubActionsGridView() != null) { mActionsStylist.getSubActionsGridView().setAdapter(mSubAdapter); } mButtonActionsStylist.getActionsGridView().setAdapter(mButtonAdapter); if (mButtonActions.size() == 0) { // when there is no button actions, we don't need show the second panel, but keep // the width zero to run ChangeBounds transition. LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) buttonActionsView.getLayoutParams(); lp.weight = 0; buttonActionsView.setLayoutParams(lp); } else { // when there are two actions panel, we need adjust the weight of action to // guidedActionContentWidthWeightTwoPanels. Context ctx = mThemeWrapper != null ? mThemeWrapper : getActivity(); TypedValue typedValue = new TypedValue(); if (ctx.getTheme().resolveAttribute(R.attr.guidedActionContentWidthWeightTwoPanels, typedValue, true)) { View actionsRoot = rootLayout.findViewById(R.id.action_fragment_root); float weight = typedValue.getFloat(); LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) actionsRoot.getLayoutParams(); lp.weight = weight; actionsRoot.setLayoutParams(lp); } } int pos = (mSelectedIndex >= 0 && mSelectedIndex < mActions.size()) ? mSelectedIndex : getFirstCheckedAction(); setSelectedActionPosition(pos); setSelectedButtonActionPosition(0); return rootLayout; }
From source file:com.topfeeds4j.sample.app.activities.MainActivity.java
private void changeToMultiPagesMode(TabLayout tabs, ViewGroup singleContainer) { mViewPager.setVisibility(View.VISIBLE); if (mPagerAdapter == null) { String[] statics = getResources().getStringArray(R.array.providers_list); String[] dynamics = Prefs.getInstance().getBloggerNames(); mViewPager.setOffscreenPageLimit(statics.length + dynamics.length); mPagerAdapter = new NewsListPagersAdapter(MainActivity.this, getSupportFragmentManager()); mViewPager.setAdapter(mPagerAdapter); tabs.setupWithViewPager(mViewPager); }//from w w w . j a v a2 s .co m tabs.setVisibility(View.VISIBLE); singleContainer.setVisibility(View.GONE); mProviderSpr.setVisibility(View.GONE); }
From source file:org.alfresco.mobile.android.application.fragments.properties.DetailsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setRetainInstance(false);//from w w w . j a v a2s. c o m container.setVisibility(View.VISIBLE); alfSession = SessionUtils.getSession(getActivity()); if (!getArguments().containsKey(ARGUMENT_ISFAVORITE)) { SessionUtils.checkSession(getActivity(), alfSession); } vRoot = inflater.inflate(R.layout.app_details, container, false); if (!getArguments().containsKey(ARGUMENT_ISFAVORITE)) { if (alfSession == null) { return vRoot; } } node = (Node) getArguments().get(ARGUMENT_NODE); nodeIdentifier = (String) getArguments().get(ARGUMENT_NODE_ID); parentNode = (Folder) getArguments().get(ARGUMENT_NODE_PARENT); if (node == null && nodeIdentifier == null) { return null; } // TAB if (savedInstanceState != null) { tabSelection = savedInstanceState.getInt(TAB_SELECTED); savedInstanceState.remove(TAB_SELECTED); } return vRoot; }