private void refreshAccountDetails() { // we only want to show user details for WordPress.com users if (AccountHelper.isSignedIn()) { Account defaultAccount = AccountHelper.getDefaultAccount(); mDisplayNameTextView.setVisibility(View.VISIBLE); mUsernameTextView.setVisibility(View.VISIBLE); mAvatarFrame.setVisibility(View.VISIBLE); int avatarSz = getResources().getDimensionPixelSize(R.dimen.avatar_sz_large); String avatarUrl = GravatarUtils.fixGravatarUrl(defaultAccount.getmAvatar(), avatarSz); mAvatarImageView.setImageUrl(avatarUrl, LeaNetworkImageView.ImageType.AVATAR); mUsernameTextView.setText("@" + defaultAccount.getmUserName()); mLoginLogoutTextView.setText(R.string.me_disconnect_from_leanote_com); String displayName = defaultAccount.getmUserName(); if (!TextUtils.isEmpty(displayName)) { mDisplayNameTextView.setText(displayName); } else { mDisplayNameTextView.setText(defaultAccount.getmUserName()); } } else { mDisplayNameTextView.setVisibility(View.GONE); mUsernameTextView.setVisibility(View.GONE); mAvatarFrame.setVisibility(View.GONE); mLoginLogoutTextView.setText(R.string.me_connect_to_leanote_com); } }
void displaySong(String bookName, Song song) { song_container.setVisibility(song != null ? View.VISIBLE : View.GONE); no_song_data_container.setVisibility(song != null ? View.GONE : View.VISIBLE); if (song != null) { bChangeBook.setText(bookName); bChangeCode.setText(song.code); // construct rendition of scripture references String scripture_references = renderScriptureReferences(PROTOCOL, song.scriptureReferences); templateCustomVars.putString("scripture_references", scripture_references); // $NON-NLS-1$ FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace( R.id.song_container, SongFragment.create(song, "templates/song.html", templateCustomVars)); // $NON-NLS-1$ ft.commitAllowingStateLoss(); currentBookName = bookName; currentSong = song; { // save latest viewed song TODO optimize using new preferences fw Preferences.setString(Prefkey.song_last_bookName, bookName); Preferences.setString(Prefkey.song_last_code, song.code); } } }
private void setFirstViewVisibility(boolean visible) { if (firstView != null) { firstView.setVisibility(visible ? View.VISIBLE : View.GONE); } validationBar.setVisibility(visible ? View.GONE : View.VISIBLE); settingsContainer.setVisibility(visible ? View.GONE : View.VISIBLE); }
private void updateUserInterfaceVisibility(boolean visibility) { mUserIfVisible = visibility; ViewGroup playerv = (ViewGroup) findViewById(R.id.player); ViewGroup drawer = (ViewGroup) findViewById(R.id.list_drawer); if (visibility) { getWindow() .clearFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); playerv.setVisibility(View.VISIBLE); drawer.setVisibility(View.VISIBLE); } else { getWindow() .addFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); playerv.setVisibility(View.GONE); drawer.setVisibility(View.GONE); } if (sNavUiCanBeHidden) setNavVisibility(visibility); fitVideoSurfaceToScreen(Orientation.SYSTEM); }
public void showFixSuggestion(String title) { if (!TextUtils.isEmpty(title)) { ((TextView) mFixActionBar.findViewById(R.id.action_bar_text)).setText(title); } mCategoryLayout.setVisibility(View.GONE); mQuestionsLayout.setVisibility(View.GONE); mFixViewLayout.setVisibility(View.VISIBLE); }
public void switchToNavigateMode() { mMode = MODE_NAVIGATION; mNavigatorContainer.setVisibility(View.VISIBLE); mStatusLayout.setVisibility(View.GONE); updateButtonVisibility(); }
private void updateData() { if (mDataVisible) { mDataActivity.setImageResource(mDataActivityId); mDataGroup.setVisibility(View.VISIBLE); } else { mDataGroup.setVisibility(View.GONE); } }
/** * 具体的转屏执行函数--使用父窗口方式 * * @param container * @param isFullScreen */ private void setIsFullModeUsingContainer(ViewGroup container, boolean isFullScreen) { if (container == null) { VDLog.e(VDVideoFullModeController.TAG, "videoview---setIsFullMode---container--return null"); throw new IllegalArgumentException("container is null"); } if (mVideoViewParams == null) { VDLog.e( VDVideoFullModeController.TAG, "videoview---setIsFullMode---mVideoViewParams--return null"); mVideoViewParams = getLayoutParams(); } mVideoView.beginChangeParentView(); if (mVideoFullScreenContainer != null) { mVideoFullScreenContainer.removeAllViews(); } if (mVideoFullScreenContainer.getParent() == null) { changeToRoot(mVideoFullScreenContainer); } VDVideoViewController controller = VDVideoViewController.getInstance(mContext); if (controller != null) { controller.notifyScreenOrientationSwitch(isFullScreen); if (mVideoView.isPlaying()) { controller.notifyOnShowHideADContainer(true); } } if (isFullScreen) { if (mExternalFullScreenContainer != null) { mExternalFullScreenContainer.setVisibility(VISIBLE); } // 横屏 VDVideoScreenOrientation.setStatusBarVisible(mContext, true); mVideoFullScreenContainer.setVisibility(View.VISIBLE); container.removeView(this); mVideoFullScreenContainer.addView( this, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); } else { if (mExternalFullScreenContainer != null) { mExternalFullScreenContainer.setVisibility(GONE); } VDVideoScreenOrientation.setStatusBarVisible(mContext, false); mVideoFullScreenContainer.setVisibility(View.GONE); // 竖屏 if (getParent() == null) { container.addView(this, mVideoViewParams); } } for (VDVideoViewLayerContext item : mVDVideoViewLayerData.getLayerList()) { if (item.mIsComplexLayerType) { // 有复杂模式才进行横竖屏转换 if (controller != null) item.setFullMode(isFullScreen, controller.isInsertAD()); } } mVideoView.endChangeParentView(); mVideoView.requestVideoLayout(); }
private void updateDataVoice() { if (mMobileDataVoiceVisible) { mMobileSignalData.setImageResource(mMobileSignalDataId); mMobileSignalVoice.setImageResource(mMobileSignalVoiceId); mMobileDataVoiceGroup.setVisibility(View.VISIBLE); } else { mMobileDataVoiceGroup.setVisibility(View.GONE); } }
// Run after each indicator change. private void apply() { if (mWifiGroup == null) return; if (mWifiVisible) { mWifiGroup.setVisibility(View.VISIBLE); mWifi.setImageResource(mWifiStrengthId); mWifiActivity.setImageResource(mWifiActivityId); mWifiGroup.setContentDescription(mWifiDescription); } else { mWifiGroup.setVisibility(View.GONE); } if (DEBUG) Slog.d( TAG, String.format( "wifi: %s sig=%d act=%d", (mWifiVisible ? "VISIBLE" : "GONE"), mWifiStrengthId, mWifiActivityId)); if (mMobileVisible && !mIsAirplaneMode) { mMobileGroup.setVisibility(View.VISIBLE); mMobile.setImageResource(mMobileStrengthId); mMobileActivity.setImageResource(mMobileActivityId); mMobileType.setImageResource(mMobileTypeId); mMobileGroup.setContentDescription(mMobileTypeDescription + " " + mMobileDescription); } else { mMobileGroup.setVisibility(View.GONE); } if (mIsAirplaneMode) { mAirplane.setVisibility(View.VISIBLE); mAirplane.setImageResource(mAirplaneIconId); } else { mAirplane.setVisibility(View.GONE); } if (mMobileVisible && mWifiVisible && mIsAirplaneMode) { mSpacer.setVisibility(View.INVISIBLE); } else { mSpacer.setVisibility(View.GONE); } if (DEBUG) Slog.d( TAG, String.format( "mobile: %s sig=%d act=%d typ=%d", (mMobileVisible ? "VISIBLE" : "GONE"), mMobileStrengthId, mMobileActivityId, mMobileTypeId)); mMobileType.setVisibility(!mWifiVisible ? View.VISIBLE : View.GONE); updateSettings(); }
private void displayTags(SessionDetailModel data) { if (data.getTagMetadata() == null || data.getTagsString() == null) { mTagsContainer.setVisibility(View.GONE); return; } if (TextUtils.isEmpty(data.getTagsString())) { mTagsContainer.setVisibility(View.GONE); } else { mTagsContainer.setVisibility(View.VISIBLE); mTags.removeAllViews(); LayoutInflater inflater = LayoutInflater.from(getContext()); String[] tagIds = data.getTagsString().split(","); List<TagMetadata.Tag> tags = new ArrayList<TagMetadata.Tag>(); for (String tagId : tagIds) { if (Config.Tags.SESSIONS.equals(tagId) || Config.Tags.SPECIAL_KEYNOTE.equals(tagId)) { continue; } TagMetadata.Tag tag = data.getTagMetadata().getTag(tagId); if (tag == null) { continue; } tags.add(tag); } if (tags.size() == 0) { mTagsContainer.setVisibility(View.GONE); return; } Collections.sort(tags, TagMetadata.TAG_DISPLAY_ORDER_COMPARATOR); for (final TagMetadata.Tag tag : tags) { TextView chipView = (TextView) inflater.inflate(R.layout.include_session_tag_chip, mTags, false); chipView.setText(tag.getName()); chipView.setContentDescription(getString(R.string.talkback_button, tag.getName())); chipView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getContext(), ExploreSessionsActivity.class) .putExtra(ExploreSessionsActivity.EXTRA_FILTER_TAG, tag.getId()) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } }); mTags.addView(chipView); } } }
public void showLoading(boolean yes) { if (yes) { mContext.findViewById(R.id.examine_loading).setVisibility(View.VISIBLE); mCategoryLayout.setVisibility(View.GONE); mQuestionsLayout.setVisibility(View.GONE); mFixViewLayout.setVisibility(View.GONE); } else { mContext.findViewById(R.id.examine_loading).setVisibility(View.GONE); } }
/** prevent bottom view get any touch event. Especially in LayDown mode. */ private void safeBottomView() { Status status = getOpenStatus(); ViewGroup bottom = getBottomView(); if (status == Status.Close) { if (bottom.getVisibility() != INVISIBLE) bottom.setVisibility(INVISIBLE); } else { if (bottom.getVisibility() != VISIBLE) bottom.setVisibility(VISIBLE); } }
private void showOffline() { // show offline container ViewGroup containerContent = (ViewGroup) mRootView.findViewById(R.id.container_content); ViewGroup containerProgress = (ViewGroup) mRootView.findViewById(R.id.container_progress); ViewGroup containerOffline = (ViewGroup) mRootView.findViewById(R.id.container_offline); containerContent.setVisibility(View.GONE); containerProgress.setVisibility(View.GONE); containerOffline.setVisibility(View.VISIBLE); mViewState = ViewState.OFFLINE; }
/** Toggles visibility of chart/data UI parts. */ protected void toggleChartData(MenuItem item) { if (View.VISIBLE == chartframe.getVisibility()) { chartframe.setVisibility(View.GONE); dataframe.setVisibility(View.VISIBLE); item.setIcon(this.getResources().getDrawable(R.drawable.icon_graph)); } else { chartframe.setVisibility(View.VISIBLE); dataframe.setVisibility(View.GONE); item.setIcon(this.getResources().getDrawable(R.drawable.icon_data)); } }
private void showEmpty() { // show empty container ViewGroup containerContent = (ViewGroup) mRootView.findViewById(R.id.container_content); ViewGroup containerProgress = (ViewGroup) mRootView.findViewById(R.id.container_progress); ViewGroup containerOffline = (ViewGroup) mRootView.findViewById(R.id.container_offline); ViewGroup containerEmpty = (ViewGroup) mRootView.findViewById(R.id.container_empty); containerContent.setVisibility(View.GONE); containerProgress.setVisibility(View.GONE); containerOffline.setVisibility(View.GONE); containerEmpty.setVisibility(View.VISIBLE); mViewState = ViewState.EMPTY; }
private void loadData() { for (int i = mNumVisible - 1; i >= 0; i--) { ViewGroup parent = (ViewGroup) viewCollection.get(i); int index = (mIndex + mNumVisible - 1) - i; if (index > mAdapter.getCount() - 1) { parent.setVisibility(View.GONE); } else { View child = mAdapter.getView(index, getContentView(), this); parent.addView(child); parent.setVisibility(View.VISIBLE); } } }
private void visibilitySwitcher(boolean isSignedIn) { if (isSignedIn) { userProfileContainer.setVisibility(View.VISIBLE); getStartedContainer.setVisibility(View.INVISIBLE); swipeRefreshLayout.setVisibility(View.VISIBLE); signInButton.setText(getString(R.string.sign_out_button)); } else { userProfileContainer.setVisibility(View.INVISIBLE); getStartedContainer.setVisibility(View.VISIBLE); swipeRefreshLayout.setVisibility(View.GONE); signInButton.setText(getString(R.string.sign_in_button)); } }
public void showType(final String typeCode) { ViewGroup v = (ViewGroup) this.expandBarResultListener; resetResult(); if (typeCode.equals(ServiceCode.BANK_TRANSFER_PAYMENT)) { v.setVisibility(View.VISIBLE); } else if (typeCode.equals(ServiceCode.TRANSFER_ENTRY_PAYMENT)) { v.setVisibility(View.VISIBLE); } else if (typeCode.equals(ServiceCode.SIM_TOP_UP)) { v.setVisibility(View.GONE); } else if (typeCode.equals(ServiceCode.CARD_RECHARGE_PAYMENT)) { v.setVisibility(View.GONE); } }
/** package* */ void toggleWordWrap() { ViewGroup vSrc = this.mWordWrap ? this.mWordWrapView : this.mNoWordWrapView; ViewGroup vDst = this.mWordWrap ? this.mNoWordWrapView : this.mWordWrapView; ViewGroup vSrcParent = this.mWordWrap ? this.mWordWrapView : (ViewGroup) this.mNoWordWrapView.getChildAt(0); ViewGroup vDstParent = this.mWordWrap ? (ViewGroup) this.mNoWordWrapView.getChildAt(0) : this.mWordWrapView; vSrc.setVisibility(View.GONE); vSrcParent.removeView(this.mEditor); vDstParent.addView(this.mEditor); vDst.setVisibility(View.VISIBLE); vDst.scrollTo(0, 0); this.mWordWrap = !this.mWordWrap; }
public void update(int position) { if (!isHeaderShow) { tvTitle.setText(topic.getTitle()); tvTab.setText(topic.isTop() ? R.string.tab_top : topic.getTab().getNameId()); tvTab.setBackgroundResource( topic.isTop() ? R.drawable.topic_tab_top_background : R.drawable.topic_tab_normal_background); tvTab.setTextColor( activity .getResources() .getColor(topic.isTop() ? android.R.color.white : R.color.text_color_secondary)); tvVisitCount.setText(topic.getVisitCount() + "次浏览"); Picasso.with(activity) .load(topic.getAuthor().getAvatarUrl()) .placeholder(R.drawable.image_placeholder) .into(imgAvatar); tvLoginName.setText(topic.getAuthor().getLoginName()); tvCreateTime.setText( activity.getString(R.string.post_at_$) + FormatUtils.getRecentlyTimeText(topic.getCreateAt())); iconGood.setVisibility(topic.isGood() ? View.VISIBLE : View.GONE); // TODO 这里直接使用WebView,有性能问题 webReplyContent.loadRenderedContent(topic.getRenderedContent()); isHeaderShow = true; } layoutNoReply.setVisibility(topic.getReplies().size() > 0 ? View.GONE : View.VISIBLE); }
/** Rebuild the editor to match our underlying {@link #mEntityDeltaList} object. */ private void bindEditor() { if (mEntityDeltaList == null) { throw new IllegalStateException(); } // If no valid raw contact (to insert the data) was found, we won't have an editable // account type to use. In this case, display an error message and hide the "OK" button. if (mIsReadOnly) { mReadOnlyWarningView.setText(getString(R.string.contact_read_only)); mReadOnlyWarningView.setVisibility(View.VISIBLE); mEditorContainerView.setVisibility(View.GONE); findViewById(R.id.btn_done).setVisibility(View.GONE); // Nothing more to be done, just show the UI showDialogContent(); return; } // Otherwise display an editor that allows the user to add the data to this raw contact. for (DataKind kind : mEditableAccountType.getSortedDataKinds()) { // Skip kind that are not editable if (!kind.editable) continue; if (mMimetype.equals(kind.mimeType)) { for (ValuesDelta valuesDelta : mRawContactDelta.getMimeEntries(mMimetype)) { // Skip entries that aren't visible if (!valuesDelta.isVisible()) continue; if (valuesDelta.isInsert()) { inflateEditorView(kind, valuesDelta, mRawContactDelta); return; } } } } }
public static void hideProgress(ViewGroup mCover) { if (null == mCover) return; if (mCover.getVisibility() == View.VISIBLE) { mCover.setVisibility(View.GONE); } }
@Override public void onHideCustomView() { // This method must be manually (internally) called on video end in the case of VideoView // (typically API level <11) // This method must be manually (internally) called on video end in the case of // HTML5VideoFullScreen (typically API level 11+) because it's not always called automatically // This method must be manually (internally) called on back key press (from this class' // onBackPressed() method) if (isVideoFullscreen()) { // Hide the video view, remove it, and show the non-video view activityVideoView.setVisibility(View.GONE); // 播放视频的 activityVideoView.removeView(videoViewContainer); activityNonVideoView.setVisibility(View.VISIBLE); ((Activity) activityNonVideoView.getContext()) .setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // 强制当前页面在手机中竖屏 // Call back if (videoViewCallback != null) videoViewCallback.onCustomViewHidden(); // Reset video related variables isVideoFullscreen = false; videoViewContainer = null; videoViewCallback = null; // Notify full-screen change if (toggledFullscreenCallback != null) { toggledFullscreenCallback.toggledFullscreen(false); } } }
@Override public void handleMessage(Message msg) { if (msg.what == 0) { // 加载成功 if (_appList.size() == 0) { // 没有数据 _loadingTextView.setText("暂时没有数据!"); _loadingAnimation.cancel(); _loadingImageView.setAnimation(null); _loadingImageView.setVisibility(View.GONE); } else { // TODO: update _adapter.notifyDataSetChanged(); _listView.setVisibility(View.VISIBLE); _loadingAnimation.cancel(); _loadingImageView.setAnimation(null); _loadingLayer.setVisibility(View.INVISIBLE); } } else { _loadingAnimation.cancel(); _loadingImageView.setAnimation(null); _loadingImageView.setVisibility(View.GONE); _loadingTextView.setText("加载数据失败,请稍后再试一次!"); } }
public static void setActionButton( Activity activity, int id, int icon, View.OnClickListener listener) { ViewGroup button = (ViewGroup) activity.findViewById(id); button.setOnClickListener(listener); ((ImageView) button.findViewById(R.id.icon)).setImageResource(icon); button.setVisibility(View.VISIBLE); }
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(); }
public HeaderFactory(ViewGroup mRootView) { this.mRootView = mRootView; mRootView.setVisibility(View.VISIBLE); mRootView.setBackgroundColor(Color.parseColor(setParentBackgroundColor())); onClickListener = setOnClickListener(); setUp(); }
@Subscribe public void scanQRcodeEvent(ScanCodeEvent event) { progressBarLlyt = (ViewGroup) findViewById(R.id.progress_bar_llyt); progressBarLlyt.setVisibility(View.VISIBLE); String imagePath = event.getImageUrl(); if (!TextUtils.isEmpty(imagePath)) { int myWidth = getResources().getDisplayMetrics().widthPixels; int myHeight = getResources().getDisplayMetrics().heightPixels; Glide.with(getApplicationContext()) .load("file://" + imagePath) .asBitmap() .into( new SimpleTarget<Bitmap>(myWidth, myHeight) { @Override public void onResourceReady( Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { progressBarLlyt.setVisibility(View.GONE); Result resultZxing = new DecodeUtils(DecodeUtils.DECODE_DATA_MODE_ALL).decodeWithZxing(resource); handleDecode(resultZxing, null); } }); } }
private void updateWeatherInfo(WeatherForecast weatherForecast) { if (!weatherForecast.isSuccessed()) { notifier.alert(getString(R.string.weather_not_updated), Toast.LENGTH_LONG); return; } weatherContainer.setVisibility(View.VISIBLE); this.weatherForecast = weatherForecast; swipeIndicatorPresenter = new SwipeIndicatorPresenter(indicatorLayout, weatherForecast.getForecastList().size()); updateUI(); viewPager.setAdapter(new WeatherPagerAdapter(this, weatherForecast.getForecastList())); viewPager.setOnPageChangeListener( new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int i, float v, int i2) {} @Override public void onPageSelected(int i) { updateUI(i); } @Override public void onPageScrollStateChanged(int i) {} }); }