public void updateUI(boolean isSignedIn) { if (isSignedIn) { getActionBar().setTitle("My Profile"); logo.setVisibility(View.GONE); header.setVisibility(View.GONE); title.setVisibility(View.GONE); // loginTwitter.setVisibility(View.GONE); btnLoginTwitter.setVisibility(View.GONE); btnSignIn.setVisibility(View.GONE); loginNormal.setVisibility(View.GONE); authButton.setVisibility(View.GONE); btnSignOut.setVisibility(View.GONE); btnRevokeAccess.setVisibility(View.VISIBLE); btnProceed.setVisibility(View.VISIBLE); llProfileLayout.setVisibility(View.VISIBLE); } else { logo.setVisibility(View.VISIBLE); header.setVisibility(View.VISIBLE); title.setVisibility(View.VISIBLE); // loginTwitter.setVisibility(View.VISIBLE); btnLoginTwitter.setVisibility(View.VISIBLE); btnSignIn.setVisibility(View.VISIBLE); loginNormal.setVisibility(View.VISIBLE); authButton.setVisibility(View.VISIBLE); btnSignOut.setVisibility(View.GONE); btnRevokeAccess.setVisibility(View.GONE); btnProceed.setVisibility(View.GONE); llProfileLayout.setVisibility(View.GONE); } }
/** 更新下拉头中的信息。 */ private void updateHeaderView() { if (log.isDebugEnabled()) { log.debug( "updateHeaderView, current status :" + currentStatus + ", last status :" + lastStatus); } if (lastStatus != currentStatus) { if (currentStatus == STATUS_PULL_TO_REFRESH) { description.setText(getResources().getString(R.string.pull_to_refresh)); arrow.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); rotateArrow(); } else if (currentStatus == STATUS_RELEASE_TO_REFRESH) { description.setText(getResources().getString(R.string.release_to_refresh)); arrow.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); rotateArrow(); } else if (currentStatus == STATUS_REFRESHING) { description.setText(getResources().getString(R.string.refreshing)); progressBar.setVisibility(View.VISIBLE); arrow.clearAnimation(); arrow.setVisibility(View.GONE); } refreshUpdatedAtValue(); } }
public ToggleMenuItem( Context context, String label, int imgRes, boolean isToggle, OnCheckedChangeListener listener) { super(context); View.inflate(context, R.layout.sw_menu_item_toggle, this); itemLabel = (TextView) findViewById(R.id.textLabel); itemIcon = (ImageView) findViewById(R.id.imageView); toggleButton = (ToggleButton) findViewById(R.id.toggleButton); if (imgRes != 0) { itemIcon.setImageResource(imgRes); itemIcon.setVisibility(VISIBLE); } else { itemIcon.setVisibility(GONE); } itemLabel.setText(label); toggleButton.setChecked(isToggle); toggleButton.setOnCheckedChangeListener(listener); }
@Override public void onInfo(MediaRecorder mr, int what, int extra) { EMLog.v("video", "onInfo"); if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED) { EMLog.v("video", "max duration reached"); stopRecording(); btn_switch.setVisibility(View.VISIBLE); chronometer.stop(); btnStart.setVisibility(View.VISIBLE); btnStop.setVisibility(View.INVISIBLE); chronometer.stop(); if (localPath == null) { return; } String st3 = getResources().getString(R.string.Whether_to_send); new AlertDialog.Builder(this) .setMessage(st3) .setPositiveButton( R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { arg0.dismiss(); sendVideo(null); } }) .setNegativeButton(R.string.cancel, null) .setCancelable(false) .show(); } }
public void showVoice(boolean show) { if (show && isVoiceAvailable()) { mVoiceImageView.setVisibility(VISIBLE); } else { mVoiceImageView.setVisibility(GONE); } }
void clearImageViews() { final RelativeLayout parent = (RelativeLayout) findViewById(R.id.parent); try { for (int i = 1; i < 10; i++) { String action1 = zero + i; String action2 = X + i; final ImageView view1 = (ImageView) parent.findViewById((R.id.class.getField(action1).getInt(null))); view1.setVisibility(View.INVISIBLE); final ImageView view2 = (ImageView) parent.findViewById((R.id.class.getField(action2).getInt(null))); view2.setVisibility(View.INVISIBLE); } /* * final View winner = (View) * parent.findViewById(R.id.class.getField( "winner").getInt(null)); * winner.setVisibility(View.INVISIBLE); final View tie = (View) * parent.findViewById(R.id.class.getField( "tie").getInt(null)); * tie.setVisibility(View.INVISIBLE); */ } catch (Exception e) { e.printStackTrace(); } }
// À̹ÌÁö ¼û±â°í º¸À̱â. public void FuncImgViewMode(ImageView Img, String Mode) { if (Mode.equals("view")) { Img.setVisibility(ImageView.VISIBLE); } else { Img.setVisibility(ImageView.GONE); } }
private void setChecked(boolean checked) { if (checked) { mCheckmarkImage.setVisibility(View.VISIBLE); } else { mCheckmarkImage.setVisibility(View.GONE); } }
private void fillData() { if (mAppInfoForManage != null) { if (mAppInfoForManage.getIcon() != null) { mAppIcon.setImageDrawable(mAppInfoForManage.getIcon()); } else { mAppIcon.setImageDrawable(getPackageManager().getDefaultActivityIcon()); } mAppName.setText(mAppInfoForManage.getLabel()); mAppVersion.setText(mAppInfoForManage.getVersion()); String sizeStr = new UnitsConversion().defaultConversion(mAppInfoForManage.getSize()); String[] size = sizeStr.split(" "); if (size.length > 1) { mAppSizeNum.setText(size[0]); mAppSizeUnit.setText(size[1]); } mAppDescription.setText(mAppInfoForManage.getDescription()); if (mAppInfoForManage.getPartnerId() == 0) { mScreenshotOne.setVisibility(View.VISIBLE); mScreenshotTwo.setVisibility(View.VISIBLE); mLoadScreenShotOne = new LoadScreenShot(0); mLoadScreenShotTwo = new LoadScreenShot(1); mLoadScreenShotOne.start(); mLoadScreenShotTwo.start(); } else { mScreenshotOne.setVisibility(View.GONE); mScreenshotTwo.setVisibility(View.GONE); } } }
// 动画开启 private void startLogin() { Animation loAnimRotate = AnimationUtils.loadAnimation(this, R.anim.rotate); Animation loAnimScale = AnimationUtils.loadAnimation(this, R.anim.login_photo_scale_small); // 匀速动画 LinearInterpolator linearInterpolator = new LinearInterpolator(); // 加速动画 // AccelerateInterpolator accelerateInterpolator = new // AccelerateInterpolator(); // 弹跳动画 // BounceInterpolator bounceInterpolator = new BounceInterpolator(); loAnimRotate.setInterpolator(linearInterpolator); loAnimScale.setInterpolator(linearInterpolator); moImgProgress.setVisibility(View.VISIBLE); moImgProgress.startAnimation(loAnimRotate); moImgPhoto.startAnimation(loAnimScale); moImgSlider.setVisibility(View.GONE); moViewSlideLine.setVisibility(View.GONE); moEditUsername.setVisibility(View.GONE); moEditPassword.setVisibility(View.GONE); moBtnClearUsername.setVisibility(View.GONE); moBtnClearPassword.setVisibility(View.GONE); // moBtnRegister.setVisibility(View.GONE); moBtnTraveller.setVisibility(View.GONE); moLayoutWelcome.setVisibility(View.VISIBLE); }
public View getView(int position, View convertView, ViewGroup parent) { final View view = (convertView != null) ? convertView : LayoutInflater.from(parent.getContext()) .inflate(R.layout.bookmark_item, parent, false); final ImageView imageView = (ImageView) view.findViewById(R.id.bookmark_item_icon); final TextView textView = (TextView) view.findViewById(R.id.bookmark_item_text); final TextView bookTitleView = (TextView) view.findViewById(R.id.bookmark_item_booktitle); final Bookmark bookmark = getItem(position); if (bookmark == null) { imageView.setVisibility(View.VISIBLE); imageView.setImageResource(R.drawable.ic_list_plus); textView.setText(ZLResource.resource("bookmarksView").getResource("new").getValue()); bookTitleView.setVisibility(View.GONE); } else { imageView.setVisibility(View.GONE); textView.setText(bookmark.getText()); if (myCurrentBook) { bookTitleView.setVisibility(View.GONE); } else { bookTitleView.setVisibility(View.VISIBLE); bookTitleView.setText(bookmark.getBookTitle()); } } return view; }
private void toggleCamera(boolean isNeedEnableCam) { // TODO temporary insertion will be removed when GLVideoView will be fixed DisplayMetrics displaymetrics = new DisplayMetrics(); displaymetrics.setToDefaults(); ViewGroup.LayoutParams layoutParams = imgMyCameraOff.getLayoutParams(); layoutParams.height = localVideoView.getHeight(); layoutParams.width = localVideoView.getWidth(); imgMyCameraOff.setLayoutParams(layoutParams); Log.d( TAG, "Width is: " + imgMyCameraOff.getLayoutParams().width + " height is:" + imgMyCameraOff.getLayoutParams().height); if (SessionManager.getCurrentSession() != null) { SessionManager.getCurrentSession().setVideoEnabled(isNeedEnableCam); cameraToggle.setChecked(isNeedEnableCam); if (isNeedEnableCam) { Log.d(TAG, "Camera is on"); switchCameraToggle.setVisibility(View.VISIBLE); imgMyCameraOff.setVisibility(View.INVISIBLE); } else { Log.d(TAG, "Camera is off"); switchCameraToggle.setVisibility(View.INVISIBLE); imgMyCameraOff.setVisibility(View.VISIBLE); } } }
/** 根据消息已读\未读状态 */ private void getMessageByUserId() { ArrayList<Entity> entitys = imDataBase.getTheMessageByUserId(UserUtil.userid); if (entitys != null) { boolean isFind = false; for (Entity entity : entitys) { // 未读 if (entity.getIsRead() == 0 && entity.getFromId() != UserUtil.userid && UserUtil.userState == 1) { isFind = true; break; } } if (isFind) { mainMenu.setMessageButtonRes(true); messageImageId.setVisibility(View.VISIBLE); } else { mainMenu.setMessageButtonRes(false); messageImageId.setVisibility(View.GONE); } } else { mainMenu.setMessageButtonRes(false); messageImageId.setVisibility(View.GONE); } }
void populateFrom(final int position) { final Profile account = getItem(position); Protocol p = RosterHelper.getInstance().getProtocol(account); if (null != p) { ImageView icProtocol = getImageProtocol(); Icon ic = p.getStatusInfo().getIcon((byte) 0); if (ic != null) { icProtocol.setVisibility(ImageView.VISIBLE); icProtocol.setImageDrawable(ic.getImage()); } else { icProtocol.setVisibility(ImageView.GONE); } } getTextLogin().setText(account.userId); ToggleButton tb = getToggleButton(); tb.setChecked(account.isActive); tb.setFocusableInTouchMode(false); tb.setFocusable(false); tb.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { ToggleButton t = (ToggleButton) v.findViewById(R.id.toggle_button); account.isActive = t.isChecked(); RosterHelper.getInstance().setCurrentProtocol(); Options.saveAccount(account); notifyDataSetChanged(); } }); }
/** 刷新下拉控件的布局 */ private void refreshState() { switch (mCurrrentState) { case STATE_PULL_REFRESH: tvTitle.setText("下拉刷新"); ivArrow.setVisibility(View.VISIBLE); pbProgress.setVisibility(View.INVISIBLE); ivArrow.startAnimation(animDown); break; case STATE_RELEASE_REFRESH: tvTitle.setText("松开刷新"); ivArrow.setVisibility(View.VISIBLE); pbProgress.setVisibility(View.INVISIBLE); ivArrow.startAnimation(animUp); break; case STATE_REFRESHING: tvTitle.setText("正在刷新..."); ivArrow.clearAnimation(); // 必须先清除动画,才能隐藏 ivArrow.setVisibility(View.INVISIBLE); pbProgress.setVisibility(View.VISIBLE); if (mListener != null) { mListener.onRefresh(); } break; default: break; } }
// 刷新顶部 private void refreshTopCover() { // 先全隐藏 for (ImageView coverImageView : coverList) { coverImageView.setVisibility(View.GONE); } // 刷新上端 List<IMModel> imModels = IMModel.findThreeNewFriends(); if (imModels.size() > 0) { for (int i = 0; i < imModels.size(); i++) { // 有哪个显示哪个 ImageView coverImageView = coverList.get(i); coverImageView.setVisibility(View.VISIBLE); IMModel imModel = imModels.get(i); if (null != imModel.getAvatarPath() && imModel.getAvatarPath().length() > 0) { ImageLoader.getInstance() .displayImage( JLXCConst.ATTACHMENT_ADDR + imModel.getAvatarPath(), coverImageView, headImageOptions); } else { coverImageView.setImageResource(R.drawable.default_avatar); } } } }
@Override public void setIcon(Drawable icon) { final boolean showIcon = mItemData.shouldShowIcon() || mForceShowIcon; if (!showIcon && !mPreserveIconSpacing) { return; } if (mIconView == null && icon == null && !mPreserveIconSpacing) { return; } if (mIconView == null) { insertIconView(); } if (icon != null || mPreserveIconSpacing) { mIconView.setImageDrawable(showIcon ? icon : null); if (mIconView.getVisibility() != View.VISIBLE) { mIconView.setVisibility(View.VISIBLE); } } else { mIconView.setVisibility(View.GONE); } }
@Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { for (int i = 0; i < serviceTypeArrayList.size(); i++) { if (i != position) { serviceTypeArrayList.get(i).setSelected(false); } } ImageView imgChecked; for (int i = 0; i < adapterView.getAdapter().getCount(); i++) { View v1 = adapterView.getChildAt(i); if (v1 != null) { imgChecked = (ImageView) v1.findViewById(R.id.service_type_imageView); imgChecked.setVisibility(View.GONE); } } imgChecked = (ImageView) view.findViewById(R.id.service_type_imageView); ServiceType serviceType = serviceTypeArrayList.get(position); if (!serviceType.isSelected()) { imgChecked.setVisibility(View.VISIBLE); serviceType.setSelected(true); new SharedPreferencesManager(BookServiceActivity.this) .setValue(Constant.VALUE_CURRENT_KEY, serviceType.getName()); } else { imgChecked.setVisibility(View.VISIBLE); } }
public void bindString(String no, String co, String tipo) { txNumero.setText(no); switch (co) { case "2": txRegistros.setText("Lunes"); break; case "3": txRegistros.setText("Martes"); break; case "4": txRegistros.setText("Miercoles"); break; case "5": txRegistros.setText("Jueves"); break; case "6": txRegistros.setText("Viernes"); break; } switch (tipo) { case "saliente": ivInCall.setVisibility(View.INVISIBLE); ivOutCall.setVisibility(View.VISIBLE); break; case "entrante": ivInCall.setVisibility(View.VISIBLE); ivOutCall.setVisibility(View.INVISIBLE); break; } }
@Override public void handleMessage(Message msg) { switch (msg.what) { case LOADING: // mPbLoading.setVisibility(View.VISIBLE); mIvEmpty.setVisibility(View.GONE); mLvData.setVisibility(View.VISIBLE); break; case FINISH: mLvData.finishRefreshing(); mPbLoading.setVisibility(View.GONE); if (mDatas.isEmpty()) { mLvData.setVisibility(View.GONE); mIvEmpty.setVisibility(View.VISIBLE); } else { mLvData.setVisibility(View.VISIBLE); mIvEmpty.setVisibility(View.GONE); adapter.notifyDataSetChanged(); if (mIsFirst) { mLvData.smoothScrollToPosition(0); mIsFirst = false; } } break; } }
/** 语音相关 */ public void stopAnimation(BmobMsg item, ImageView iv_voice, ImageView iv_anim_voice) { iv_voice.setVisibility(View.VISIBLE); iv_anim_voice.setVisibility(View.INVISIBLE); if (anim != null) { anim.stop(); } }
@Override protected void onDraw(Canvas canvas) { Drawable backgroundDrawable = ApplicationLoader.getCachedWallpaper(); if (ApplicationLoader.isCustomTheme() && backgroundDrawable != null) { phoneTextView.setTextColor(0xffffffff); shadowView.setVisibility(VISIBLE); if (backgroundDrawable instanceof ColorDrawable) { backgroundDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight()); backgroundDrawable.draw(canvas); } else if (backgroundDrawable instanceof BitmapDrawable) { Bitmap bitmap = ((BitmapDrawable) backgroundDrawable).getBitmap(); float scaleX = (float) getMeasuredWidth() / (float) bitmap.getWidth(); float scaleY = (float) getMeasuredHeight() / (float) bitmap.getHeight(); float scale = scaleX < scaleY ? scaleY : scaleX; int width = (int) (getMeasuredWidth() / scale); int height = (int) (getMeasuredHeight() / scale); int x = (bitmap.getWidth() - width) / 2; int y = (bitmap.getHeight() - height) / 2; srcRect.set(x, y, x + width, y + height); destRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); canvas.drawBitmap(bitmap, srcRect, destRect, paint); } } else { shadowView.setVisibility(INVISIBLE); phoneTextView.setTextColor(0xffc2e5ff); super.onDraw(canvas); } }
/** * Set notification specific details into the header of the Notification. This is specific to the * type of notification that was received. Details include: Icon, Icon Text, Date & Time, Etc... * * @param notification - This View's Notification. */ private void setNotificationTypeInfo() { if (_debug) Log.v("ThemeView.setNotificationTypeInfo()"); Bitmap iconBitmap = null; // Update TextView that contains the image, contact info/calendar info, and timestamp for the // Notification. String formattedTimestamp = Common.formatTimestamp( _context, Common.convertGMTToLocalTime(_context, System.currentTimeMillis(), true)); iconBitmap = BitmapFactory.decodeResource(_context.getResources(), R.drawable.notification_type_sms); String receivedAtText = _context.getString(R.string.message_at_text, formattedTimestamp.toLowerCase()); if (_preferences.getBoolean(Constants.NOTIFICATION_TYPE_INFO_ICON_KEY, true)) { if (iconBitmap != null) { _notificationIconImageView.setImageBitmap(iconBitmap); _notificationIconImageView.setVisibility(View.VISIBLE); } } else { _notificationIconImageView.setVisibility(View.GONE); } _notificationInfoTextView.setTextSize( TypedValue.COMPLEX_UNIT_SP, Float.parseFloat( _preferences.getString( Constants.NOTIFICATION_TYPE_INFO_FONT_SIZE_KEY, Constants.NOTIFICATION_TYPE_INFO_FONT_SIZE_DEFAULT))); _notificationInfoTextView.setText(receivedAtText); }
@Override public View getView(int position, View convertView, ViewGroup parent) { final Channel item = getItem(position); if (convertView == null) { convertView = mInflater.inflate(R.layout.item_program_layout, null); } TextView name = (TextView) convertView.findViewById(R.id.programe_name); ImageView lock = (ImageView) convertView.findViewById(R.id.programe_lock); if (item.isSelected()) { convertView.setBackgroundColor(selectColor); } else { convertView.setBackgroundColor(Color.TRANSPARENT); } if (item.isLocked()) { lock.setVisibility(View.VISIBLE); } else { lock.setVisibility(View.INVISIBLE); } name.setText(item.getName()); return convertView; }
@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 void setOtherBtnVisibility(boolean flag) { if (flag) { mOtherBtn.setVisibility(View.VISIBLE); } else { mOtherBtn.setVisibility(View.GONE); } }
@Override public void prepareViews(View currentView) { imgMap = ((ImageView) ((SmartActivity) getActivity()).getHeaderView().findViewById(R.id.imgMap)); imgFilter = ((ImageView) ((SmartActivity) getActivity()).getHeaderView().findViewById(R.id.imgFilter)); imgFilterSort = ((ImageView) ((SmartActivity) getActivity()).getHeaderView().findViewById(R.id.imgFilterSort)); imgAddEntry = ((ImageView) ((SmartActivity) getActivity()).getHeaderView().findViewById(R.id.imgAddEntry)); imgMap.setVisibility(View.GONE); imgFilter.setVisibility(View.VISIBLE); imgFilterSort.setVisibility(View.VISIBLE); imgAddEntry.setVisibility(View.VISIBLE); if (IN_PARENT_ID != null) { getEntries(); } else { prepareList((List<ArrayList<HashMap<String, String>>>) entryListData, false, false, 1, 10); listAdapterWithHolder = getListAdapter(listData); lstEntries.setAdapter(listAdapterWithHolder); } }
@Override public void handleMessage(Message msg) { if (iWindowControl != null) if (msg.arg1 == 0) iWindowControl.reshow(); // // ((NaviStart3Activity)getFragmentManager().findFragmentById(R.id.mfragment1)).reshow(); else iWindowControl.dismiss(); // // ((NaviStart3Activity)getFragmentManager().findFragmentById(R.id.mfragment1)).dismiss(); int rl1_height = msg.what; params1.height = rl1_height; params2.height = height - rl1_height; rll1.setLayoutParams(params1); rll2.setLayoutParams(params2); if (params1.height == 0) { rll1.setVisibility(View.GONE); img0.setVisibility(View.VISIBLE); } if (params2.height == 0) { rll2.setVisibility(View.GONE); img1.setVisibility(View.VISIBLE); } if (params1.height == params2.height) { rll1.setVisibility(View.VISIBLE); rll2.setVisibility(View.VISIBLE); img0.setVisibility(View.GONE); img1.setVisibility(View.GONE); } super.handleMessage(msg); }
private void setupView(int position, View view) { ImageView iv = (ImageView) view.findViewById(mImageId); TextView tv = (TextView) view.findViewById(mTextId); View separator = view.findViewById(mSeparatorId); if (!isEnabled(position)) { if (iv != null) { iv.setVisibility(View.GONE); } if (tv != null) { tv.setVisibility(View.GONE); } if (separator != null) { separator.setVisibility(View.VISIBLE); } } else { if (separator != null) { separator.setVisibility(View.GONE); } final ImageListItem item = mData.get(position); if (iv != null) { iv.setVisibility(View.VISIBLE); iv.setImageDrawable(item.getDrawable()); } if (tv != null) { tv.setVisibility(View.VISIBLE); tv.setText(item.getText()); } } }
/** * 设置新闻详情 * * @param index */ public void ShowNewsDetail(NewsDetailModel model) { this.model = model; if (model.isFavorate) { favoritBtn.setText("取消收藏"); } else { favoritBtn.setText("收藏"); } scrollView.scrollTo(0, 0); scrollView.smoothScrollTo(0, 0); LogInfo.LogOut("OnlineNewsAdapter", "ShowNews-->pos:" + pos); final NewsDetailModel news = model; mTitle.setText(news.title); mTimeProvenance.setText( (TextUtils.isEmpty(news.cFrom) ? "" : " 来源: " + news.cFrom) + "\t" + news.cTime); LogInfo.LogOut("字数:" + (news.content == null ? 0 : news.content.length())); mDetails.setText(""); postDelayed( new Runnable() { @Override public void run() { setChangeLine(news.content); } }, 50); if (TextUtils.isEmpty(news.imgUrl)) { mNewsImage.setVisibility(GONE); } else { mNewsImage.setVisibility(VISIBLE); ImageEngine.setImageBitmap(news.imgUrl, mNewsImage, R.drawable.ic_launcher, -1); } }