List of usage examples for android.widget ImageView setVisibility
@RemotableViewMethod @Override public void setVisibility(int visibility)
From source file:com.money.manager.ex.home.HomeFragment.java
private void addFooterToExpandableListView(double curTotal, double curReconciled) { // manage footer list view if (linearFooter == null) { linearFooter = (LinearLayout) getActivity().getLayoutInflater().inflate(R.layout.item_account_bills, null);// ww w .ja v a2 s. c o m // text view into layout txtFooterSummary = (TextView) linearFooter.findViewById(R.id.textViewItemAccountTotal); txtFooterSummaryReconciled = (TextView) linearFooter .findViewById(R.id.textViewItemAccountTotalReconciled); if (mHideReconciled) { txtFooterSummaryReconciled.setVisibility(View.GONE); } // set text TextView txtTextSummary = (TextView) linearFooter.findViewById(R.id.textViewItemAccountName); txtTextSummary.setText(R.string.summary); // invisible image ImageView imgSummary = (ImageView) linearFooter.findViewById(R.id.imageViewAccountType); imgSummary.setVisibility(View.INVISIBLE); // set color textview txtTextSummary.setTextColor(Color.GRAY); txtFooterSummary.setTextColor(Color.GRAY); if (!mHideReconciled) { txtFooterSummaryReconciled.setTextColor(Color.GRAY); } } // remove footer mExpandableListView.removeFooterView(linearFooter); // set text txtTotalAccounts.setText(mCurrencyService.getBaseCurrencyFormatted(MoneyFactory.fromDouble(curTotal))); txtFooterSummary.setText(txtTotalAccounts.getText()); if (!mHideReconciled) { txtFooterSummaryReconciled .setText(mCurrencyService.getBaseCurrencyFormatted(MoneyFactory.fromDouble(curReconciled))); } // add footer mExpandableListView.addFooterView(linearFooter, null, false); }
From source file:com.csipsimple.ui.favorites.FavAdapter.java
@Override public void bindView(View view, final Context context, Cursor cursor) { ContentValues cv = new ContentValues(); DatabaseUtils.cursorRowToContentValues(cursor, cv); int type = ContactsWrapper.TYPE_CONTACT; if (cv.containsKey(ContactsWrapper.FIELD_TYPE)) { type = cv.getAsInteger(ContactsWrapper.FIELD_TYPE); }//w ww . jav a 2 s. co m showViewForType(view, type); if (type == ContactsWrapper.TYPE_GROUP) { // Get views TextView tv = (TextView) view.findViewById(R.id.header_text); ImageView icon = (ImageView) view.findViewById(R.id.header_icon); PresenceStatusSpinner presSpinner = (PresenceStatusSpinner) view .findViewById(R.id.header_presence_spinner); // Get datas SipProfile acc = new SipProfile(cursor); final Long profileId = cv.getAsLong(BaseColumns._ID); final String groupName = acc.android_group; final String displayName = acc.display_name; final String wizard = acc.wizard; final boolean publishedEnabled = (acc.publish_enabled == 1); final String domain = acc.getDefaultDomain(); // Bind datas to view tv.setText(displayName); icon.setImageResource(WizardUtils.getWizardIconRes(wizard)); presSpinner.setProfileId(profileId); // Extra menu view if not already set ViewGroup menuViewWrapper = (ViewGroup) view.findViewById(R.id.header_cfg_spinner); MenuCallback newMcb = new MenuCallback(context, profileId, groupName, domain, publishedEnabled); MenuBuilder menuBuilder; if (menuViewWrapper.getTag() == null) { final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); ActionMenuPresenter mActionMenuPresenter = new ActionMenuPresenter(mContext); mActionMenuPresenter.setReserveOverflow(true); menuBuilder = new MenuBuilder(context); menuBuilder.setCallback(newMcb); MenuInflater inflater = new MenuInflater(context); inflater.inflate(R.menu.fav_menu, menuBuilder); menuBuilder.addMenuPresenter(mActionMenuPresenter); ActionMenuView menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(menuViewWrapper); UtilityWrapper.getInstance().setBackgroundDrawable(menuView, null); menuViewWrapper.addView(menuView, layoutParams); menuViewWrapper.setTag(menuBuilder); } else { menuBuilder = (MenuBuilder) menuViewWrapper.getTag(); menuBuilder.setCallback(newMcb); } menuBuilder.findItem(R.id.share_presence).setTitle( publishedEnabled ? R.string.deactivate_presence_sharing : R.string.activate_presence_sharing); menuBuilder.findItem(R.id.set_sip_data).setVisible(!TextUtils.isEmpty(groupName)); } else if (type == ContactsWrapper.TYPE_CONTACT) { ContactInfo ci = ContactsWrapper.getInstance().getContactInfo(context, cursor); ci.userData = cursor.getPosition(); // Get views TextView tv = (TextView) view.findViewById(R.id.contact_name); QuickContactBadge badge = (QuickContactBadge) view.findViewById(R.id.quick_contact_photo); TextView statusText = (TextView) view.findViewById(R.id.status_text); ImageView statusImage = (ImageView) view.findViewById(R.id.status_icon); // Bind if (ci.contactId != null) { tv.setText(ci.displayName); badge.assignContactUri(ci.callerInfo.contactContentUri); ContactsAsyncHelper.updateImageViewWithContactPhotoAsync(context, badge.getImageView(), ci.callerInfo, R.drawable.ic_contact_picture_holo_dark); statusText.setVisibility(ci.hasPresence ? View.VISIBLE : View.GONE); statusText.setText(ci.status); statusImage.setVisibility(ci.hasPresence ? View.VISIBLE : View.GONE); statusImage.setImageResource(ContactsWrapper.getInstance().getPresenceIconResourceId(ci.presence)); } View v; v = view.findViewById(R.id.contact_view); v.setTag(ci); v.setOnClickListener(mPrimaryActionListener); v = view.findViewById(R.id.secondary_action_icon); v.setTag(ci); v.setOnClickListener(mSecondaryActionListener); } else if (type == ContactsWrapper.TYPE_CONFIGURE) { // We only bind if it's the correct type View v = view.findViewById(R.id.configure_view); v.setOnClickListener(this); ConfigureObj cfg = new ConfigureObj(); cfg.profileId = cv.getAsLong(BaseColumns._ID); v.setTag(cfg); } }
From source file:com.fututel.ui.favorites.FavAdapter.java
@Override public void bindView(View view, final Context context, Cursor cursor) { ContentValues cv = new ContentValues(); DatabaseUtils.cursorRowToContentValues(cursor, cv); int type = ContactsWrapper.TYPE_CONTACT; if (cv.containsKey(ContactsWrapper.FIELD_TYPE)) { type = cv.getAsInteger(ContactsWrapper.FIELD_TYPE); }//from w w w .j a v a2 s . c o m showViewForType(view, type); if (type == ContactsWrapper.TYPE_GROUP) { // Get views TextView tv = (TextView) view.findViewById(R.id.header_text); ImageView icon = (ImageView) view.findViewById(R.id.header_icon); PresenceStatusSpinner presSpinner = (PresenceStatusSpinner) view .findViewById(R.id.header_presence_spinner); // Get datas SipProfile acc = new SipProfile(cursor); final Long profileId = cv.getAsLong(BaseColumns._ID); final String groupName = acc.android_group; final String displayName = acc.display_name; final String wizard = acc.wizard; final boolean publishedEnabled = (acc.publish_enabled == 1); final String domain = acc.getDefaultDomain(); // Bind datas to view tv.setText(displayName); icon.setImageResource(WizardUtils.getWizardIconRes(wizard)); presSpinner.setProfileId(profileId); // Extra menu view if not already set ViewGroup menuViewWrapper = (ViewGroup) view.findViewById(R.id.header_cfg_spinner); MenuCallback newMcb = new MenuCallback(context, profileId, groupName, domain, publishedEnabled); MenuBuilder menuBuilder; if (menuViewWrapper.getTag() == null) { final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); ActionMenuPresenter mActionMenuPresenter = new ActionMenuPresenter(mContext); mActionMenuPresenter.setReserveOverflow(true); menuBuilder = new MenuBuilder(context); menuBuilder.setCallback(newMcb); MenuInflater inflater = new MenuInflater(context); inflater.inflate(R.menu.fav_menu, menuBuilder); menuBuilder.addMenuPresenter(mActionMenuPresenter); ActionMenuView menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(menuViewWrapper); UtilityWrapper.getInstance().setBackgroundDrawable(menuView, null); menuViewWrapper.addView(menuView, layoutParams); menuViewWrapper.setTag(menuBuilder); } else { menuBuilder = (MenuBuilder) menuViewWrapper.getTag(); menuBuilder.setCallback(newMcb); } menuBuilder.findItem(R.id.share_presence).setTitle( publishedEnabled ? R.string.deactivate_presence_sharing : R.string.activate_presence_sharing); menuBuilder.findItem(R.id.set_sip_data).setVisible(!TextUtils.isEmpty(groupName)); } else if (type == ContactsWrapper.TYPE_CONTACT) { ContactInfo ci = ContactsWrapper.getInstance().getContactInfo(context, cursor); ci.userData = cursor.getPosition(); // Get views TextView tv = (TextView) view.findViewById(R.id.contact_name); QuickContactBadge badge = (QuickContactBadge) view.findViewById(R.id.quick_contact_photo); TextView statusText = (TextView) view.findViewById(R.id.status_text); ImageView statusImage = (ImageView) view.findViewById(R.id.status_icon); // Bind if (ci.contactId != null) { tv.setText(ci.displayName); badge.assignContactUri(ci.callerInfo.contactContentUri); ContactsAsyncHelper.updateImageViewWithContactPhotoAsync(context, badge.getImageView(), ci.callerInfo, R.drawable.ic_contact_picture_holo_light); statusText.setVisibility(ci.hasPresence ? View.VISIBLE : View.GONE); statusText.setText(ci.status); statusImage.setVisibility(ci.hasPresence ? View.VISIBLE : View.GONE); statusImage.setImageResource(ContactsWrapper.getInstance().getPresenceIconResourceId(ci.presence)); } View v; v = view.findViewById(R.id.contact_view); v.setTag(ci); v.setOnClickListener(mPrimaryActionListener); v = view.findViewById(R.id.secondary_action_icon); v.setTag(ci); v.setOnClickListener(mSecondaryActionListener); } else if (type == ContactsWrapper.TYPE_CONFIGURE) { // We only bind if it's the correct type View v = view.findViewById(R.id.configure_view); v.setOnClickListener(this); ConfigureObj cfg = new ConfigureObj(); cfg.profileId = cv.getAsLong(BaseColumns._ID); v.setTag(cfg); } }
From source file:org.ohmage.prompt.multichoicecustom.MultiChoiceCustomPrompt.java
private void showAddItemControls(Context context, boolean show) { ImageView imageView = (ImageView) mFooterView.findViewById(R.id.image); TextView textView = (TextView) mFooterView.findViewById(R.id.text); EditText editText = (EditText) mFooterView.findViewById(R.id.new_choice_edit); ImageButton mButton = (ImageButton) mFooterView.findViewById(R.id.ok_button); ImageButton mCancelButton = (ImageButton) mFooterView.findViewById(R.id.cancel_button); //editText.setText(""); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (show) {/*from w w w . j a v a 2s . c o m*/ editText.setText(mEnteredText); mIsAddingNewItem = true; imageView.setVisibility(View.GONE); textView.setVisibility(View.GONE); editText.setVisibility(View.VISIBLE); mButton.setVisibility(View.VISIBLE); mCancelButton.setVisibility(View.VISIBLE); editText.requestFocus(); imm.showSoftInput(editText, 0); } else { mEnteredText = ""; mIsAddingNewItem = false; imageView.setVisibility(View.VISIBLE); textView.setVisibility(View.VISIBLE); editText.setVisibility(View.GONE); mButton.setVisibility(View.GONE); mCancelButton.setVisibility(View.GONE); imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); } }
From source file:ca.zadrox.dota2esportticker.ui.BaseActivity.java
private View makeNavDrawerItem(final int itemId, ViewGroup container) { boolean selected = getSelfNavDrawerItem() == itemId; int layoutToInflate = 0; if (itemId == NAVDRAWER_ITEM_SEPARATOR) { layoutToInflate = R.layout.navdrawer_separator; } else {//from ww w . ja v a 2 s .c o m layoutToInflate = R.layout.navdrawer_item; } View view = getLayoutInflater().inflate(layoutToInflate, container, false); if (isSeparator(itemId)) { // we are done UIUtils.setAccessibilityIgnore(view); return view; } ImageView iconView = (ImageView) view.findViewById(R.id.icon); TextView titleView = (TextView) view.findViewById(R.id.title); int iconId = itemId >= 0 && itemId < NAVDRAWER_ICON_RES_ID.length ? NAVDRAWER_ICON_RES_ID[itemId] : 0; int titleId = itemId >= 0 && itemId < NAVDRAWER_TITLE_RES_ID.length ? NAVDRAWER_TITLE_RES_ID[itemId] : 0; // set icon and text iconView.setVisibility(iconId > 0 ? View.VISIBLE : View.GONE); if (iconId > 0) { iconView.setImageResource(iconId); } titleView.setText(getString(titleId)); formatNavDrawerItem(view, itemId, selected); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onNavDrawerItemClicked(itemId); } }); return view; }
From source file:org.creativecommons.thelist.activities.CategoryListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_category_list); mContext = this; mMessageHelper = new MessageHelper(mContext); mRequestMethods = new RequestMethods(mContext); mSharedPref = new SharedPreferencesMethods(mContext); mCurrentUser = new ListUser(CategoryListActivity.this); //Google Analytics Tracker ((ListApplication) getApplication()).getTracker(ListApplication.TrackerName.GLOBAL_TRACKER); //Set List Adapter mGridView = (GridView) findViewById(R.id.categoryGrid); adapter = new CategoryListAdapter(this, mCategoryList); //Set up Helper Message if new user if (!mSharedPref.getCategoryHelperViewed()) { //UI Elements final View helperMessage = findViewById(R.id.category_helper_message); ImageButton helperCloseButton = (ImageButton) findViewById(R.id.helper_close_button); helperCloseButton.setOnClickListener(new View.OnClickListener() { @Override//from ww w . j a v a 2 s .c om public void onClick(View v) { helperMessage.setVisibility(View.GONE); mSharedPref.setCategoryHelperViewed(true); } }); helperMessage.setVisibility(View.VISIBLE); } //Get Categories mRequestMethods.getCategories(new RequestMethods.ResponseCallback() { @Override public void onSuccess(JSONArray response) { Log.v(TAG, "> getCategories > onSuccess: " + response); mCategoryData = response; //Get users pre-selected categories if (!(mCurrentUser.isTempUser())) { //If user is logged in, request any pre-selected categories mRequestMethods.getUserCategories(new RequestMethods.ResponseCallback() { @Override public void onSuccess(JSONArray response) { Log.v(TAG, "> getUserCategories > onSuccess " + response.toString()); //Create list of category ids if (response.length() > 0) { //Get array of catIds for (int i = 0; i < response.length(); i++) { try { JSONObject singleCat = response.getJSONObject(i); mUserCategories.add(i, singleCat.getInt("categoryid")); Log.v("USERCATS", "add: " + singleCat.getInt("categoryid")); } catch (JSONException e) { Log.e(TAG, e.getMessage()); } } Log.v(TAG, "users category list: " + mUserCategories.toString()); } updateList(); } //onSuccess @Override public void onFail(VolleyError error) { Log.v(TAG, "> getUserCategories > onFail " + error.toString()); mMessageHelper.showDialog(mContext, getString(R.string.error_title), getString(R.string.error_message)); } }); } else { JSONArray tempUserCategories = mSharedPref.getCategorySharedPreference(); if (tempUserCategories != null && tempUserCategories.length() > 0) { //Convert to list + add to mUserCategories for (int i = 0; i < tempUserCategories.length(); i++) { try { mUserCategories.add(i, tempUserCategories.getInt(i)); Log.v(TAG, " TEMPUSER CATEGORIES: " + mUserCategories.toString()); } catch (JSONException e) { e.printStackTrace(); } } } updateList(); } } //onSuccess @Override public void onFail(VolleyError error) { Log.d(TAG, "> getCategories > onFail: " + error.getMessage()); mMessageHelper.showDialog(mContext, getString(R.string.error_title), getString(R.string.error_message)); } }); //When Category is tapped mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //ImageView checkmarkView = (ImageView)view.findViewById(R.id.checkmark); CheckableRelativeLayout checkableLayout = (CheckableRelativeLayout) view .findViewById(R.id.checkable_layout); ImageView checkIcon = (ImageView) view.findViewById(R.id.category_checkmark); TextView categoryNameLabel = (TextView) view.findViewById(R.id.category_title); //Get item clicked + its category id CategoryListItem item = (CategoryListItem) mGridView.getItemAtPosition(position); String catId = String.valueOf(item.getCategoryID()); if (mGridView.isItemChecked(position)) { checkableLayout.getBackground().setAlpha(128); checkIcon.setVisibility(View.VISIBLE); categoryNameLabel.setTextColor(getResources().getColor(R.color.secondary_text_material_dark)); item.setCategoryChecked(true); mRequestMethods.addCategory(catId); //Log.v(TAG, "ADDED " + catId); } else { checkableLayout.getBackground().setAlpha(255); checkIcon.setVisibility(View.GONE); categoryNameLabel .setTextColor(getResources().getColor(R.color.primary_text_default_material_dark)); item.setCategoryChecked(false); mRequestMethods.removeCategory(catId); //Log.v(TAG, "REMOVED " + catId); } //Count how many items are checked: if at least 3, show done button SparseBooleanArray positions = mGridView.getCheckedItemPositions(); int length = positions.size(); int ItemsChecked = 0; if (positions.size() > 0) { for (int i = 0; i < length; i++) { if (positions.get(positions.keyAt(i))) { ItemsChecked++; } } } if (ItemsChecked >= 1) { MenuItem doneButton = menu.findItem(R.id.action_done); doneButton.setVisible(true); } else { MenuItem doneButton = menu.findItem(R.id.action_done); doneButton.setVisible(false); } } }); //setOnItemClickListener }
From source file:com.heath_bar.tvdb.SeriesOverview.java
/** Populate the interface with the data pulled from the webz */ private void PopulateStuff(TvSeries seriesInfo) { if (seriesInfo == null) { Toast.makeText(getApplicationContext(), "Something bad happened. No data was found.", Toast.LENGTH_SHORT).show(); return;// w w w. java2 s . c o m } // Set title getSupportActionBar().setTitle(seriesInfo.getName()); // Hide/Activate the favorites button if (seriesInfo.isFavorite(getApplicationContext())) { Button b = (Button) findViewById(R.id.btn_add_to_favorites); b.setVisibility(View.GONE); } else { Button b = (Button) findViewById(R.id.btn_add_to_favorites); b.setVisibility(View.VISIBLE); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Button b = (Button) findViewById(R.id.btn_add_to_favorites); b.setVisibility(View.GONE); addToFavorites(); } }); } // Set the banner ImageView imageView = (ImageView) findViewById(R.id.series_banner); imageView.setImageBitmap(seriesInfo.getImage().getBitmap()); imageView.setVisibility(View.VISIBLE); final String seriesName = seriesInfo.getName(); imageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { shareImage(); } }); // Set the banner link TextView textview = (TextView) findViewById(R.id.banner_listing_link); textview.setTextColor(getResources().getColor(R.color.tvdb_green)); textview.setVisibility(View.VISIBLE); textview.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getApplicationContext(), BannerListing.class); i.putExtra("seriesId", seriesId); i.putExtra("seriesName", seriesName); startActivity(i); } }); // Set air info textview = (TextView) findViewById(R.id.airs_header); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.last_episode); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.next_episode); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.series_air_info); StringBuffer sb = new StringBuffer(); sb.append(seriesInfo.getAirDay()); if (!seriesInfo.getAirTime().equals("")) sb.append(" at " + seriesInfo.getAirTime()); if (!seriesInfo.getNetwork().equals("")) sb.append(" on " + seriesInfo.getNetwork()); textview.setText(sb.toString()); textview.setVisibility(View.VISIBLE); // Set actors textview = (TextView) findViewById(R.id.starring); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.series_actors); textview.setVisibility(View.VISIBLE); SpannableStringBuilder text = tagsBuilder(seriesInfo.getActors(), "|"); textview.setText(text, BufferType.SPANNABLE); textview.setMovementMethod(LinkMovementMethod.getInstance()); // Set rating textview = (TextView) findViewById(R.id.rating_header); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.rating); textview.setText(seriesInfo.getRating() + " / 10"); textview.setVisibility(View.VISIBLE); // Set genre textview = (TextView) findViewById(R.id.genre_header); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.genre); textview.setText(StringUtil.commafy(seriesInfo.getGenre())); textview.setVisibility(View.VISIBLE); // Set runtime textview = (TextView) findViewById(R.id.runtime_header); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.runtime); textview.setText(seriesInfo.getRuntime() + " minutes"); textview.setVisibility(View.VISIBLE); // Set overview textview = (TextView) findViewById(R.id.overview_header); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.overview); textview.setText(seriesInfo.getOverview()); textview.setVisibility(View.VISIBLE); // Show Seasons header textview = (TextView) findViewById(R.id.seasons_header); textview.setVisibility(View.VISIBLE); // IMDB Link textview = (TextView) findViewById(R.id.imdb_link); textview.setVisibility(View.VISIBLE); final String imdbId = seriesInfo.getIMDB(); SpannableStringBuilder ssb = new SpannableStringBuilder(getResources().getString(R.string.imdb)); ssb.setSpan(new NonUnderlinedClickableSpan(getResources().getString(R.string.imdb)) { @Override public void onClick(View v) { Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.imdb.com/title/" + imdbId)); startActivity(myIntent); } }, 0, ssb.length(), 0); ssb.setSpan(new TextAppearanceSpan(this, R.style.episode_link), 0, ssb.length(), 0); // Set the style of the text textview.setText(ssb, BufferType.SPANNABLE); textview.setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.example.view.astuetz.PagerSlidingTabStrip.java
@SuppressLint("NewApi") private void addIconTab(int position, int resId, String notification) { FrameLayout tabItemCon = new FrameLayout(getContext()); ImageView tab = new ImageView(getContext()); tab.setImageResource(resId);/* w w w .j a va 2 s . c o m*/ tabItemCon.addView(tab); tabIconlist.put(position, tab); ImageView notiSymbol = new ImageView(getContext()); notiSymbol.setImageResource(R.drawable.badge_background); BadgeView noti = new BadgeView(getContext()); noti.setText(notification); tabItemCon.addView(noti); tabItemCon.addView(notiSymbol); if (notification != null && !notification.equals("")) { noti.setVisibility(View.VISIBLE); notiSymbol.setVisibility(View.GONE); } else if (notification != null && notification.equals("")) { noti.setVisibility(View.GONE); notiSymbol.setVisibility(View.VISIBLE); } else { notiSymbol.setVisibility(View.GONE); noti.setVisibility(View.GONE); } int notiSySize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics()); noti.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.RIGHT | Gravity.TOP)); notiSymbol.setLayoutParams(new LayoutParams(notiSySize, notiSySize, Gravity.RIGHT | Gravity.TOP)); FrameLayout tabItem = new FrameLayout(getContext()); tabItem.addView(tabItemCon); tabItemCon.setLayoutParams( new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER)); addTab(position, tabItem); }
From source file:im.neon.adapters.VectorMediasViewerAdapter.java
/** * Switch from the video view to the video thumbnail * @param view the page view/*ww w .ja v a 2 s. com*/ * @param display trur to display the video thumbnail, false to display the video player */ private void displayVideoThumbnail(final View view, boolean display) { final VideoView videoView = (VideoView) view.findViewById(R.id.media_slider_videoview); final ImageView thumbView = (ImageView) view.findViewById(R.id.media_slider_video_thumbnail); final ImageView playView = (ImageView) view.findViewById(R.id.media_slider_video_playView); videoView.setVisibility(display ? View.GONE : View.VISIBLE); thumbView.setVisibility(display ? View.VISIBLE : View.GONE); playView.setVisibility(display ? View.VISIBLE : View.GONE); }
From source file:com.android.mail.photo.MailPhotoViewController.java
/** * Updates the empty views of the fragment based upon the current * state of the attachment.//from w ww . j ava 2 s. co m * @param fragment the current fragment */ private void updateProgressAndEmptyViews(final PhotoViewFragment fragment, final Attachment attachment) { final ProgressBarWrapper progressBar = fragment.getPhotoProgressBar(); final TextView emptyText = fragment.getEmptyText(); final ImageView retryButton = fragment.getRetryButton(); // update the progress if (attachment.shouldShowProgress()) { progressBar.setMax(attachment.size); progressBar.setProgress(attachment.downloadedSize); progressBar.setIndeterminate(false); } else if (fragment.isProgressBarNeeded()) { progressBar.setIndeterminate(true); } // If the download failed, show the empty text and retry button if (attachment.isDownloadFailed()) { emptyText.setText(R.string.photo_load_failed); emptyText.setVisibility(View.VISIBLE); retryButton.setVisibility(View.VISIBLE); retryButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { redownloadAttachment(); emptyText.setVisibility(View.GONE); retryButton.setVisibility(View.GONE); } }); progressBar.setVisibility(View.GONE); } }